Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests check used uniformly with other bridges #321

Merged
merged 6 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/opiproject/gospdk v0.0.0-20230714152149-de73bd1ee87d
github.com/opiproject/opi-api v0.0.0-20230717064243-520b62d2f155
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230717063405-535f8531a28c
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230717074303-2fd87282ba9d
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230717225344-1c476f85174e
github.com/opiproject/opi-strongswan-bridge v0.1.1
go.einride.tech/aip v0.60.0
google.golang.org/grpc v1.56.2
Expand Down
45 changes: 2 additions & 43 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jaypipes/ghw v0.11.0 h1:i0pKvAM7eZk0KvLm9vzpcpDKTRnfR6AQ5pFkPVnYJXU=
github.com/jaypipes/ghw v0.11.0/go.mod h1:jeJGbkRB2lL3/gxYzNYzEDETV1ZJ56OKr+CSeSEym+g=
github.com/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho=
github.com/jaypipes/ghw v0.12.0/go.mod h1:jeJGbkRB2lL3/gxYzNYzEDETV1ZJ56OKr+CSeSEym+g=
github.com/jaypipes/pcidb v1.0.0 h1:vtZIfkiCUE42oYbJS0TAq9XSfSmcsgo9IdxSm9qzYU8=
Expand All @@ -23,44 +21,14 @@ github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/opiproject/gospdk v0.0.0-20230626143600-93a4aa907577 h1:8U1gvKf+tVoAtrUrkhTDflAf30tI4kQ8eaDnQ28PtMg=
github.com/opiproject/gospdk v0.0.0-20230626143600-93a4aa907577/go.mod h1:UzRy421kjqvDVi1awOCLaFpyMLAGKMR3G5tXgqLsiq8=
github.com/opiproject/gospdk v0.0.0-20230706153333-46d1efd3dfde h1:F34T5Kq7GzFSlnycskJ/LXfBDwhsN061ADzhARHO+Lg=
github.com/opiproject/gospdk v0.0.0-20230706153333-46d1efd3dfde/go.mod h1:UzRy421kjqvDVi1awOCLaFpyMLAGKMR3G5tXgqLsiq8=
github.com/opiproject/gospdk v0.0.0-20230714152149-de73bd1ee87d h1:H+E4ITds+AW3j7PHLbhAz3C+OPGJGREJUdmTo9YOviE=
github.com/opiproject/gospdk v0.0.0-20230714152149-de73bd1ee87d/go.mod h1:RqA5Ix7+x0Is8UckJE+6Ji5kCfk6yujWWaTMoRlZv3w=
github.com/opiproject/opi-api v0.0.0-20230705125157-a4deda05eed8 h1:fdYYMsX4ZatPtJc97XRCKCKGwG4/UCSLX0g3vJd3q9o=
github.com/opiproject/opi-api v0.0.0-20230705125157-a4deda05eed8/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20230706163947-5b8771b8cd19 h1:HUCl/sk0Aew10FAqt9OWwgB94X17bZCbTuvmLCQkXHs=
github.com/opiproject/opi-api v0.0.0-20230706163947-5b8771b8cd19/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20230710063409-f31be32bc7c8 h1:gG123taBzr8cYKNn1V8SgQDcm70DV7U7FeBqlkhwtOM=
github.com/opiproject/opi-api v0.0.0-20230710063409-f31be32bc7c8/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20230713203751-f1f72eaaee0e h1:dFlwXYeXuRPKe5w40eDYMpc3+1zCQDXS+9W/5LWCnbU=
github.com/opiproject/opi-api v0.0.0-20230713203751-f1f72eaaee0e/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20230717064243-520b62d2f155 h1:I35TX9YBVrl6PlYe1Eima79mA6VS0qohETDUoB6W+Pk=
github.com/opiproject/opi-api v0.0.0-20230717064243-520b62d2f155/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230703080808-807413f08508 h1:L4HqSy1A0hVJZcQ9y7HStsGAAAXSqYmXc1ROVBecILI=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230703080808-807413f08508/go.mod h1:EClCvtWJfem4oLnk4G6H9y0syYQxeoMrPpz0SQJa4xQ=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230708040512-9629c6975261 h1:bS4M21RQPvru+IAkG8NCtB13jVxro5BDc6Ihl9Es1Dw=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230708040512-9629c6975261/go.mod h1:7S2ndDnloZO6wVayGwKmpHCb2fw055iuLr/mdDZTnHM=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230710063549-c627fa6236c5 h1:l4pDLWKUcX7iI+5kxOkWbJWEHrHBeEqe6UWSC9pzWBk=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230710063549-c627fa6236c5/go.mod h1:4s0LxpJqAMDsnXgRtWCkdHcpbwFvg8YMXACfWm4Ev+A=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230715041832-f751cc6bc477 h1:ge5pd7UlhFKBacPNle0iNYDMAHuIKcpLRK6aGv2IAdo=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230715041832-f751cc6bc477/go.mod h1:1fl+LhHsNT80OLoZzEDlX6RMLK+kwptX10iVyNULLv8=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230717063405-535f8531a28c h1:YtlDmkEy5h/DWm321mIDQ8vLmPC/S7d+Fk1vLsCu2Xc=
github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230717063405-535f8531a28c/go.mod h1:1fl+LhHsNT80OLoZzEDlX6RMLK+kwptX10iVyNULLv8=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230706071707-86f91ce41b01 h1:z6uKTSVsFqJZLvAv7JVyZ5vGiK2RX9Cuo4RiEAbE4q8=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230706071707-86f91ce41b01/go.mod h1:5je/XrLIgLlEK3pAEm5n1YT90t6slIaG/mifRKyMeJQ=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230708123919-f78377f8bfef h1:g1JgkqjqYpqvO0UwSn3p9mhvRQwMAw7G9s6YW8nIfL4=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230708123919-f78377f8bfef/go.mod h1:yjlDc+72x8TONXEzXKIgzDc3WhRNewzVyxVZp6fY3qA=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230710065909-390b6e91ee60 h1:30ZDHGrRhxZ86U/rEU3CuNyOhmBv5+Df9uEc/HDLmBg=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230710065909-390b6e91ee60/go.mod h1:tQgbYDFQ/aOPNkuNj61rGp/IokNhXb0Rujt9CxKqE/g=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230710071001-39a2db006055 h1:/M87dk4FAslz/P1Mlk6kfjWjuPg/rhXTmkLionhJlN8=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230710071001-39a2db006055/go.mod h1:U68emx62nDvPLZVlnh5N1Kn90xAuO8eoiBpyzt0M6s8=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230715185127-b1a5a654d780 h1:BlNIjPraxMV9Fe/HwnU+tcNb1b38uelc4WRBMdmGTpk=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230715185127-b1a5a654d780/go.mod h1:1/u+xF33+fMXF9fLK5mXGCQEp0FZ/c4GJSKcA130v5E=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230717074303-2fd87282ba9d h1:1+IYieF4pHAAgDIWWloY+d2R+8YtbZN1x6HQlLxfX8Y=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230717074303-2fd87282ba9d/go.mod h1:cffIoIPcxa/bLDjjDM5U3stk9Vk0Epx3q1zfOMvCG5Q=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230717225344-1c476f85174e h1:3BDVYFTou8J/lHMcsi+52EzWjaPtTaHq/mW1AC3f53s=
github.com/opiproject/opi-spdk-bridge v0.1.2-0.20230717225344-1c476f85174e/go.mod h1:cffIoIPcxa/bLDjjDM5U3stk9Vk0Epx3q1zfOMvCG5Q=
github.com/opiproject/opi-strongswan-bridge v0.1.1 h1:Mz/8AtA0DD8O/H9jCsDw7wuVoWNiqgXICLsD10XWJ+g=
github.com/opiproject/opi-strongswan-bridge v0.1.1/go.mod h1:ek3r3zLa9nOfb2a7ybdMJvb5BSGU9I17Xo38UMXfE+k=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand All @@ -77,21 +45,12 @@ golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20230629202037-9506855d4529 h1:9JucMWR7sPvCxUFd6UsOUNmA5kCcWOfORaT3tpAsKQs=
google.golang.org/genproto v0.0.0-20230629202037-9506855d4529/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64=
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g=
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0=
google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk=
google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig=
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw=
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 h1:DEH99RbiLZhMxrpEJCZ0A+wdTe0EOgou/poSLx9vWf4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ=
google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
Expand Down
38 changes: 18 additions & 20 deletions pkg/frontend/nvme_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package frontend

