ACI : allow docker compose down —project-name xxx without requiring the compose file

This commit is contained in:
Guillaume Tardif 2020-07-03 10:24:06 +02:00
parent 6b74716490
commit 76cb73c5c2
2 changed files with 11 additions and 4 deletions

View File

@ -319,9 +319,16 @@ func (cs *aciComposeService) Up(ctx context.Context, opts cli.ProjectOptions) er
} }
func (cs *aciComposeService) Down(ctx context.Context, opts cli.ProjectOptions) error { func (cs *aciComposeService) Down(ctx context.Context, opts cli.ProjectOptions) error {
project, err := cli.ProjectFromOptions(&opts) var project types.Project
if err != nil {
return err if opts.Name != "" {
project = types.Project{Name:opts.Name}
} else {
fullProject, err := cli.ProjectFromOptions(&opts)
if err != nil {
return err
}
project = *fullProject
} }
logrus.Debugf("Down on project with name %q\n", project.Name) logrus.Debugf("Down on project with name %q\n", project.Name)

View File

@ -297,7 +297,7 @@ func (s *E2eACISuite) TestACIBackend() {
}) })
s.T().Run("shutdown compose app", func(t *testing.T) { s.T().Run("shutdown compose app", func(t *testing.T) {
s.NewDockerCommand("compose", "down", "-f", composeFile, "--project-name", "acidemo").ExecOrDie() s.NewDockerCommand("compose", "down", "--project-name", "acidemo").ExecOrDie()
}) })
s.T().Run("switches back to default context", func(t *testing.T) { s.T().Run("switches back to default context", func(t *testing.T) {