Few stack deploy network fixes
- Make sure we use the correct network name for external ones. - Make the default network overridable and only creates networks that are used by services — so that default network is only created if a service doesn't declare a network. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
@ -28,6 +28,11 @@ func TestAddStackLabel(t *testing.T) {
|
||||
|
||||
func TestNetworks(t *testing.T) {
|
||||
namespace := Namespace{name: "foo"}
|
||||
serviceNetworks := map[string]struct{}{
|
||||
"normal": {},
|
||||
"outside": {},
|
||||
"default": {},
|
||||
}
|
||||
source := networkMap{
|
||||
"normal": composetypes.NetworkConfig{
|
||||
Driver: "overlay",
|
||||
@ -79,7 +84,7 @@ func TestNetworks(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
networks, externals := Networks(namespace, source)
|
||||
networks, externals := Networks(namespace, source, serviceNetworks)
|
||||
assert.DeepEqual(t, networks, expected)
|
||||
assert.DeepEqual(t, externals, []string{"special"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user