Skip to content

Commit

Permalink
fix(api): update tests for api changes
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sanders <[email protected]>
  • Loading branch information
sandersms committed Jan 18, 2024
1 parent 2c4bafe commit 44968b3
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 67 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation
package main

Expand Down
4 changes: 2 additions & 2 deletions pkg/backend/aio_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package backend implememnts the BackEnd APIs (network facing) of the storage Server
Expand Down Expand Up @@ -498,7 +498,7 @@ func TestBackEnd_ListAioVolumes(t *testing.T) {

testEnv.opiSpdkServer.Pagination["existing-pagination-token"] = 1

request := &pb.ListAioVolumesRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token}
request := &pb.ListAioVolumesRequest{PageSize: tt.size, PageToken: tt.token}
response, err := testEnv.client.ListAioVolumes(testEnv.ctx, request)

if !utils.EqualProtoSlices(response.GetAioVolumes(), tt.out) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/null.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package backend implememnts the BackEnd APIs (network facing) of the storage Server
Expand Down
4 changes: 2 additions & 2 deletions pkg/backend/null_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package backend implememnts the BackEnd APIs (network facing) of the storage Server
Expand Down Expand Up @@ -503,7 +503,7 @@ func TestBackEnd_ListNullVolumes(t *testing.T) {

testEnv.opiSpdkServer.Pagination["existing-pagination-token"] = 1

request := &pb.ListNullVolumesRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token}
request := &pb.ListNullVolumesRequest{PageSize: tt.size, PageToken: tt.token}
response, err := testEnv.client.ListNullVolumes(testEnv.ctx, request)

if !utils.EqualProtoSlices(response.GetNullVolumes(), tt.out) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/nvme_path.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package backend implements the BackEnd APIs (network facing) of the storage Server
Expand Down
36 changes: 18 additions & 18 deletions pkg/backend/nvme_path_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package backend implememnts the BackEnd APIs (network facing) of the storage Server
Expand Down Expand Up @@ -28,7 +28,7 @@ var (
testNvmePathID = "mytest"
testNvmePathName = utils.ResourceIDToNvmePathName(testNvmeCtrlID, testNvmePathID)
testNvmePath = pb.NvmePath{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
Traddr: "127.0.0.1",
Fabrics: &pb.FabricsPath{
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,

Check failure on line 34 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.19)

undefined: _go.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 34 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.20)

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 34 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / golangci

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 34 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.21)

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4
Expand Down Expand Up @@ -156,12 +156,12 @@ func TestBackEnd_CreateNvmePath(t *testing.T) {
"valid request with valid SPDK response for pcie": {
id: testNvmePathID,
in: &pb.NvmePath{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
Traddr: "0000:af:00.0",
},
out: &pb.NvmePath{
Name: testNvmePathName,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
Traddr: "0000:af:00.0",
},
spdk: []string{`{"id":%d,"error":{"code":0,"message":""},"result":["mytest"]}`},
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestBackEnd_CreateNvmePath(t *testing.T) {
"tcp transport type missing fabrics": {
id: testAioVolumeID,
in: &pb.NvmePath{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
Traddr: "127.0.0.1",
Fabrics: nil,
},
Expand All @@ -211,7 +211,7 @@ func TestBackEnd_CreateNvmePath(t *testing.T) {
"pcie transport type with specified fabrics message": {
id: testAioVolumeID,
in: &pb.NvmePath{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
Traddr: "0000:af:00.0",
Fabrics: testNvmePath.Fabrics,
},
Expand All @@ -225,7 +225,7 @@ func TestBackEnd_CreateNvmePath(t *testing.T) {
"pcie transport type with specified tcp controller": {
id: testAioVolumeID,
in: &pb.NvmePath{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
Traddr: "0000:af:00.0",
Fabrics: nil,
},
Expand All @@ -239,13 +239,13 @@ func TestBackEnd_CreateNvmePath(t *testing.T) {
"not supported transport type": {
id: testNvmePathID,
in: &pb.NvmePath{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_CUSTOM,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_CUSTOM,
Traddr: testNvmePath.Traddr,
},
out: nil,
spdk: []string{},
errCode: codes.InvalidArgument,
errMsg: fmt.Sprintf("not supported transport type: %v", pb.NvmeTransportType_NVME_TRANSPORT_CUSTOM),
errMsg: fmt.Sprintf("not supported transport type: %v", pb.NvmeTransportType_NVME_TRANSPORT_TYPE_CUSTOM),
exist: false,
controller: &testNvmeCtrlWithName,
},
Expand Down Expand Up @@ -536,7 +536,7 @@ func TestBackEnd_UpdateNvmePath(t *testing.T) {
mask: nil,
in: &pb.NvmePath{
Name: utils.ResourceIDToNvmePathName(testNvmeCtrlID, "unknown-id"),
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
Traddr: "127.0.0.1",
Fabrics: &pb.FabricsPath{
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,

Check failure on line 542 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.19)

undefined: _go.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 542 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.20)

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 542 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / golangci

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 542 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.21)

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4
Expand All @@ -554,7 +554,7 @@ func TestBackEnd_UpdateNvmePath(t *testing.T) {
mask: nil,
in: &pb.NvmePath{
Name: utils.ResourceIDToNvmePathName(testNvmeCtrlID, "unknown-id"),
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
Traddr: "127.0.0.1",
Fabrics: &pb.FabricsPath{
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,

Check failure on line 560 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.19)

undefined: _go.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 560 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.20)

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4

Check failure on line 560 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / golangci

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4 (typecheck)

Check failure on line 560 in pkg/backend/nvme_path_test.go

View workflow job for this annotation

GitHub Actions / call / build (1.21)

undefined: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4
Expand Down Expand Up @@ -673,14 +673,14 @@ func TestBackEnd_ListNvmePaths(t *testing.T) {
// out: []*pb.NvmePath{
// {
// Name: "Malloc0",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
// },
// {
// Name: "Malloc1",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
Expand All @@ -700,14 +700,14 @@ func TestBackEnd_ListNvmePaths(t *testing.T) {
// out: []*pb.NvmePath{
// {
// Name: "Malloc0",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
// },
// {
// Name: "Malloc1",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
Expand Down Expand Up @@ -742,7 +742,7 @@ func TestBackEnd_ListNvmePaths(t *testing.T) {
// out: []*pb.NvmePath{
// {
// Name: "Malloc0",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
Expand All @@ -759,7 +759,7 @@ func TestBackEnd_ListNvmePaths(t *testing.T) {
// out: []*pb.NvmePath{
// {
// Name: "Malloc1",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
Expand Down Expand Up @@ -864,7 +864,7 @@ func TestBackEnd_GetNvmePath(t *testing.T) {
// in: testNvmePathName,
// out: &pb.NvmePath{
// Name: "Malloc1",
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
// Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
// Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
// Traddr: "127.0.0.1",
// Trsvcid: 4444,
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/nvme_path_validate.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.

// Package backend implememnts the BackEnd APIs (network facing) of the storage Server
package backend
Expand Down
4 changes: 2 additions & 2 deletions pkg/frontend/blk_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package frontend implements the FrontEnd APIs (host facing) of the storage Server
Expand Down Expand Up @@ -445,7 +445,7 @@ func TestFrontEnd_ListVirtioBlks(t *testing.T) {

testEnv.opiSpdkServer.Pagination["existing-pagination-token"] = 1

request := &pb.ListVirtioBlksRequest{Parent: tt.in, PageSize: tt.size, PageToken: tt.token}
request := &pb.ListVirtioBlksRequest{PageSize: tt.size, PageToken: tt.token}
response, err := testEnv.client.ListVirtioBlks(testEnv.ctx, request)

if !utils.EqualProtoSlices(response.GetVirtioBlks(), tt.out) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/frontend.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package frontend implements the FrontEnd APIs (host facing) of the storage Server
Expand Down
6 changes: 3 additions & 3 deletions pkg/frontend/frontend_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
// Copyright (c) 2022-2024 Dell Inc, or its subsidiaries.
// Copyright (C) 2023 Intel Corporation

// Package frontend implements the FrontEnd APIs (host facing) of the storage Server
Expand Down Expand Up @@ -106,7 +106,7 @@ func dialer(opiSpdkServer *Server) func(context.Context, string) (net.Conn, erro
func TestFrontEnd_NewCustomizedServer(t *testing.T) {
validJSONRPC := spdk.NewClient("/some/path")
validNvmeTransports := map[pb.NvmeTransportType]NvmeTransport{
pb.NvmeTransportType_NVME_TRANSPORT_TCP: NewNvmeTCPTransport(validJSONRPC),
pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP: NewNvmeTCPTransport(validJSONRPC),
}
validVirtioBLkTransport := NewVhostUserBlkTransport()
validStore := gomap.NewStore(gomap.DefaultOptions)
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestFrontEnd_NewCustomizedServer(t *testing.T) {
jsonRPC: validJSONRPC,
store: validStore,
nvmeTransports: map[pb.NvmeTransportType]NvmeTransport{
pb.NvmeTransportType_NVME_TRANSPORT_TCP: nil,
pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP: nil,
},
virtioBlkTransport: validVirtioBLkTransport,
wantPanic: true,
Expand Down
Loading

0 comments on commit 44968b3

Please sign in to comment.