-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(CSI-260): lookup of NFS interface group fails when empty name pro…
…vided
- Loading branch information
1 parent
fcf2e14
commit fe238e2
Showing
5 changed files
with
69 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package apiclient | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetNfsInterfaceGroup(t *testing.T) { | ||
apiClient := GetApiClientForTest(t) | ||
// Mock GetInterfaceGroupsByType method | ||
|
||
// Test case: Valid interface group | ||
ig := apiClient.GetNfsInterfaceGroup(context.Background(), "") | ||
assert.NotNil(t, ig) | ||
assert.Contains(t, apiClient.NfsInterfaceGroups, "default") | ||
|
||
// Test case: Invalid interface group | ||
ig = apiClient.GetNfsInterfaceGroup(context.Background(), "NFS") | ||
assert.Nil(t, ig) | ||
|
||
// Test case: Invalid interface group | ||
ig = apiClient.GetNfsInterfaceGroup(context.Background(), "Data") | ||
assert.NotNil(t, ig) | ||
assert.Contains(t, apiClient.NfsInterfaceGroups, "Data") | ||
|
||
} | ||
|
||
func TestGetNfsMountIp(t *testing.T) { | ||
apiClient := GetApiClientForTest(t) | ||
// Mock GetInterfaceGroupsByType method | ||
|
||
// Test case: Valid interface group | ||
ip, err := apiClient.GetNfsMountIp(context.Background(), "") | ||
assert.NoError(t, err) | ||
assert.NotEmpty(t, ip) | ||
|
||
// Test case: Valid interface group | ||
ip, err = apiClient.GetNfsMountIp(context.Background(), "NFS") | ||
assert.NoError(t, err) | ||
assert.NotEmpty(t, ip) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters