Skip to content

Commit

Permalink
Adding test for GetTransportProtocolFromEnv function
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshi-garg1 authored Nov 25, 2024
1 parent 46314a0 commit fe7b84e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions service/service_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,30 @@ func TestGetProxySettingsFromEnv(t *testing.T) {
assert.Equal(t, "1234", ProxyServicePort)
}

func TestGetTransportProtocolFromEnv(t *testing.T) {
s := service{
useIscsi: true,
}
_ = os.Setenv(EnvPreferredTransportProtocol, "FIBRE")
output := s.getTransportProtocolFromEnv()
assert.Equal(t, "FC", output)

os. Unsetenv(EnvPreferredTransportProtocol)
_ = os.Setenv(EnvPreferredTransportProtocol, "NVMETCP")
output = s.getTransportProtocolFromEnv()
assert.Equal(t, "NVMETCP", output)

os. Unsetenv(EnvPreferredTransportProtocol)
_ = os.Setenv(EnvPreferredTransportProtocol, "")
output = s.getTransportProtocolFromEnv()
assert.Equal(t, "", output)

os. Unsetenv(EnvPreferredTransportProtocol)
_ = os.Setenv(EnvPreferredTransportProtocol, "invalid")
output = s.getTransportProtocolFromEnv()
assert.Equal(t, "", output)
}

func TestSetArrayConfigEnvs(t *testing.T) {

ctx := context.Background()
Expand Down

0 comments on commit fe7b84e

Please sign in to comment.