netmaker/config/config_test.go
John Sahhar a27cabc744 main: Add flag (-c) for configuration path
Adds an optional flag (-c) to the netmaker binary
for passing in an absolute path to a netmaker config
file.

Example:

	netmaker -c /etc/default/netmaker-server.yaml

Signed-off-by: John Sahhar <john@gravitl.com>
2022-03-22 15:22:38 -06:00

36 lines
851 B
Go

//Environment file for getting variables
//Currently the only thing it does is set the master password
//Should probably have it take over functions from OS such as port and mongodb connection details
//Reads from the config/environments/dev.yaml file by default
package config
import (
"reflect"
"testing"
)
func Test_readConfig(t *testing.T) {
tests := []struct {
name string
want *EnvironmentConfig
wantErr bool
}{
{
"ensure development config parses",
&EnvironmentConfig{},
false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := ReadConfig("")
if (err != nil) != tt.wantErr {
t.Errorf("readConfig() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("readConfig() = %v, want %v", got, tt.want)
}
})
}
}