Skip to content

Commit

Permalink
Test NewVsphereUserConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmeier5 committed Aug 18, 2022
1 parent 4abf74a commit e5c144f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/config/vsphereuser_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package config_test

import (
"testing"

"github.com/aws/eks-anywhere/pkg/config"
)

func TestNewVsphereUserConfig(t *testing.T) {
wantUsername := "FOO"
wantPassword := "BAR"
wantEnv := map[string]string{
config.EksavSphereUsernameKey: wantUsername,
config.EksavSpherePasswordKey: wantPassword,
}
for k, v := range wantEnv {
t.Setenv(k, v)
}
vusc := config.NewVsphereUserConfig()

if vusc.EksaVsphereUsername != wantUsername {
t.Fatalf("vusc.EksaVsphereUsername = %s, want %s", vusc.EksaVsphereUsername, wantUsername)
}
if vusc.EksaVsphereCSIUsername != wantUsername {
t.Fatalf("vusc.EksaVsphereCSIUsername = %s, want %s", vusc.EksaVsphereCSIUsername, wantUsername)
}
if vusc.EksaVsphereCPUsername != wantUsername {
t.Fatalf("vusc.EksaVsphereCPUsername = %s, want %s", vusc.EksaVsphereCPUsername, wantUsername)
}

if vusc.EksaVspherePassword != wantPassword {
t.Fatalf("vusc.EksaVspherePassword = %s, want %s", vusc.EksaVspherePassword, wantPassword)
}
if vusc.EksaVsphereCSIPassword != wantPassword {
t.Fatalf("vusc.EksaVsphereCSIPassword = %s, want %s", vusc.EksaVsphereCSIPassword, wantPassword)
}
if vusc.EksaVsphereCPPassword != wantPassword {
t.Fatalf("vusc.EksaVsphereCPPassword = %s, want %s", vusc.EksaVsphereCPPassword, wantPassword)
}
}

0 comments on commit e5c144f

Please sign in to comment.