Commit Graph

3375 Commits

Author SHA1 Message Date
Guillaume Lours 83744f7e99
Merge pull request #9619 from Jeldo/Fix-syntax-error-on-golangci-run-configuration
Fix golangci syntax error in run configuration
2022-07-04 14:40:11 +02:00
Guillaume Lours 5a1fea8272
Merge pull request #9507 from TheodosiouTh/tc/simplify-flag-conversion
TC: Use switch case to simplify flag conversion and avoid multiple if statements
2022-07-04 09:19:21 +02:00
TaeyoungKwak 94f50b520c Fix golangci syntax error in run configuration
Signed-off-by: TaeyoungKwak <astrokwak@gmail.com>
2022-07-03 01:45:52 +09:00
ThedosiouTh 115ac6d529 Use switch/case instead of static map for simplicity
Signed-off-by: ThedosiouTh <thanosthd@gmail.com>
2022-06-30 18:50:24 +03:00
ThedosiouTh 8648f30351 TC: Add missing tests for argumetns
Signed-off-by: ThedosiouTh <thanosthd@gmail.com>
2022-06-30 18:50:24 +03:00
ThedosiouTh 9542bdf445 TC: fix naming
Signed-off-by: ThedosiouTh <thanosthd@gmail.com>
2022-06-30 18:50:24 +03:00
ThedosiouTh 40f0dbd971 TC: Use map to simplify flag conversion and avoid multilple if statements
Signed-off-by: ThedosiouTh <thanosthd@gmail.com>
2022-06-30 18:50:24 +03:00
Guillaume Lours ff2bf78570
Merge pull request #9612 from milas/e2e-start-stop
e2e: add more start/stop test cases
2022-06-30 17:31:09 +02:00
Milas Bowman 4aa8c4a1e5 e2e: add more start/stop test cases
* Starting a service that's already running
* Stopping a service that's already stopped
* Starting/stopping multiple services (by name) at once

