Refactor stack command/package

- Handle `bundlefile` directly in the `top-level`
  command. `bundlefile` is still experimental and will be deprecated
  in future version — this should make be easier to remove it.
- Validate the `stack` name in all cases (i.e. whatever the
  orchestrator is used)
- Load the composefile ahead of choosing the orchestrator. This
  removes some slight duplication.
- Makes `RunDeploy` easier to use from outside packages (like
  `docker/app`) with a preloaded configuration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2018-06-26 14:07:26 +02:00
parent 61e53fc88a
commit 0f9d24f78d
21 changed files with 139 additions and 151 deletions

View File

@ -41,6 +41,14 @@ func fakeClientForRemoveStackTest(version string) *fakeClient {
}
}
func TestRemoveWithEmptyName(t *testing.T) {
cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}), &orchestrator)
cmd.SetArgs([]string{"good", "' '", "alsogood"})
cmd.SetOutput(ioutil.Discard)
assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`)
}
func TestRemoveStackVersion124DoesNotRemoveConfigsOrSecrets(t *testing.T) {
client := fakeClientForRemoveStackTest("1.24")
cmd := newRemoveCommand(test.NewFakeCli(client), &orchestrator)