Commit Graph
45 Commits
Author SHA1 Message Date
Guillaume Lours 8bd79da4bc e2e: fix test resource isolation and make standalone parallelism configurable
Several e2e tests used fixed host ports (8070, 8080, 8090, etc.), global
buildx builders registered with --use, and a hardcoded IPC container name.
Under parallel execution these shared daemon-level resources caused port
conflicts, buildkitd container-name collisions, and intermittent failures.
Separately, the standalone make target hardcoded -parallel=1, forcing the
entire standalone suite to run serially even though the same tests run in
parallel in plugin mode.

Changes:
- Convert fixed host ports in four fixtures (network-test, sentences,
  build-test, volume-test) to ephemeral bindings; add ServicePublishedPort
  helper to framework.go to resolve the actual mapped port at runtime.
- Give each buildx-builder test a unique daemon-scoped name via BuilderName
  helper, preventing container-name collisions between parallel goroutines.
  Applies to TestBuildPlatformsWithCorrectBuildxConfig, TestBuildPrivileged,
  TestBuildBuilder, TestBuildEntitlements, TestBuildTLS.
- Rename the fixed ipc_mode_container to a project-scoped name
  (ipc_e2e-src) and update the ipc-test fixture accordingly.
- Replace the hardcoded -parallel=1 in make e2e-compose-standalone with
  E2E_PARALLEL_PLUGIN?=4 and E2E_STANDALONE_PARALLEL?=4, aligning both
  modes with the effective GOMAXPROCS on 4-core GitHub Actions runners.
  Both variables are overridable (E2E_STANDALONE_PARALLEL=1 restores
  serial local debugging).
- Raise the poll delay in watch_test.go long-running polls (90s/120s
  timeout) from the default 100ms to 1s; bump cascade_test.go and
  publish_test.go from 100ms to 500ms. Reduces CPU pressure without
  affecting effective test duration.

The logging-driver fixture retains its fixed port 24224: the Docker fluentd
log driver encodes fluentd-address at service-start time, making ephemeral
resolution non-trivial. TestLoggingDriver is serial so there is no
collision risk in practice.

Signed-off-by: Guillaume Lours <[email protected]>
2026-08-19 17:41:02 +02:00
Nicolas De Loof d38fa3431a test(e2e): cp, environment and config scenarios
- cp: the twelve copy directions become one scenario; Dir() joins the
  Scenario API for actions that exchange files with the host, and
  FileContains observes what landed there. The files copied in and out
  live in the txtar archive instead of writing into the fixture tree.
- environment: TestEnvPriority splits into three scenarios, one per
  compose model (environment section, bare, env_file section), each
  declaring its .env variants inline; StdoutContains joins the
  vocabulary so container output cannot collide with progress noise
  (the unused framework predicate of the same name is removed). The
  fixed 'env-compose-priority' image name becomes project-scoped.
- config: rendering assertions move to scenario steps; the config
  output is the observable here by definition.
  TestConfigHashMatchesContainerLabel stays legacy: it cross-references
  hashes captured at runtime, which checks cannot hold.
- Fixtures cp-test/, environment/ and config/ are removed.

Signed-off-by: Nicolas De Loof <[email protected]>
2026-08-18 16:49:56 +02:00
Sebastiaan van Stijn 92a7ac1fa2 fix mixed assertion libraries in tests
Before this, assertion libraries were mixed, sometimes
even in the same file.

    git grep -l '"gotest.tools/v3/' | wc -l
    75
    git grep -l '"github.com/stretchr/testify' | wc -l
    24

