mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-12 12:39:47 +08:00
eb974dbd63
* Adds a test for parsing the dev.yaml config included in the repository * Changes readConfig() to return an error in addition to the envrionment config Signed-off-by: John Sahhar <john@gravitl.com>
36 lines
849 B
Go
36 lines
849 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)
|
|
}
|
|
})
|
|
}
|
|
}
|