Skip to content

Add ddev's e2e test#9033

Merged
ulyssessouza merged 2 commits into
docker:v2from
ulyssessouza:add-e2e-ddev
May 20, 2022
Merged

Add ddev's e2e test#9033
ulyssessouza merged 2 commits into
docker:v2from
ulyssessouza:add-e2e-ddev

Conversation

@ulyssessouza
Copy link
Copy Markdown
Contributor

What I did
Add ddev's e2e test

@ulyssessouza ulyssessouza force-pushed the add-e2e-ddev branch 8 times, most recently from 9ebf3ac to ecb55a8 Compare December 14, 2021 11:51
@ulyssessouza ulyssessouza marked this pull request as ready for review December 14, 2021 12:40
Comment thread pkg/e2e/ddev_test.go Outdated
Comment thread pkg/e2e/ddev_test.go Outdated
Comment thread pkg/e2e/ddev_test.go
Comment thread pkg/e2e/ddev_test.go Outdated
@ulyssessouza ulyssessouza force-pushed the add-e2e-ddev branch 2 times, most recently from 2522a5d to ed86cfa Compare December 15, 2021 10:14
@ulyssessouza ulyssessouza requested a review from mat007 December 15, 2021 10:41
Copy link
Copy Markdown
Member

@mat007 mat007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
@rfay what do you think?

Copy link
Copy Markdown
Contributor

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

As is, this won't use your docker-compose I don't think. In ddev v1.18.2, ddev downloads a private docker-compose. So you'll either need to use ddev config global --required-docker-compose-version=<currrent> or ddev config global --use-docker-compose-from-path (those can also just be set in ~/.ddev/global_config.yaml).

An actual end-to-end test will at least curl from an index.php. You could just make an index.php with

<?php
echo "hi there";

and then curl http://<project>.ddev.php and verify that you get that (and a 200 of course)

It looks like all this does is run a ddev start, which isn't "end to end".

I recommend at least having a project with an index.php that has

Comment thread pkg/e2e/ddev_test.go

compressedFilename := fmt.Sprintf("ddev_%s-%s.%s.tar.gz", osName, runtime.GOARCH, ddevVersion)

c.RunCmdInDir(dir, "curl", "-LO",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be easier to use install_ddev.sh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't use that because it tries to install that in /usr/local/bin and root is needed for that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, yeah and ddev can be anywhere in the path. Any way you want to download "latest" is fine of course.

Comment thread pkg/e2e/ddev_test.go Outdated

c.RunDockerCmd("pull", tagged("drud/ddev-router"))
c.RunDockerCmd("pull", tagged("drud/ddev-dbserver-mariadb-10.3"))
c.RunDockerCmd("pull", tagged("drud/ddev-webserver"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these pulls happen on ddev start, and you can't pull without a tag. ddev start will pull with the correct tag. There is no latest tag on any of them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tagged function will append that to the image name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to share the time of the call between this other pull calls and know which part is doing some job at the time.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK then, doesn't do any harm.

@rfay
Copy link
Copy Markdown
Contributor

rfay commented Dec 15, 2021

I'll try running this in a bit and propose some code.

@rfay
Copy link
Copy Markdown
Contributor

rfay commented Dec 15, 2021

Added a PR to your PR in ulyssessouza#23 that makes the test a little stronger, tests to see if it's actually working. cleans up project after it's done, etc.

This assumes that the docker-compose under test is the one that will be found in the $PATH.

@ulyssessouza ulyssessouza force-pushed the add-e2e-ddev branch 2 times, most recently from 0f11093 to 2c3f7fd Compare December 15, 2021 17:32
Copy link
Copy Markdown
Contributor

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is good for me as long as the docker-compose under test first in the $PATH - please just confirm that. If it's not, then this isn't relevant yet.

@rfay
Copy link
Copy Markdown
Contributor

rfay commented Dec 15, 2021

I see GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/docker/compose/v2/internal.Version=" -tags e2e -o bin/docker-compose ./cmd so it puts it into the ./bin directory from the build. Maybe just adding a build stanza in the .github workflow doing a docker-compose --version would help the confidence level here.

@ulyssessouza ulyssessouza force-pushed the add-e2e-ddev branch 6 times, most recently from aa832ae to 62aa00f Compare January 4, 2022 15:56
@ulyssessouza ulyssessouza force-pushed the add-e2e-ddev branch 13 times, most recently from 8b7aa4d to 4e66ad3 Compare January 7, 2022 15:01
@rfay
Copy link
Copy Markdown
Contributor

rfay commented Jan 16, 2022

It looks to me like all the tests running in parallel fight over each other's containers or networks. I'll do a PR to this PR that adds -parallel=1 to the e2e-standalone test. It will also make the output a pile easier to read when something fails.

make e2e-compose-standalone TEST_FLAGS="-run='^TestCompose.*Ddev' " certainly works fine for me every time.

@rfay
Copy link
Copy Markdown
Contributor

rfay commented Jan 17, 2022

Copy link
Copy Markdown
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to run the e2e test locally, @ulyssessouza can move the copy of the binary to the CI script please?

Otherwise I didn't succeed to run the test on my Mac M1, I got the following issue

 Network ddev-testcomposerunddev-2047219997_default  Created
        Error response from daemon: create .: volume name is too short, names should be at least two alphanumeric characters
        
        Stderr:   ssh-agent container is running: If you want to add authentication to the ssh-agent container, run 'ddev auth ssh' to enable your keys.
        mkcert may not be properly installed, we suggest installing it for trusted https support, `brew install mkcert nss`, `choco install -y mkcert`, etc. and then `mkcert -install`
        IsInternetActive DEBUG: err=<nil> ctx.Err()=<nil> addrs=[127.0.0.1] IsInternetactive==true, randomURL=yhygkjiacf.ddev.site internet_detection_timeout_ms=750ms
        
        Failed to start TestComposeRunDdev-2047219997: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-TestComposeRunDdev-2047219997 docker-compose -f /private/var/folders/rl/282crpp149x6xf_400p17fj40000gn/T/TestComposeRunDdev-2047219997/.ddev/.ddev-docker-compose-full.yaml up --build -d', action='[up --build -d]', err='exit status 1', stdout='#1 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built internal] load build definition from Dockerfile
        #1 transferring dockerfile: 580B done
        #1 DONE 0.0s
        
        #2 [drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built internal] load build definition from Dockerfile
        #2 transferring dockerfile: 408B done
        #2 DONE 0.0s
        
        #3 [drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built internal] load .dockerignore
        #3 transferring context: 2B done
        #3 DONE 0.0s
        
        #4 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built internal] load .dockerignore
        #4 transferring context: 2B done
        #4 DONE 0.0s
        
        #5 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built internal] load metadata for docker.io/drud/ddev-webserver:v1.19.0-1
        #5 DONE 0.0s
        
        #6 [drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built internal] load metadata for docker.io/drud/ddev-dbserver-mariadb-10.3:v1.19.0
        #6 DONE 0.0s
        
        #7 [drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built 1/2] FROM docker.io/drud/ddev-dbserver-mariadb-10.3:v1.19.0
        #7 DONE 0.0s
        
        #8 [drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built 2/2] RUN (groupadd --gid 20 "glours" || groupadd "glours" || true) && (useradd  -l -m -s "/bin/bash" --gid "glours" --comment '' --uid 501 "glours" || useradd  -l -m -s "/bin/bash" --gid "glours" --comment '' "glours" || useradd  -l -m -s "/bin/bash" --gid "20" --comment '' "glours")
        #8 CACHED
        
        #9 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built 1/4] FROM docker.io/drud/ddev-webserver:v1.19.0-1
        #9 DONE 0.0s
        
        #10 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built 2/4] RUN (groupadd --gid 20 "glours" || groupadd "glours" || true) && (useradd  -l -m -s "/bin/bash" --gid "glours" --comment '' --uid 501 "glours" || useradd  -l -m -s "/bin/bash" --gid "glours" --comment '' "glours" || useradd  -l -m -s "/bin/bash" --gid "20" --comment '' "glours")
        #10 CACHED
        
        #11 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built 3/4] RUN export XDEBUG_MODE=off && ( composer self-update --2 || composer self-update --2 || true )
        #11 CACHED
        
        #12 [drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built 4/4] RUN chmod 600 ~glours/.pgpass ~glours/.my.cnf
        #12 CACHED
        
        #13 [drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built] exporting to image
        #13 exporting layers done
        #13 writing image sha256:8479fcda75dc943532607f8255a0dae40982625130b2762a02eb285838d55959 done
        #13 naming to docker.io/drud/ddev-webserver:v1.19.0-1-TestComposeRunDdev-2047219997-built done
        #13 writing image sha256:72e0459aecebee2d72392a30f55003b65582d7e8381d25cf8365683db6594e96 done
        #13 naming to docker.io/drud/ddev-dbserver-mariadb-10.3:v1.19.0-TestComposeRunDdev-2047219997-built done
        #13 DONE 0.0s
        ', stderr='Network ddev-testcomposerunddev-2047219997_default  Creating
        Network ddev-testcomposerunddev-2047219997_default  Created
        Container ddev-TestComposeRunDdev-2047219997-db  Creating
        Container ddev-TestComposeRunDdev-2047219997-dba  Creating
        Container ddev-TestComposeRunDdev-2047219997-web  Creating
        Container ddev-TestComposeRunDdev-2047219997-dba  Created
        Error response from daemon: create .: volume name is too short, names should be at least two alphanumeric characters'
        
        
        Failures:
        ExitCode was 1 expected 0

Comment thread Makefile
Comment on lines +51 to +52
rm -f /usr/local/bin/docker-compose
cp bin/docker-compose /usr/local/bin
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 2 command make standalone e2e tests not runnable on a local machine, this should be part of the ci.yml steps

$ make e2e-compose-standalone
rm -f /usr/local/bin/docker-compose
rm: /usr/local/bin/docker-compose: Permission denied
make: *** [e2e-compose-standalone] Error 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulyssessouza you didn't move the copy of the compose binary to the CI workflow

@rfay
Copy link
Copy Markdown
Contributor

rfay commented May 3, 2022

It looks to me like the failure you're seeing here is #9428 - DDEV hasn't been able to run against any version of compose since 2.3.3 due to a cascade of regressions.

ulyssessouza and others added 2 commits May 19, 2022 14:14
Signed-off-by: Ulysses Souza <[email protected]>
* Add tmate for debugging
* Use -parallel=1 for standaone tests

Signed-off-by: Randy Fay <[email protected]>
@ulyssessouza ulyssessouza merged commit b961d49 into docker:v2 May 20, 2022
@milas milas mentioned this pull request Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants