Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Move compose e2e tests into pkg
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Jun 26, 2021
1 parent 0e67d3a commit c5c9c56
Show file tree
Hide file tree
Showing 54 changed files with 414 additions and 330 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ jobs:
run: make -f builder.Makefile cli compose-plugin

- name: E2E Test
run: make e2e-local
run: make e2e-compose
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ compose-plugin: ## Compile the compose cli-plugin
--build-arg GIT_TAG=$(GIT_TAG) \
--output ./bin

e2e-compose: ## Run End to end local tests. Set E2E_TEST=TestName to run a single test
gotestsum $(TEST_FLAGS) ./pkg/e2e -- -count=1

e2e-local: ## Run End to end local tests. Set E2E_TEST=TestName to run a single test
gotestsum $(TEST_FLAGS) ./local/e2e/compose ./local/e2e/container ./local/e2e/cli-only -- -count=1
gotestsum $(TEST_FLAGS) ./local/e2e/container ./local/e2e/cli-only -- -count=1

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
go test -count=1 -v $(TEST_FLAGS) ./local/e2e/cli-only
Expand Down
91 changes: 0 additions & 91 deletions local/e2e/compose/metrics_test.go

This file was deleted.

147 changes: 0 additions & 147 deletions local/e2e/compose/scan_message_test.go

This file was deleted.

28 changes: 1 addition & 27 deletions local/e2e/compose/cancel_test.go → pkg/e2e/cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,14 @@ import (

"gotest.tools/v3/assert"
"gotest.tools/v3/icmd"

. "github.com/docker/compose-cli/utils/e2e"
)

func TestComposeCancel(t *testing.T) {
c := NewParallelE2eCLI(t, binDir)
s := NewMetricsServer(c.MetricsSocket())
s.Start()
defer s.Stop()

started := false

for i := 0; i < 30; i++ {
c.RunDockerCmd("help", "ps")
if len(s.GetUsage()) > 0 {
started = true
fmt.Printf(" [%s] Server up in %d ms\n", t.Name(), i*100)
break
}
time.Sleep(100 * time.Millisecond)
}
assert.Assert(t, started, "Metrics mock server not available after 3 secs")

t.Run("metrics on cancel Compose build", func(t *testing.T) {
s.ResetUsage()

c.RunDockerCmd("compose", "ls")
buildProjectPath := "../compose/fixtures/build-infinite/compose.yaml"
buildProjectPath := "fixtures/build-infinite/compose.yaml"

// require a separate groupID from the process running tests, in order to simulate ctrl+C from a terminal.
// sending kill signal
Expand All @@ -77,12 +57,6 @@ func TestComposeCancel(t *testing.T) {
errors := stderr.String()
return strings.Contains(out, "CANCELED"), fmt.Sprintf("'CANCELED' not found in : \n%s\nStderr: \n%s\n", out, errors)
}, 10*time.Second, 1*time.Second)

usage := s.GetUsage()
assert.DeepEqual(t, []string{
`{"command":"compose ls","context":"moby","source":"cli","status":"success"}`,
`{"command":"compose build","context":"moby","source":"cli","status":"canceled"}`,
}, usage)
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"testing"

"gotest.tools/v3/icmd"

. "github.com/docker/compose-cli/utils/e2e"
)

func TestCascadeStop(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (

"gotest.tools/v3/assert"
"gotest.tools/v3/icmd"

. "github.com/docker/compose-cli/utils/e2e"
)

func TestLocalComposeBuild(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (

"gotest.tools/v3/assert"
"gotest.tools/v3/icmd"

. "github.com/docker/compose-cli/utils/e2e"
)

func TestLocalComposeExec(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (

"gotest.tools/v3/assert"
"gotest.tools/v3/icmd"

. "github.com/docker/compose-cli/utils/e2e"
)

func TestLocalComposeRun(t *testing.T) {
Expand Down
Loading

0 comments on commit c5c9c56

Please sign in to comment.