Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 53eca14

Browse files
authored
Merge pull request #1847 from ndeloof/compose_e2e
Move compose e2e tests into pkg
2 parents a756507 + fb73dd5 commit 53eca14

File tree

54 files changed

+410
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+410
-330
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ jobs:
102102
run: make -f builder.Makefile cli compose-plugin
103103

104104
- name: E2E Test
105-
run: make e2e-local
105+
run: make e2e-compose

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ compose-plugin: ## Compile the compose cli-plugin
5151
--build-arg GIT_TAG=$(GIT_TAG) \
5252
--output ./bin
5353

54+
e2e-compose: ## Run End to end local tests. Set E2E_TEST=TestName to run a single test
55+
gotestsum $(TEST_FLAGS) ./pkg/e2e -- -count=1
56+
5457
e2e-local: ## Run End to end local tests. Set E2E_TEST=TestName to run a single test
55-
gotestsum $(TEST_FLAGS) ./local/e2e/compose ./local/e2e/container ./local/e2e/cli-only -- -count=1
58+
gotestsum $(TEST_FLAGS) ./local/e2e/container ./local/e2e/cli-only -- -count=1
5659

5760
e2e-win-ci: ## Run end to end local tests on Windows CI, no Docker for Linux containers available ATM. Set E2E_TEST=TestName to run a single test
5861
go test -count=1 -v $(TEST_FLAGS) ./local/e2e/cli-only

local/e2e/compose/metrics_test.go

Lines changed: 0 additions & 91 deletions
This file was deleted.

local/e2e/compose/scan_message_test.go

Lines changed: 0 additions & 147 deletions
This file was deleted.

local/e2e/compose/cancel_test.go renamed to pkg/e2e/cancel_test.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,14 @@ import (
2929

3030
"gotest.tools/v3/assert"
3131
"gotest.tools/v3/icmd"
32-
33-
. "github.com/docker/compose-cli/utils/e2e"
3432
)
3533

3634
func TestComposeCancel(t *testing.T) {
3735
c := NewParallelE2eCLI(t, binDir)
38-
s := NewMetricsServer(c.MetricsSocket())
39-
s.Start()
40-
defer s.Stop()
41-
42-
started := false
43-
44-
for i := 0; i < 30; i++ {
45-
c.RunDockerCmd("help", "ps")
46-
if len(s.GetUsage()) > 0 {
47-
started = true
48-
fmt.Printf(" [%s] Server up in %d ms\n", t.Name(), i*100)
49-
break
50-
}
51-
time.Sleep(100 * time.Millisecond)
52-
}
53-
assert.Assert(t, started, "Metrics mock server not available after 3 secs")
5436

5537
t.Run("metrics on cancel Compose build", func(t *testing.T) {
56-
s.ResetUsage()
57-
5838
c.RunDockerCmd("compose", "ls")
59-
buildProjectPath := "../compose/fixtures/build-infinite/compose.yaml"
39+
buildProjectPath := "fixtures/build-infinite/compose.yaml"
6040

6141
// require a separate groupID from the process running tests, in order to simulate ctrl+C from a terminal.
6242
// sending kill signal
@@ -77,12 +57,6 @@ func TestComposeCancel(t *testing.T) {
7757
errors := stderr.String()
7858
return strings.Contains(out, "CANCELED"), fmt.Sprintf("'CANCELED' not found in : \n%s\nStderr: \n%s\n", out, errors)
7959
}, 10*time.Second, 1*time.Second)
80-
81-
usage := s.GetUsage()
82-
assert.DeepEqual(t, []string{
83-
`{"command":"compose ls","context":"moby","source":"cli","status":"success"}`,
84-
`{"command":"compose build","context":"moby","source":"cli","status":"canceled"}`,
85-
}, usage)
8660
})
8761
}
8862

local/e2e/compose/cascade_stop_test.go renamed to pkg/e2e/cascade_stop_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import (
2020
"testing"
2121

2222
"gotest.tools/v3/icmd"
23-
24-
. "github.com/docker/compose-cli/utils/e2e"
2523
)
2624

2725
func TestCascadeStop(t *testing.T) {

local/e2e/compose/compose_build_test.go renamed to pkg/e2e/compose_build_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import (
2727

2828
"gotest.tools/v3/assert"
2929
"gotest.tools/v3/icmd"
30-
31-
. "github.com/docker/compose-cli/utils/e2e"
3230
)
3331

3432
func TestLocalComposeBuild(t *testing.T) {

local/e2e/compose/compose_exec_test.go renamed to pkg/e2e/compose_exec_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222

2323
"gotest.tools/v3/assert"
2424
"gotest.tools/v3/icmd"
25-
26-
. "github.com/docker/compose-cli/utils/e2e"
2725
)
2826

2927
func TestLocalComposeExec(t *testing.T) {

local/e2e/compose/compose_run_test.go renamed to pkg/e2e/compose_run_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import (
2323

2424
"gotest.tools/v3/assert"
2525
"gotest.tools/v3/icmd"
26-
27-
. "github.com/docker/compose-cli/utils/e2e"
2826
)
2927

3028
func TestLocalComposeRun(t *testing.T) {

0 commit comments

Comments
 (0)