Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testutil: make testing packages public #39829

Merged
merged 1 commit into from
Sep 11, 2019
Merged

testutil: make testing packages public #39829

merged 1 commit into from
Sep 11, 2019

Conversation

SamWhited
Copy link
Member

- What I did

Moved /internal/test and /internal/testutil into /testutil so that it can be used from within buildkit.

- How I did it

Moved it and sed-ed all of the import paths and package names.

- How to verify it

Hopefully CI should pass and git should show that most files are just moved and not modified heavily.

- Description for the changelog

The testutil package is now public and can be used to spawn docker daemons for testing.

- A picture of a cute animal (not mandatory but encouraged)

Gopher

@tiborvass
Copy link
Contributor

Thanks @SamWhited! For posterity I like to put in the commit message at least, the exact sed command used.

@SamWhited
Copy link
Member Author

Sure. It was something along the lines of:

mv internal/test testutil                                                                                                                                                                               
pushd testutil/; grep -IRl "package test" | xargs -I '{}' sed -i -e 's|package test|package testutil|g' {}; popd                                                                                        
mv internal/testutil/*.go testutil/ && rm -rf internal/                                                                                                                                                 
grep -IRl "github.com\/docker\/docker\/internal\/test" | xargs -I '{}' sed -i -e 's|github.com/docker/docker/internal/test|github.com/docker/docker/test|g' {}                                          

That may not be exact, I copied a few lines out of my bash history. I'll throw this in the commit message after CI finishes (I don't want to interrupt it)

testutil/stringutils.go Show resolved Hide resolved
testutil/stringutils_test.go Show resolved Hide resolved
testutil/environment/clean.go Outdated Show resolved Hide resolved
testutil/daemon/daemon_unix.go Show resolved Hide resolved
testutil/daemon/daemon.go Show resolved Hide resolved
testutil/helpers.go Show resolved Hide resolved
@SamWhited
Copy link
Member Author

Two things still failing in CI, one appears to be the Windows issue that I believe is being worked on in another PR, the other doesn't appear to be related but I'm not sure why it's failing now. Will dig in as soon as I'm done with some of the buildkit changes.

@SamWhited
Copy link
Member Author

SamWhited commented Sep 3, 2019

Looks like running goimports makes a lot of changes (including breaking ones because it gets confused by module version suffixes), fixing only the ones that were the result of the package rename to try and make things work for now.

@SamWhited
Copy link
Member Author

Remaining test failures are the windows failures which I think are failing in general right now and aren't related. PTAL. Thanks!

@SamWhited
Copy link
Member Author

SamWhited commented Sep 4, 2019

Running tests on Windows appears to be failing for different reasons now, looking into it to see if it's my fault or not. They do appear to be failing (sometimes?) on master too, so maybe it's just flaky. If anyone is familiar with windows tests and what the state of testing on master is right now your input would be appreciated. Thanks! /cc @tiborvass, @thaJeztah

EDIT: Ran it again and it's not a timeout anymore, it's EC2 failing so I'm going to go out on a limb and say this is just flaky right now.

@SamWhited
Copy link
Member Author

Rebased on top of Tibor's testing change. Waiting on CI to see if I missed anything or broken an import.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@SamWhited
Copy link
Member Author

Pushed a change to add import lines back as requested by @thaJeztah; PTAL, thanks!

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

let's create a tracking issue to validate that each package has a (correct) import comment

@SamWhited
Copy link
Member Author

@thaJeztah done, see #39898

@thaJeztah
Copy link
Member

Oh, sorry; this needs a rebase now; I see #39886 was merged, which caused a conflict

@thaJeztah
Copy link
Member

Only failure was on Windows RS1, and a known flaky test (on slow platforms?) #38521;

     --- FAIL: Test/DockerSuite/TestStartReturnCorrectExitCode (7.62s)
         docker_cli_start_test.go:198: assertion failed: 125 (exitCode int) != 12 (int): out: time="2019-09-11T00:09:35Z" level=error msg="error waiting for container: EOF" 

@SamWhited
Copy link
Member Author

@thaJeztah rebased

This was done with something along the lines of:

```
mv internal/test testutil
pushd testutil/; grep -IRl "package test" | xargs -I '{}' sed -i -e 's|package test|package testutil|g' {}; popd
mv internal/testutil/*.go testutil/ && rm -rf internal/
grep -IRl "github.com\/docker\/docker\/internal\/test" | xargs -I '{}' sed -i -e 's|github.com/docker/docker/internal/test|github.com/docker/docker/test|g' {}
goimports .
```

I also modified the basic plugin path in testutil/fixtures/plugin.

Signed-off-by: Sam Whited <sam@samwhited.com>
@thaJeztah
Copy link
Member

Windows RS1 failure is a Jenkins issue; https://ci.docker.com/public/job/moby/job/PR-39829/17/execution/node/72/log/

 azwin-2-102ef0 was marked offline: Connection was broken: java.util.concurrent.TimeoutException: Ping started at 1568206049555 hasn't completed by 1568206289556
 	at hudson.remoting.PingThread.ping(PingThread.java:134)
 	at hudson.remoting.PingThread.run(PingThread.java:90)

Gonna ignore that one

@thaJeztah thaJeztah merged commit 09226c4 into moby:master Sep 11, 2019
@SamWhited SamWhited deleted the testutil branch September 11, 2019 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Improving CI
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants