Skip to content

Commit

Permalink
Add tests for config.ReadValid()
Browse files Browse the repository at this point in the history
  • Loading branch information
timburks committed Oct 13, 2023
1 parent 2a19a2f commit 94e5690
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/config/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,4 +514,21 @@ func TestReadExternalFile(t *testing.T) {
if c3.Registry.Address != c.Registry.Address {
t.Errorf("want: %s, got: %s", c3.Registry.Address, c.Registry.Address)
}
// Repeat the above with config.ReadValid
// Verify that we can read a file using its full path name.
c4, err := config.ReadValid(f.Name())
if err != nil {
t.Fatal(err)
}
if c4.Registry.Address != c.Registry.Address {
t.Errorf("want: %s, got: %s", c4.Registry.Address, c.Registry.Address)
}
// Verify that we can read a local file using its base name.
c5, err := config.ReadValid(filepath.Base(f.Name()))
if err != nil {
t.Fatal(err)
}
if c5.Registry.Address != c.Registry.Address {
t.Errorf("want: %s, got: %s", c5.Registry.Address, c.Registry.Address)
}
}

0 comments on commit 94e5690

Please sign in to comment.