import (
"bytes"
"fmt"
"reflect"
"testing"
Expand Down Expand Up @@ -162,12 +161,9 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {

request := &pb.CreateNvmeControllerRequest{NvmeController: tt.in, NvmeControllerId: tt.id}
response, err := testEnv.client.CreateNvmeController(testEnv.ctx, request)
if response != nil {
mtt, _ := proto.Marshal(tt.out)
mResponse, _ := proto.Marshal(response)
if !bytes.Equal(mtt, mResponse) {
t.Error("response: expected", tt.out, "received", response)
}

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -365,7 +361,8 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) {

request := &pb.UpdateNvmeControllerRequest{NvmeController: tt.in, UpdateMask: tt.mask}
response, err := testEnv.client.UpdateNvmeController(testEnv.ctx, request)
if response != nil {

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

Expand Down Expand Up @@ -563,10 +560,14 @@ func TestFrontEnd_ListNvmeControllers(t *testing.T) {

request := &pb.ListNvmeControllersRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token}
response, err := testEnv.client.ListNvmeControllers(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.NvmeControllers, tt.out) {
t.Error("response: expected", tt.out, "received", response.NvmeControllers)
}

if !server.EqualProtoSlices(response.GetNvmeControllers(), tt.out) {
t.Error("response: expected", tt.out, "received", response.GetNvmeControllers())
}

// Empty NextPageToken indicates end of results list
if tt.size != 1 && response.GetNextPageToken() != "" {
t.Error("Expected end of results, received non-empty next page token", response.GetNextPageToken())
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -669,13 +670,9 @@ func TestFrontEnd_GetNvmeController(t *testing.T) {

request := &pb.GetNvmeControllerRequest{Name: tt.in}
response, err := testEnv.client.GetNvmeController(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.Spec, tt.out.Spec) {
t.Error("response: expected", tt.out.GetSpec(), "received", response.GetSpec())
}
if !reflect.DeepEqual(response.Status, tt.out.Status) {
t.Error("response: expected", tt.out.GetStatus(), "received", response.GetStatus())
}

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -731,7 +728,8 @@ func TestFrontEnd_NvmeControllerStats(t *testing.T) {

request := &pb.NvmeControllerStatsRequest{Id: &pc.ObjectKey{Value: tt.in}}
response, err := testEnv.client.NvmeControllerStats(testEnv.ctx, request)
if response != nil {

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

Expand Down
42 changes: 19 additions & 23 deletions pkg/frontend/nvme_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package frontend

import (
"bytes"
"fmt"
"reflect"
"testing"
Expand Down Expand Up @@ -168,12 +167,9 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) {

request := &pb.CreateNvmeNamespaceRequest{NvmeNamespace: tt.in, NvmeNamespaceId: tt.id}
response, err := testEnv.client.CreateNvmeNamespace(testEnv.ctx, request)
if response != nil {
mtt, _ := proto.Marshal(tt.out)
mResponse, _ := proto.Marshal(response)
if !bytes.Equal(mtt, mResponse) {
t.Error("response: expected", tt.out, "received", response)
}

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -371,7 +367,8 @@ func TestFrontEnd_UpdateNvmeNamespace(t *testing.T) {

request := &pb.UpdateNvmeNamespaceRequest{NvmeNamespace: tt.in, UpdateMask: tt.mask}
response, err := testEnv.client.UpdateNvmeNamespace(testEnv.ctx, request)
if response != nil {

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

Expand Down Expand Up @@ -579,10 +576,14 @@ func TestFrontEnd_ListNvmeNamespaces(t *testing.T) {

request := &pb.ListNvmeNamespacesRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token}
response, err := testEnv.client.ListNvmeNamespaces(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.NvmeNamespaces, tt.out) {
t.Error("response: expected", tt.out, "received", response.NvmeNamespaces)
}

if !server.EqualProtoSlices(response.GetNvmeNamespaces(), tt.out) {
t.Error("response: expected", tt.out, "received", response.GetNvmeNamespaces())
}

// Empty NextPageToken indicates end of results list
if tt.size != 1 && response.GetNextPageToken() != "" {
t.Error("Expected end of results, received non-empty next page token", response.GetNextPageToken())
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -694,13 +695,9 @@ func TestFrontEnd_GetNvmeNamespace(t *testing.T) {

request := &pb.GetNvmeNamespaceRequest{Name: tt.in}
response, err := testEnv.client.GetNvmeNamespace(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.Spec, tt.out.Spec) {
t.Error("response: expected", tt.out.GetSpec(), "received", response.GetSpec())
}
if !reflect.DeepEqual(response.Status, tt.out.Status) {
t.Error("response: expected", tt.out.GetStatus(), "received", response.GetStatus())
}

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -807,10 +804,9 @@ func TestFrontEnd_NvmeNamespaceStats(t *testing.T) {

request := &pb.NvmeNamespaceStatsRequest{NamespaceId: &pc.ObjectKey{Value: tt.in}}
response, err := testEnv.client.NvmeNamespaceStats(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.Stats, tt.out) {
t.Error("response: expected", tt.out, "received", response.Stats)
}

if !proto.Equal(response.GetStats(), tt.out) {
t.Error("response: expected", tt.out, "received", response.GetStats())
}

if er, ok := status.FromError(err); ok {
Expand Down
38 changes: 18 additions & 20 deletions pkg/frontend/nvme_subsystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package frontend

import (
"bytes"
"fmt"
"reflect"
"testing"
Expand Down Expand Up @@ -166,12 +165,9 @@ func TestFrontEnd_CreateNvmeSubsystem(t *testing.T) {

request := &pb.CreateNvmeSubsystemRequest{NvmeSubsystem: tt.in, NvmeSubsystemId: tt.id}
response, err := testEnv.client.CreateNvmeSubsystem(testEnv.ctx, request)
if response != nil {
mtt, _ := proto.Marshal(tt.out)
mResponse, _ := proto.Marshal(response)
if !bytes.Equal(mtt, mResponse) {
t.Error("response: expected", tt.out, "received", response)
}

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -372,7 +368,8 @@ func TestFrontEnd_UpdateNvmeSubsystem(t *testing.T) {

request := &pb.UpdateNvmeSubsystemRequest{NvmeSubsystem: tt.in, UpdateMask: tt.mask}
response, err := testEnv.client.UpdateNvmeSubsystem(testEnv.ctx, request)
if response != nil {

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

Expand Down Expand Up @@ -567,10 +564,14 @@ func TestFrontEnd_ListNvmeSubsystem(t *testing.T) {

request := &pb.ListNvmeSubsystemsRequest{Parent: "todo", PageSize: tt.size, PageToken: tt.token}
response, err := testEnv.client.ListNvmeSubsystems(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.NvmeSubsystems, tt.out) {
t.Error("response: expected", tt.out, "received", response.NvmeSubsystems)
}

if !server.EqualProtoSlices(response.GetNvmeSubsystems(), tt.out) {
t.Error("response: expected", tt.out, "received", response.GetNvmeSubsystems())
}

// Empty NextPageToken indicates end of results list
if tt.size != 1 && response.GetNextPageToken() != "" {
t.Error("Expected end of results, received non-empty next page token", response.GetNextPageToken())
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -676,13 +677,9 @@ func TestFrontEnd_GetNvmeSubsystem(t *testing.T) {

request := &pb.GetNvmeSubsystemRequest{Name: tt.in}
response, err := testEnv.client.GetNvmeSubsystem(testEnv.ctx, request)
if response != nil {
if !reflect.DeepEqual(response.Spec, tt.out.Spec) {
t.Error("response: expected", tt.out.GetSpec(), "received", response.GetSpec())
}
if !reflect.DeepEqual(response.Status, tt.out.Status) {
t.Error("response: expected", tt.out.GetStatus(), "received", response.GetStatus())
}

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

if er, ok := status.FromError(err); ok {
Expand Down Expand Up @@ -738,7 +735,8 @@ func TestFrontEnd_NvmeSubsystemStats(t *testing.T) {

request := &pb.NvmeSubsystemStatsRequest{SubsystemId: &pc.ObjectKey{Value: tt.in}}
response, err := testEnv.client.NvmeSubsystemStats(testEnv.ctx, request)
if response != nil {

if !proto.Equal(response, tt.out) {
t.Error("response: expected", tt.out, "received", response)
}

Expand Down
Loading