From f7c8e52349ff34854d250bcf884f7bd2b9b69bf0 Mon Sep 17 00:00:00 2001 From: Artsiom Koltun Date: Wed, 30 Aug 2023 16:30:43 +0200 Subject: [PATCH] test: check global test objects not changed Signed-off-by: Artsiom Koltun --- pkg/frontend/frontend_test.go | 5 +++ pkg/frontend/nvme_controller_test.go | 47 +++++++++++++++++----------- pkg/frontend/nvme_namespace_test.go | 45 +++++++++++++++----------- pkg/frontend/nvme_subsystem_test.go | 46 ++++++++++++++++----------- 4 files changed, 89 insertions(+), 54 deletions(-) diff --git a/pkg/frontend/frontend_test.go b/pkg/frontend/frontend_test.go index 6a718db3..7a80a480 100644 --- a/pkg/frontend/frontend_test.go +++ b/pkg/frontend/frontend_test.go @@ -121,4 +121,9 @@ var ( PciOperState: 1, }, } + checkGlobalTestProtoObjectsNotChanged = server.CheckTestProtoObjectsNotChanged( + &testSubsystem, + &testController, + &testNamespace, + ) ) diff --git a/pkg/frontend/nvme_controller_test.go b/pkg/frontend/nvme_controller_test.go index 643951ad..d6825b43 100644 --- a/pkg/frontend/nvme_controller_test.go +++ b/pkg/frontend/nvme_controller_test.go @@ -23,6 +23,7 @@ import ( ) func TestFrontEnd_CreateNvmeController(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) spec := &pb.NvmeControllerSpec{ SubsystemNameRef: testSubsystemName, PcieId: &pb.PciEndpoint{ @@ -192,13 +193,15 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) if tt.exist { - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Controllers[testControllerName].Name = testControllerName // testEnv.opiSpdkServer.Controllers[testControllerID].Spec.Id = &pc.ObjectKey{Value: testControllerID} } if tt.out != nil { + tt.out = server.ProtoClone(tt.out) tt.out.Name = testControllerName } @@ -224,6 +227,7 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) { } func TestFrontEnd_DeleteNvmeController(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *emptypb.Empty @@ -312,9 +316,10 @@ func TestFrontEnd_DeleteNvmeController(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Controllers[testControllerName].Name = testControllerName + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.DeleteNvmeControllerRequest{Name: tt.in, AllowMissing: tt.missing} response, err := testEnv.client.DeleteNvmeController(testEnv.ctx, request) @@ -347,6 +352,9 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) { Sqes: 7, Cqes: 8, } + t.Cleanup(server.CheckTestProtoObjectsNotChanged(spec)(t, t.Name())) + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) + tests := map[string]struct { mask *fieldmaskpb.FieldMask in *pb.NvmeController @@ -471,9 +479,9 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.UpdateNvmeControllerRequest{NvmeController: tt.in, UpdateMask: tt.mask} response, err := testEnv.client.UpdateNvmeController(testEnv.ctx, request) @@ -497,6 +505,7 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) { } func TestFrontEnd_ListNvmeControllers(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out []*pb.NvmeController @@ -651,9 +660,9 @@ func TestFrontEnd_ListNvmeControllers(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) testEnv.opiSpdkServer.Pagination["existing-pagination-token"] = 1 request := &pb.ListNvmeControllersRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token} @@ -683,6 +692,7 @@ func TestFrontEnd_ListNvmeControllers(t *testing.T) { } func TestFrontEnd_GetNvmeController(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *pb.NvmeController @@ -760,9 +770,9 @@ func TestFrontEnd_GetNvmeController(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.GetNvmeControllerRequest{Name: tt.in} response, err := testEnv.client.GetNvmeController(testEnv.ctx, request) @@ -786,6 +796,7 @@ func TestFrontEnd_GetNvmeController(t *testing.T) { } func TestFrontEnd_StatsNvmeController(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *pb.VolumeStats @@ -864,9 +875,9 @@ func TestFrontEnd_StatsNvmeController(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.StatsNvmeControllerRequest{Name: tt.in} response, err := testEnv.client.StatsNvmeController(testEnv.ctx, request) diff --git a/pkg/frontend/nvme_namespace_test.go b/pkg/frontend/nvme_namespace_test.go index 4a47bb25..4cf66777 100644 --- a/pkg/frontend/nvme_namespace_test.go +++ b/pkg/frontend/nvme_namespace_test.go @@ -31,6 +31,9 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) { Nguid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb", Eui64: 1967554867335598546, } + t.Cleanup(server.CheckTestProtoObjectsNotChanged(spec)(t, t.Name())) + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) + tests := map[string]struct { id string in *pb.NvmeNamespace @@ -213,14 +216,15 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) testEnv.opiSpdkServer.Subsystems[testSubsystemName].Name = testSubsystemName - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) if tt.exist { - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) testEnv.opiSpdkServer.Namespaces[testNamespaceName].Name = testNamespaceName } if tt.out != nil { + tt.out = server.ProtoClone(tt.out) tt.out.Name = testNamespaceName } @@ -246,6 +250,7 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) { } func TestFrontEnd_DeleteNvmeNamespace(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *emptypb.Empty @@ -342,9 +347,9 @@ func TestFrontEnd_DeleteNvmeNamespace(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.DeleteNvmeNamespaceRequest{Name: tt.in, AllowMissing: tt.missing} response, err := testEnv.client.DeleteNvmeNamespace(testEnv.ctx, request) @@ -367,6 +372,7 @@ func TestFrontEnd_DeleteNvmeNamespace(t *testing.T) { } func TestFrontEnd_UpdateNvmeNamespace(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { mask *fieldmaskpb.FieldMask in *pb.NvmeNamespace @@ -427,9 +433,9 @@ func TestFrontEnd_UpdateNvmeNamespace(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.UpdateNvmeNamespaceRequest{NvmeNamespace: tt.in, UpdateMask: tt.mask} response, err := testEnv.client.UpdateNvmeNamespace(testEnv.ctx, request) @@ -452,6 +458,7 @@ func TestFrontEnd_UpdateNvmeNamespace(t *testing.T) { } func TestFrontEnd_ListNvmeNamespaces(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out []*pb.NvmeNamespace @@ -630,9 +637,9 @@ func TestFrontEnd_ListNvmeNamespaces(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) testEnv.opiSpdkServer.Pagination["existing-pagination-token"] = 1 request := &pb.ListNvmeNamespacesRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token} @@ -662,6 +669,7 @@ func TestFrontEnd_ListNvmeNamespaces(t *testing.T) { } func TestFrontEnd_GetNvmeNamespace(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *pb.NvmeNamespace @@ -749,11 +757,11 @@ func TestFrontEnd_GetNvmeNamespace(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) testEnv.opiSpdkServer.Subsystems[testSubsystemName].Name = testSubsystemName - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) testEnv.opiSpdkServer.Controllers[testControllerName].Name = testControllerName - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) testEnv.opiSpdkServer.Namespaces[testNamespaceName].Name = testNamespaceID request := &pb.GetNvmeNamespaceRequest{Name: tt.in} @@ -778,6 +786,7 @@ func TestFrontEnd_GetNvmeNamespace(t *testing.T) { } func TestFrontEnd_StatsNvmeNamespace(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *pb.VolumeStats @@ -856,9 +865,9 @@ func TestFrontEnd_StatsNvmeNamespace(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.StatsNvmeNamespaceRequest{Name: tt.in} response, err := testEnv.client.StatsNvmeNamespace(testEnv.ctx, request) diff --git a/pkg/frontend/nvme_subsystem_test.go b/pkg/frontend/nvme_subsystem_test.go index d92eadec..3830749e 100644 --- a/pkg/frontend/nvme_subsystem_test.go +++ b/pkg/frontend/nvme_subsystem_test.go @@ -27,6 +27,9 @@ func TestFrontEnd_CreateNvmeSubsystem(t *testing.T) { SerialNumber: "OpiSerialNumber", ModelNumber: "OpiModelNumber", } + t.Cleanup(server.CheckTestProtoObjectsNotChanged(spec)(t, t.Name())) + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) + tests := map[string]struct { id string in *pb.NvmeSubsystem @@ -154,13 +157,15 @@ func TestFrontEnd_CreateNvmeSubsystem(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) if tt.exist { - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Subsystems[testSubsystemName].Name = testSubsystemName // testEnv.opiSpdkServer.Subsystems[testSubsystemID].Spec.Id = &pc.ObjectKey{Value: testSubsystemID} } if tt.out != nil { + tt.out = server.ProtoClone(tt.out) tt.out.Name = testSubsystemName } @@ -186,6 +191,7 @@ func TestFrontEnd_CreateNvmeSubsystem(t *testing.T) { } func TestFrontEnd_DeleteNvmeSubsystem(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *emptypb.Empty @@ -274,9 +280,9 @@ func TestFrontEnd_DeleteNvmeSubsystem(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.DeleteNvmeSubsystemRequest{Name: tt.in, AllowMissing: tt.missing} response, err := testEnv.client.DeleteNvmeSubsystem(testEnv.ctx, request) @@ -300,6 +306,7 @@ func TestFrontEnd_DeleteNvmeSubsystem(t *testing.T) { } func TestFrontEnd_UpdateNvmeSubsystem(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { mask *fieldmaskpb.FieldMask in *pb.NvmeSubsystem @@ -362,9 +369,9 @@ func TestFrontEnd_UpdateNvmeSubsystem(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.UpdateNvmeSubsystemRequest{NvmeSubsystem: tt.in, UpdateMask: tt.mask} response, err := testEnv.client.UpdateNvmeSubsystem(testEnv.ctx, request) @@ -388,6 +395,7 @@ func TestFrontEnd_UpdateNvmeSubsystem(t *testing.T) { } func TestFrontEnd_ListNvmeSubsystem(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) testParent := "todo" tests := map[string]struct { in string @@ -517,9 +525,9 @@ func TestFrontEnd_ListNvmeSubsystem(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) testEnv.opiSpdkServer.Pagination["existing-pagination-token"] = 1 request := &pb.ListNvmeSubsystemsRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token} @@ -549,6 +557,7 @@ func TestFrontEnd_ListNvmeSubsystem(t *testing.T) { } func TestFrontEnd_GetNvmeSubsystem(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *pb.NvmeSubsystem @@ -623,9 +632,9 @@ func TestFrontEnd_GetNvmeSubsystem(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.GetNvmeSubsystemRequest{Name: tt.in} response, err := testEnv.client.GetNvmeSubsystem(testEnv.ctx, request) @@ -649,6 +658,7 @@ func TestFrontEnd_GetNvmeSubsystem(t *testing.T) { } func TestFrontEnd_StatsNvmeSubsystem(t *testing.T) { + t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name())) tests := map[string]struct { in string out *pb.VolumeStats @@ -723,9 +733,9 @@ func TestFrontEnd_StatsNvmeSubsystem(t *testing.T) { testEnv := createTestEnvironment(tt.spdk) defer testEnv.Close() - testEnv.opiSpdkServer.Subsystems[testSubsystemName] = &testSubsystem - testEnv.opiSpdkServer.Controllers[testControllerName] = &testController - testEnv.opiSpdkServer.Namespaces[testNamespaceName] = &testNamespace + testEnv.opiSpdkServer.Subsystems[testSubsystemName] = server.ProtoClone(&testSubsystem) + testEnv.opiSpdkServer.Controllers[testControllerName] = server.ProtoClone(&testController) + testEnv.opiSpdkServer.Namespaces[testNamespaceName] = server.ProtoClone(&testNamespace) request := &pb.StatsNvmeSubsystemRequest{Name: tt.in} response, err := testEnv.client.StatsNvmeSubsystem(testEnv.ctx, request)