Fixed tests
This commit is contained in:
parent
ae2805a729
commit
3dc30db64c
@ -43,13 +43,13 @@ func main() {
|
||||
versionsFromConfig, err = versionedTerraform.LoadVersionsFromConfig(configDir, configFileLocation)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Unable to read config: %v", err)
|
||||
fmt.Printf("Unable to read config: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
needsUpdate, err := versionedTerraform.NeedToUpdateAvailableVersions(configDir, configFileLocation)
|
||||
if os.ErrNotExist == err {
|
||||
fmt.Println("Unable to update version: %v", err)
|
||||
fmt.Printf("Unable to update version: %v\n", err)
|
||||
}
|
||||
|
||||
if needsUpdate {
|
||||
|
@ -23,26 +23,26 @@ func TestUpdateAvailableVersions(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("Test success last update time", func(t *testing.T) {
|
||||
want := true
|
||||
want := false
|
||||
got, err := NeedToUpdateAvailableVersions(fs, "successConfig.conf")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if got != want {
|
||||
t.Errorf("updateAvailableVersions had incorrect output expected %v got %v", got, want)
|
||||
t.Errorf("updateAvailableVersions had incorrect output expected %v got %v", want, got)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test failed last update time", func(t *testing.T) {
|
||||
want := false
|
||||
want := true
|
||||
got, err := NeedToUpdateAvailableVersions(fs, "failConfig.conf")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if got != want {
|
||||
t.Errorf("updateAvailableVersions had incorrect output expected %v got %v", got, want)
|
||||
t.Errorf("updateAvailableVersions had incorrect output expected %v got %v", want, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -96,6 +96,9 @@ func TestInstalledVersions(t *testing.T) {
|
||||
"terraform_1.1.9": {Data: []byte("")},
|
||||
"terraform_1.1.10": {Data: []byte("")},
|
||||
"terraform_1.1.11": {Data: []byte("")},
|
||||
"terraform_0.14.0": {Data: []byte("")},
|
||||
"terraform_0.13.1": {Data: []byte("")},
|
||||
"terraform_0.13.0": {Data: []byte("")},
|
||||
}
|
||||
|
||||
t.Run("Test installed versions", func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user