tcp-proxy/pkg/config/config_test.go

39 lines
634 B
Go
Raw Permalink Normal View History

2020-01-15 02:09:27 +00:00
package config
import (
"os"
"path"
"testing"
)
func TestLoad(t *testing.T) {
type args struct {
p []string
}
wd, err := os.Getwd()
if err != nil {
t.Errorf("Get WD error = %v", err)
}
fp := path.Join(wd, "..", "..", "config", "config.yml")
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "test load config",
args: args{p: []string{fp}},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := Load(tt.args.p...); (err != nil) != tt.wantErr {
t.Errorf("Load() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}