mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Fix --cluster-store option parser
`--cluster-store` is of form KV-PROVIDER://KV-URL, this commit makes sure that KV-URL contains no "://" Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
@@ -549,3 +549,28 @@ func TestParseSecurityOpt(t *testing.T) {
|
||||
t.Fatal("Expected parseSecurityOpt error, got nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNetworkOptions(t *testing.T) {
|
||||
daemon := &Daemon{}
|
||||
dconfigCorrect := &Config{
|
||||
CommonConfig: CommonConfig{
|
||||
DefaultNetwork: "netPlugin:mynet:dev",
|
||||
ClusterStore: "consul://localhost:8500",
|
||||
ClusterAdvertise: "192.168.0.1:8000",
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := daemon.networkOptions(dconfigCorrect); err != nil {
|
||||
t.Fatalf("Expect networkOptions sucess, got error: %v", err)
|
||||
}
|
||||
|
||||
dconfigWrong := &Config{
|
||||
CommonConfig: CommonConfig{
|
||||
ClusterStore: "consul://localhost:8500://test://bbb",
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := daemon.networkOptions(dconfigWrong); err == nil {
|
||||
t.Fatalf("Expected networkOptions error, got nil")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user