mirror of https://github.com/docker/docs.git
Merge pull request #417 from frodenas/fix-createentries
Ignore empty addresses when creating discovery entries
This commit is contained in:
commit
2acbea1149
|
|
@ -84,6 +84,9 @@ func CreateEntries(addrs []string) ([]*Entry, error) {
|
|||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
if len(addr) == 0 {
|
||||
continue
|
||||
}
|
||||
entry, err := NewEntry(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ func TestCreateEntries(t *testing.T) {
|
|||
assert.Equal(t, entries, []*Entry{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
entries, err = CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375"})
|
||||
entries, err = CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375", ""})
|
||||
assert.Equal(t, len(entries), 2)
|
||||
assert.Equal(t, entries[0].String(), "127.0.0.1:2375")
|
||||
assert.Equal(t, entries[1].String(), "127.0.0.2:2375")
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue