Skip to content

Commit 97d46a1

Browse files
rfayulyssessouza
authored andcommitted
Fix problems with ddev e2e test and minor cleanup, add tmate (docker#27)
* Add tmate for debugging * Use -parallel=1 for standaone tests Signed-off-by: Randy Fay <[email protected]>
1 parent a5a1c5f commit 97d46a1

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches:
66
- v2
77
pull_request:
8+
workflow_dispatch:
9+
inputs:
10+
debug_enabled:
11+
description: 'To run with tmate enter "debug_enabled"'
12+
required: false
13+
default: "false"
814

915
jobs:
1016
lint:
@@ -125,5 +131,12 @@ jobs:
125131
BUILD_TAGS: e2e
126132
run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
127133

134+
- name: Setup tmate session
135+
uses: mxschmitt/action-tmate@v3
136+
with:
137+
limit-access-to-actor: true
138+
github-token: ${{ secrets.GITHUB_TOKEN }}
139+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
140+
128141
- name: E2E Test in standalone mode
129142
run: make e2e-compose-standalone

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ e2e-compose-standalone: ## Run End to end local tests in standalone mode. Set E2
5151
rm -f /usr/local/bin/docker-compose
5252
cp bin/docker-compose /usr/local/bin
5353
docker-compose version
54-
go test $(TEST_FLAGS) -count=1 --tags=standalone ./pkg/e2e
54+
go test $(TEST_FLAGS) -v -count=1 -parallel=1 --tags=standalone ./pkg/e2e
5555

5656
.PHONY: mocks
5757
mocks:

pkg/e2e/ddev_test.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"gotest.tools/v3/assert"
2828
)
2929

30-
const ddevVersion = "v1.18.2"
30+
const ddevVersion = "v1.19.1"
3131

3232
func TestComposeRunDdev(t *testing.T) {
3333
if !composeStandaloneMode {
@@ -36,10 +36,15 @@ func TestComposeRunDdev(t *testing.T) {
3636
if runtime.GOOS == "windows" {
3737
t.Skip("Running on Windows. Skipping...")
3838
}
39+
_ = os.Setenv("DDEV_DEBUG", "true")
40+
3941
c := NewParallelE2eCLI(t, binDir)
4042
dir, err := os.MkdirTemp("", t.Name()+"-")
4143
assert.NilError(t, err)
4244

45+
// ddev needs to be able to find mkcert to figure out where certs are.
46+
_ = os.Setenv("PATH", fmt.Sprintf("%s:%s", os.Getenv("PATH"), dir))
47+
4348
siteName := filepath.Base(dir)
4449

4550
t.Cleanup(func() {
@@ -60,31 +65,22 @@ func TestComposeRunDdev(t *testing.T) {
6065
compressedFilename))
6166

6267
c.RunCmdInDir(dir, "tar", "-xzf", compressedFilename)
63-
c.RunDockerCmd("pull", "drud/ddev-ssh-agent:v1.18.0")
64-
c.RunDockerCmd("pull", "busybox:stable")
65-
c.RunDockerCmd("pull", "phpmyadmin:5")
66-
67-
c.RunDockerCmd("pull", tagged("drud/ddev-router"))
68-
c.RunDockerCmd("pull", tagged("drud/ddev-dbserver-mariadb-10.3"))
69-
c.RunDockerCmd("pull", tagged("drud/ddev-webserver"))
7068

7169
// Create a simple index.php we can test against.
7270
c.RunCmdInDir(dir, "sh", "-c", "echo '<?php\nprint \"ddev is working\";' >index.php")
7371

7472
c.RunCmdInDir(dir, "./ddev", "config", "--auto")
7573
c.RunCmdInDir(dir, "./ddev", "config", "global", "--use-docker-compose-from-path")
74+
vRes := c.RunCmdInDir(dir, "./ddev", "version")
75+
out := vRes.Stdout()
76+
fmt.Printf("ddev version: %s\n", out)
7677

7778
c.RunCmdInDir(dir, "./ddev", "poweroff")
7879

79-
startRes := c.RunCmdInDir(dir, "./ddev", "start", "-y")
80-
assert.Equal(c.test, startRes.ExitCode, 0, "Could not start project")
80+
c.RunCmdInDir(dir, "./ddev", "start", "-y")
8181

8282
curlRes := c.RunCmdInDir(dir, "curl", "-sSL", fmt.Sprintf("http://%s.ddev.site", siteName))
83-
out := curlRes.Stdout()
83+
out = curlRes.Stdout()
8484
fmt.Println(out)
8585
assert.Assert(c.test, strings.Contains(out, "ddev is working"), "Could not start project")
8686
}
87-
88-
func tagged(img string) string {
89-
return fmt.Sprintf("%s:%s", img, ddevVersion)
90-
}

0 commit comments

Comments
 (0)