Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cramja committed Jun 28, 2021
1 parent 31b46fe commit fb0755f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/namespace/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ func TestValidateConfigNamespaces(t *testing.T) {

t.Run("case=supports 3 namespace file formats", func(t *testing.T) {
dir := t.TempDir()
files := map[string]string {
nsfiles := map[string]string{
dir + "/ns.yaml": "name: testns0\nid: 0",
dir + "/ns.json": "{\"name\": \"testns0\",\"id\": 0}",
dir + "/ns.toml": "name = \"testns0\"\nid = 0",
dir + "/ns.toml": "name = \"testns0\"\nid = 0",
}
for fn, contents := range files {
for fn, contents := range nsfiles {
require.NoError(t, ioutil.WriteFile(fn, []byte(contents), fileMode))
}

params := append([]string{"validate"}, keys(files)...)
params := append([]string{"validate"}, keys(nsfiles)...)
cmd.ExecNoErr(t, params...)
})

Expand Down Expand Up @@ -143,8 +143,8 @@ func validateCommand() *cobra.Command {

func keys(m map[string]string) []string {
rv := make([]string, 0, len(m))
for k, _ := range m {
for k := range m {
rv = append(rv, k)
}
return rv
}
}
1 change: 1 addition & 0 deletions internal/driver/config/namespace_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func readNamespaceFile(l *logrusx.Logger, r io.Reader, source string) *Namespace
parse, err := GetParser(source)
if err != nil {
l.WithError(err).WithField("file_name", source).Warn("could not infer format from file extension")
return nil
}

raw, err := ioutil.ReadAll(r)
Expand Down

0 comments on commit fb0755f

Please sign in to comment.