initial import

This commit is contained in:
kevin
2020-07-26 17:09:05 +08:00
commit 7e3a369a8f
647 changed files with 54754 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
package discov
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConfig(t *testing.T) {
tests := []struct {
EtcdConf
pass bool
}{
{
EtcdConf: EtcdConf{},
pass: false,
},
{
EtcdConf: EtcdConf{
Key: "any",
},
pass: false,
},
{
EtcdConf: EtcdConf{
Hosts: []string{"any"},
},
pass: false,
},
{
EtcdConf: EtcdConf{
Hosts: []string{"any"},
Key: "key",
},
pass: true,
},
}
for _, test := range tests {
if test.pass {
assert.Nil(t, test.EtcdConf.Validate())
} else {
assert.NotNil(t, test.EtcdConf.Validate())
}
}
}