Also renamed a test that was about `up` behavior but was
misleadingly labeled start/stop.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-30 09:52:14 -04:00
Milas Bowman 06649442eb
Merge pull request #9609 from milas/e2e-pause
e2e: split out `pause` tests and add more cases
2022-06-30 08:42:59 -04:00
Guillaume Lours 19f316eec3
Merge pull request #9611 from docker/dependabot/go_modules/github.com/stretchr/testify-1.8.0
build(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0
2022-06-30 11:38:58 +02:00
dependabot[bot] 1074074df2
build(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.5 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.5...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-30 09:31:44 +00:00
Guillaume Lours cd940693aa
Merge pull request #9049 from ndeloof/9044
(re)start should not impact one-off containers
2022-06-29 10:43:10 +02:00
Laura Brehm 96b152f705 Update logic to keep `compose stop` and `restart` from affecting one-offs
Also add e2e tests.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-06-29 00:58:02 +02:00
Milas Bowman 8e7b6582d4
Merge pull request #9595 from abhinavnair/replace-ioutil
Replace deprecated ioutil pkg with os & io
2022-06-28 15:08:57 -04:00
Nick Sieger 391d2e02ff
Merge pull request #9592 from nicksieger/fix-panic-empty-string-arg
fix: panic caused by empty string argument
2022-06-28 14:07:04 -05:00
Milas Bowman 26014d49a5 e2e: split out `pause` tests and add more cases
Pause/unpause was being partially tested under the start/stop test.
This removes it from that test and adds dedicated pause + unpause
tests.

Note that the tests assert on current behavior, though it's been
noted where that is undesirable due to divergence from the Docker
CLI. Will change the behavior + update tests in a subsequent PR.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-28 15:06:17 -04:00
Nick Sieger fd5e8b8c28
fix: panic caused by empty string argument
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-06-28 10:18:38 -05:00
Guillaume Lours cc2dc868c2
Merge pull request #9583 from crazy-max/docs-workflow
ci: release workflow to open a PR on docs repo with latest changes
2022-06-28 14:26:21 +02:00
Guillaume Lours 908a59af4c
Merge pull request #9607 from docker/dependabot/go_modules/github.com/hashicorp/go-version-1.6.0
build(deps): bump github.com/hashicorp/go-version from 1.5.0 to 1.6.0
2022-06-28 11:35:38 +02:00
dependabot[bot] 7e6daa8d01
build(deps): bump github.com/hashicorp/go-version from 1.5.0 to 1.6.0
Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/hashicorp/go-version/releases)
- [Changelog](https://github.com/hashicorp/go-version/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-version/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-version
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 09:28:44 +00:00
Abhinav Nair a783cc4574
Blacklist ioutil pkg in golangci-lint
This is to prevent anyone from accidentally importing the pkg

Signed-off-by: Abhinav Nair <11939846+abhinavnair@users.noreply.github.com>
2022-06-28 09:20:29 +08:00
Laura Brehm 3ccf4349e7
Merge pull request #9572 from laurazard/dont-wait-for-oneshots
Use appropriate dependency condition for one-shot containers when running `compose up --wait`
2022-06-26 14:48:49 +02:00
Laura Brehm 74fd14ec65 Use alpine instead of ubuntu for E2E compose file, no need to include version
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-06-26 14:41:23 +02:00
Abhinav Nair 11f2f2dbc4
Replace deprecated ioutil pkg with os & io
As of Go 1.16, the same functionality is now provided by package io or
package os, and those implementations should be preferred in new code.

So replacing all usage of ioutil pkg with io & os.

Signed-off-by: Abhinav Nair <11939846+abhinavnair@users.noreply.github.com>
2022-06-25 14:06:10 +08:00
Guillaume Lours 2cd9c0df5a
Merge pull request #9587 from milas/build-order-classic
build: respect dependency order for classic builder
2022-06-24 22:24:22 +02:00
Milas Bowman ec0efec839 test: add copyright notice
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-24 16:16:53 -04:00
CrazyMax 0a53d93338
ci: release workflow to open a PR on docs repo with latest changes
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-06-24 18:40:08 +02:00
Guillaume Lours dbf52d3f45
Merge pull request #9590 from docker/dependabot/go_modules/github.com/stretchr/testify-1.7.5
build(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5
2022-06-24 11:36:32 +02:00
dependabot[bot] f972803104
build(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.4 to 1.7.5.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.4...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-24 09:28:09 +00:00
Guillaume Lours 4aa3e246b7
Merge pull request #9585 from milas/net-ambiguity
networks: prevent issues due to duplicate names
2022-06-24 11:08:52 +02:00
Guillaume Lours a8a52f297a
Merge pull request #9582 from docker/dependabot/go_modules/github.com/cnabio/cnab-to-oci-0.3.4
build(deps): bump github.com/cnabio/cnab-to-oci from 0.3.3 to 0.3.4
2022-06-23 18:02:16 +02:00
Guillaume Lours ee8fed8abf
Merge pull request #9581 from docker/dependabot/go_modules/github.com/spf13/cobra-1.5.0
build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
2022-06-23 17:54:40 +02:00
Guillaume Lours 4331b1ded1
Merge pull request #9580 from docker/dependabot/go_modules/github.com/stretchr/testify-1.7.4
build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.4
2022-06-23 17:53:52 +02:00
dependabot[bot] 41dcb43dee
build(deps): bump github.com/cnabio/cnab-to-oci from 0.3.3 to 0.3.4
Bumps [github.com/cnabio/cnab-to-oci](https://github.com/cnabio/cnab-to-oci) from 0.3.3 to 0.3.4.
- [Release notes](https://github.com/cnabio/cnab-to-oci/releases)
- [Commits](https://github.com/cnabio/cnab-to-oci/compare/v0.3.3...v0.3.4)

---
updated-dependencies:
- dependency-name: github.com/cnabio/cnab-to-oci
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-23 14:54:35 +00:00
Milas Bowman 68cf8d5ca0
Merge pull request #9588 from milas/compose-go-v1.2.8
deps: upgrade to compose-go v1.2.8
2022-06-23 10:53:26 -04:00
Milas Bowman 94d6dff89d deps: upgrade to compose-go v1.2.8
https://github.com/compose-spec/compose-go/releases/tag/v1.2.8

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-23 10:45:45 -04:00
Milas Bowman 5f89365c8f network: make test mock consistent throughout
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-22 16:34:59 -04:00
Milas Bowman b2cd089bae build: respect dependency order for classic builder
When using the "classic" (non-BuildKit) builder, ensure that
services are iterated in dependency order for a build so that
it's possible to guarantee the presence of a base image that's
been added as a dependency with `depends_on`. This is a very
common pattern when using base images with Compose.

A fix for BuildKit is blocked currently until we can rely on a
newer version of the engine (see docker/compose#9324)[^1].

[^1]: https://github.com/docker/compose/issues/9232#issuecomment-1060389808

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-22 16:24:30 -04:00
Milas Bowman 0f747419b6 networks: prevent issues due to duplicate names
Within the Docker API/engine, networks have unique IDs, and the
name is a friendly label/alias, which notably does NOT have any
guarantees around uniqueness (see moby/moby#18864 [^1]).

During day-to-day interactive/CLI Compose usage, this is rarely
an issue, as Compose itself isn't creating networks concurrently
across goroutines. However, if multiple Compose instances are
executed simultaneously (e.g. as part of a test suite that runs
in parallel), this can easily occur.

When it does happen, it's very confusing for users and resolving
it via the `docker` CLI is not straightforward either [^2].

There's two primary changes here:
 * Pass `CheckDuplicates: true` to the Docker API when creating
   networks to reduce the likelihood of Compose creating duplicates
   in the first place
 * On `down`, list networks using a name filter and then remove
   them all by ID, as the Docker API will return an error if the
   name alias is used and maps to more than one network

Hopefully, this provides a better UX, since the issue should be
less likely to occur, and if it does, it can now be resolved via
standard Compose workflow commands.

[^1]: https://github.com/moby/moby/issues/18864
[^2]: https://stackoverflow.com/questions/63776518/error-2-matches-found-based-on-name-network-nameofservice-default-is-ambiguo

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-22 12:27:30 -04:00
dependabot[bot] 6df222f37d
build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 09:26:36 +00:00
dependabot[bot] aa851b0e27
build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.4
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.2 to 1.7.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.2...v1.7.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 09:26:26 +00:00
Guillaume Lours e5dcb8a8f8
Merge pull request #9568 from milas/e2e-init-output
e2e: improve test output on failures
2022-06-18 20:59:56 +02:00
Laura Brehm fd8538f780 Use appropriate dependency condition for one-shot containers when running `compose up --wait`
Also add e2e tests to ensure `compose up --wait` does not get stuck forever waiting for one-shot containers

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-06-18 01:20:40 +02:00
Milas Bowman ab25aabfb9
Merge pull request #9311 from quite/no-ansi-be-kind
Don't use ansi even when deprecated option is requested
2022-06-16 17:15:19 -04:00
Milas Bowman 7f441eb013 e2e: improve test output on failures
This is mostly marking a bunch of the run methods as helpers so
that the internal assertions they do will show the line number of
the calling test instead.

There's also some small tweaks around the plugin initialization to
help with the output in the event that it fails to make it easier
to debug what went wrong.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 17:05:43 -04:00
Guillaume Lours 4270987d7c
Merge pull request #9567 from milas/e2e-cmd
e2e: ensure all Compose cmds standalone compatible
2022-06-16 23:02:14 +02:00
Milas Bowman 3248b7b335 e2e: use Compose for exec test
This was using `docker exec` on Compose containers instead of
`docker compose exec` (and `docker-compose exec` for standalone).

Thanks to @glours for catching!

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 16:44:21 -04:00
Milas Bowman 4ea3ba77b2
Merge pull request #9559 from venthur/fix_spell
fixed some spelling mistakes
2022-06-16 15:56:44 -04:00
Milas Bowman 9622395c8a e2e: ensure all Compose cmds standalone compatible
The E2E tests can be run in plugin (`docker compose`) or standalone
(`docker-compose`) mode. Existing logic was in place to ensure that
the helper method is always used, which will invoke the right one
based on how tests are being executed.

However, this logic was too easy to (unintentionally) bypass given
the myriad of ways that commands can be run. The check has been
made stricter and pushed to a lower-level to more aggressively
catch instances.

As a result, a bunch of calls to `RunDockerCmd` are now updated
to be `RunDockerComposeCmd`, which will ensure that the invocation
is correct based on test mode.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 15:51:54 -04:00