Remove stack configs on stack removal
Signed-off-by: John Stephens <johnstep@docker.com>
Upstream-commit: f05cd11ee2
Component: cli
This commit is contained in:
@ -32,10 +32,18 @@ func TestRemoveStack(t *testing.T) {
|
||||
}
|
||||
allSecretIDs := buildObjectIDs(allSecrets)
|
||||
|
||||
allConfigs := []string{
|
||||
objectName("foo", "config1"),
|
||||
objectName("foo", "config2"),
|
||||
objectName("bar", "config1"),
|
||||
}
|
||||
allConfigIDs := buildObjectIDs(allConfigs)
|
||||
|
||||
cli := &fakeClient{
|
||||
services: allServices,
|
||||
networks: allNetworks,
|
||||
secrets: allSecrets,
|
||||
configs: allConfigs,
|
||||
}
|
||||
cmd := newRemoveCommand(test.NewFakeCli(cli, &bytes.Buffer{}))
|
||||
cmd.SetArgs([]string{"foo", "bar"})
|
||||
@ -44,6 +52,7 @@ func TestRemoveStack(t *testing.T) {
|
||||
assert.Equal(t, allServiceIDs, cli.removedServices)
|
||||
assert.Equal(t, allNetworkIDs, cli.removedNetworks)
|
||||
assert.Equal(t, allSecretIDs, cli.removedSecrets)
|
||||
assert.Equal(t, allConfigIDs, cli.removedConfigs)
|
||||
}
|
||||
|
||||
func TestSkipEmptyStack(t *testing.T) {
|
||||
@ -57,10 +66,14 @@ func TestSkipEmptyStack(t *testing.T) {
|
||||
allSecrets := []string{objectName("bar", "secret1")}
|
||||
allSecretIDs := buildObjectIDs(allSecrets)
|
||||
|
||||
allConfigs := []string{objectName("bar", "config1")}
|
||||
allConfigIDs := buildObjectIDs(allConfigs)
|
||||
|
||||
cli := &fakeClient{
|
||||
services: allServices,
|
||||
networks: allNetworks,
|
||||
secrets: allSecrets,
|
||||
configs: allConfigs,
|
||||
}
|
||||
cmd := newRemoveCommand(test.NewFakeCli(cli, buf))
|
||||
cmd.SetArgs([]string{"foo", "bar"})
|
||||
@ -70,6 +83,7 @@ func TestSkipEmptyStack(t *testing.T) {
|
||||
assert.Equal(t, allServiceIDs, cli.removedServices)
|
||||
assert.Equal(t, allNetworkIDs, cli.removedNetworks)
|
||||
assert.Equal(t, allSecretIDs, cli.removedSecrets)
|
||||
assert.Equal(t, allConfigIDs, cli.removedConfigs)
|
||||
}
|
||||
|
||||
func TestContinueAfterError(t *testing.T) {
|
||||
@ -82,11 +96,15 @@ func TestContinueAfterError(t *testing.T) {
|
||||
allSecrets := []string{objectName("foo", "secret1"), objectName("bar", "secret1")}
|
||||
allSecretIDs := buildObjectIDs(allSecrets)
|
||||
|
||||
allConfigs := []string{objectName("foo", "config1"), objectName("bar", "config1")}
|
||||
allConfigIDs := buildObjectIDs(allConfigs)
|
||||
|
||||
removedServices := []string{}
|
||||
cli := &fakeClient{
|
||||
services: allServices,
|
||||
networks: allNetworks,
|
||||
secrets: allSecrets,
|
||||
configs: allConfigs,
|
||||
|
||||
serviceRemoveFunc: func(serviceID string) error {
|
||||
removedServices = append(removedServices, serviceID)
|
||||
@ -104,4 +122,5 @@ func TestContinueAfterError(t *testing.T) {
|
||||
assert.Equal(t, allServiceIDs, removedServices)
|
||||
assert.Equal(t, allNetworkIDs, cli.removedNetworks)
|
||||
assert.Equal(t, allSecretIDs, cli.removedSecrets)
|
||||
assert.Equal(t, allConfigIDs, cli.removedConfigs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user