Signed-off-by: Sebastiaan van Stijn <[email protected]>
2026-03-31 17:32:51 +02:00
Nicolas De Loof 2b4543935c next release will be major version v5.x
Signed-off-by: Nicolas De Loof <[email protected]>
2025-11-13 09:32:43 +01:00
Nicolas De Loof 26e46d7cc8 e2e tests in CI
Signed-off-by: Nicolas De Loof <[email protected]>
2025-06-30 19:22:35 +02:00
Nicolas De Loof a9e76943f6 introduce support for models
Signed-off-by: Nicolas De Loof <[email protected]>
2025-06-30 19:22:35 +02:00
Sebastiaan van Stijn 446e00520c format code with gofumpt
Format the code  with gofumpt to prevent my IDE from reformatting
every time I open a file. gofumpt provides a superset of gofmt,
so should not impact users that are not using gofumpt.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
2024-12-17 16:50:14 +01:00
Guillaume Lours cbff0e5559 be sure everything has been cleanup at the end of each tests
Signed-off-by: Guillaume Lours <[email protected]>
2024-12-04 15:28:16 +01:00
Guillaume Lours e4222bff53 add local config.json to test configuration dir if exists
Signed-off-by: Guillaume Lours <[email protected]>
2024-12-04 15:28:16 +01:00
Ulysses Souza 8ea7c9e0d2 Make it context aware and add test skipping options
Signed-off-by: Ulysses Souza <[email protected]>
2023-11-15 21:09:50 +01:00
Matthieu MOREL 4f694919ff deps: remove deprecated github.com/pkg/errors
Signed-off-by: Matthieu MOREL <[email protected]>
2023-09-29 06:28:58 +02:00
Nicolas De Loof 1054792b47 align docker compose ps with docker CLI to support --format
Signed-off-by: Nicolas De Loof <[email protected]>
2023-08-25 16:36:45 +02:00
Milas Bowman e63ab14b1e ci: merge Go coverage reports before upload (#10666)
Attempting to fix the state of codecov action checks right now,
which are behaving very erratically.

Using the new functionality in Go 1.20 to merge multiple reports,
so now the unit & E2E coverage data reports are stored as artifacts
and then downloaded, merged, and finally uploaded to codecov as a
new job.

Additionally, add a `codecov.yml` config and try to turn down the
aggressiveness of it for CI checks.

Signed-off-by: Milas Bowman <[email protected]>
2023-06-08 14:58:21 -04:00
Nicolas De Loof 85ddfde5d6 use go 1.20 -cover support
Signed-off-by: Nicolas De Loof <[email protected]>
2023-03-10 16:54:39 +00:00
Milas Bowman e31b95c16d test: tweak pause test to try and prevent failures in Windows CI
This test keeps failing with a timeout in Windows. I don't actually
think it should take that long to bring up an nginx container, so
I'm guessing that there's something else going on that's causing
trouble.

Increase the verbosity when running Compose commands: I think this
will generally make E2E test failures easier to diagnose by always
logging the full command that's going to be run and also capturing
stdout.

Add a health check and use `--wait` when launching the fixture for
the pause test. Combined with the verbosity increase, this should
make it easier to understand what's going on here.

Signed-off-by: Milas Bowman <[email protected]>
2023-02-27 14:20:20 -05:00
Guillaume Lours adf8e75317 cleanup framework.go from uncessary debug logs
Signed-off-by: Guillaume Lours <[email protected]>
2022-12-21 21:28:06 +01:00
Guillaume Lours 5dcadc05d9 debut output for CI
Signed-off-by: Guillaume Lours <[email protected]>
2022-12-21 21:09:49 +01:00
Guillaume Lours c72f161afb change the way finding the just built compose binary
Signed-off-by: Guillaume Lours <[email protected]>
2022-12-21 19:47:39 +01:00
Guillaume Lours 86a648bd51 e2e tests display Compose version used to run the test
currently the version displayed is the one installed and not the one use for the tests

Signed-off-by: Guillaume Lours <[email protected]>
2022-12-21 18:38:24 +01:00
Guillaume Lours 935968fe2c add buildx plugin to e2e configuration directory
Signed-off-by: Guillaume Lours <[email protected]>
2022-12-21 15:27:34 +01:00
Nicolas De Loof 8c39b5b7fd align --format flag and UX with docker cli
Signed-off-by: Nicolas De Loof <[email protected]>
2022-12-14 22:53:43 +01:00
Milas Bowman 113fb6732d schema: add support for tmpfs.mode in mount definition (#10031)
See compose-spec/compose-go#325 for the acutal spec change. This
propagates it to the Engine API object and adds an E2E test via
Cucumber 🥒

Fixes #9873.

Signed-off-by: Milas Bowman <[email protected]>
2022-12-02 11:21:53 -05:00
CrazyMax 5ec20296e4 Better sandboxed workflow and enhanced cross compilation
Signed-off-by: CrazyMax <[email protected]>
2022-08-12 15:05:58 +02:00
Milas Bowman 27227a8824 lint: add nolintlint and clean up nolint directives (#9738)
Signed-off-by: Milas Bowman <[email protected]>
2022-08-09 16:43:58 -04:00
Ulysses Souza fc723acb3b Fix nolint issues
Reference -> https://golangci-lint.run/usage/false-positives/#nolint-directive

Signed-off-by: Ulysses Souza <[email protected]>
2022-07-13 19:33:06 +02:00
Ulysses Souza d42adf6efb Add "opinionated" tag to gocritic
Signed-off-by: Ulysses Souza <[email protected]>
2022-07-13 19:33:06 +02:00
Ulysses Souza a81f23a199 Add "diagnostic" tag to gocritic
Signed-off-by: Ulysses Souza <[email protected]>
2022-07-13 19:33:06 +02:00
Ulysses Souza 2e96829607 Add gocritic to linters
Signed-off-by: Ulysses Souza <[email protected]>
2022-07-13 19:33:03 +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 <[email protected]>
2022-06-25 14:06:10 +08: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 <[email protected]>
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 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 <[email protected]>
2022-06-16 15:51:54 -04:00
Milas Bowman ccd87311e8 e2e: always set HOME + USER for cmd env
Signed-off-by: Milas Bowman <[email protected]>
2022-06-16 09:44:40 -04:00
Milas Bowman 1c41df8f56 e2e: robustness changes for ddev test
The most important change here is to ensure that the correct Compose
standalone binary is used by `ddev`. Since it invokes Compose itself,
we need to ensure that `PATH` is set appropriately such that it finds
the binary we want to test rather than something from the system.

As part of this, the rest of the environment has been isolated, which
should make the test more reliable, and avoids polluting `~/.ddev`
with test artifacts by using a tmpdir as `HOME` for the test instead
of the user's real home folder.

Signed-off-by: Milas Bowman <[email protected]>
2022-06-16 08:59:02 -04:00
Milas Bowman ea8341865d e2e: isolate test command env from system env
When running Docker / Compose commands, do NOT inherit the system
environment to ensure that the tests are reproducible regardless
of host settings.

Additionally, per-command environment overrides are provided to
the command instead of using `os.SetEnv`, as this is not safe when
running tests in parallel (`testing.T::SetEnv` will actually error
if used in this way!)

Signed-off-by: Milas Bowman <[email protected]>
2022-06-16 08:30:57 -04:00
Milas Bowman d9065050fd e2e: fix subtests and block parallel unsafe tests
The big mechanical change here is to NOT store `t` as a field on
the `CLI` object (which has been renamed as well to fix the odd
capitalization). The way the tests are structured meant that the
"subtests" were using the _parent_ `*testing.T` instance, which
causes various oddities including confusing messages on failure
about a child test causing a panic in the parent.

Additionally, a few tests have been blocked from running in
parallel because they are sharing `compose.yaml` fixtures and
can fail as a result (e.g. due to a port conflict on the host).
I'll fix these in follow-up PRs but want to focus on correctness
for the tests before optimizing them.

Signed-off-by: Milas Bowman <[email protected]>
2022-06-15 16:27:30 -04:00
Bastian Venthur 8a5d555de7 fixed some spelling mistakes
that's all :)

Signed-off-by: Bastian Venthur <[email protected]>
2022-06-14 21:33:36 +02:00
Ulysses Souza 919f351b4b Fix bind mounts when in project volumes definition
Signed-off-by: Ulysses Souza <[email protected]>
2022-06-02 16:37:24 +02:00
Ulysses Souza a5a1c5f2f1 Add ddev's e2e test
Signed-off-by: Ulysses Souza <[email protected]>
2022-05-19 14:14:03 +02:00
Guillaume Lours ff73827a6f Add support of ssh authentications defined in compose file or via cli flags
Signed-off-by: Guillaume Lours <[email protected]>
2022-03-31 12:47:15 +02:00
Ulysses Souza 8ae8d99528 Use build tags for selecting e2e test mode
Signed-off-by: Ulysses Souza <[email protected]>
2021-12-09 10:52:18 +01:00
Ulysses Souza a97a73600e Add 2 modes test mechanism
This should test on plugin and standalone mode

Signed-off-by: Ulysses Souza <[email protected]>
2021-12-07 10:25:50 +01:00
Mathieu Champlon cffdb69c5e Fix test config dir content
Signed-off-by: Mathieu Champlon <[email protected]>
2021-11-25 21:22:30 +01:00
Nicolas De Loof fb73dd58d9 Move compose e2e tests into pkg
Signed-off-by: Nicolas De Loof <[email protected]>
2021-06-28 08:47:58 +02:00