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

Initial adoption of Ginkgo in Kubernetes e2e tests #3855

Merged
merged 4 commits into from
Jan 29, 2015
Merged

Initial adoption of Ginkgo in Kubernetes e2e tests #3855

merged 4 commits into from
Jan 29, 2015

Conversation

filbranden
Copy link
Contributor

These commits are a first step in migrating e2e tests to Ginkgo and implementing #3837.

The last commit also starts generating JUnit XML output for the tests which should allow for cleaner better integration of the e2e tests with Jenkins.

My proposal is:

  1. We start using Ginkgo but do not touch the test code (this PR)
  2. We start converting the individual e2e tests to Ginkgo (follow up PRs)
  3. We continue converting bash tests to Go+Ginkgo
  4. We start using JUnit XML output in Jenkins test, we improve it to include more metadata of the tests execution, more logs, etc.
  5. We get rid of the shell script tests in hack/e2e-suite/ and of hack/e2e.go, having a single standalone cmd/e2e that can be used to run all or a subset of the end-to-end tests on an existing test cluster.

@satnam6502 @rrati @timothysc @roberthbailey @zmerlynn

@rrati
Copy link

rrati commented Jan 28, 2015

@filbranden this looks to be a reasonable proposal. Is there is time frame for the complete conversion? We don't want to add to the conversion work by continuing either bash scripts or test conversions to go w/o ginkgo/gomega if that is the intended end goal, so I'd suggest adding to the proposal that all future e2e work be in ginkgo/gomega while porting of old tests is done to ginkgo/gomega.

@zmerlynn
Copy link
Member

Can you add a parameter for the report file rather than just hardcoding it as junit.xml in the current directory? (Which is what it seems to be doing.) That option should probably dictate whether it happens or not, too.

I haven't really reviewed yet, either, just giving this a once over for what I'd want out of it.

@filbranden
Copy link
Contributor Author

@zmerlynn Ok I'll include a --reports_dir or similar flag and only enable the JUnit custom reporter if that path is set.

I'm leaning towards doing a flag with a directory name instead of a file name since when we run parallel tests one XML is generated per worker:

http://onsi.github.io/ginkgo/#generating-junit-xml-output

I think specifying a directory should be enough control for us, I don't see a reason why we would need the files to be called something other than junit*.xml

@filbranden
Copy link
Contributor Author

@satnam6502 can you please take a look at the code in particular driver.go? I want to try to get this one finished today but for every small change it takes quite a bit of time to get it tested, so I'd like to make sure we agree on the approach and on the code before getting a new version published...

@zmerlynn
Copy link
Member

Generating a directory is fine, Jenkins can slurp entire wildcards.

@zmerlynn
Copy link
Member

The godeps stuff is voodoo to me. The rest LGTM, modulo the --reports_dir. You still owe me an --except in hack/e2e.go :)

@satnam6502
Copy link
Contributor

I've looked at driver.go and as far as I can tell (which might not be very far) I think it is fine.

@zmerlynn zmerlynn self-assigned this Jan 28, 2015
@satnam6502
Copy link
Contributor

One thing I can't tell from this is whether we continue to create a fresh client for each test. Is that still the case?

@filbranden
Copy link
Contributor Author

@satnam6502 Yes still the case, each test gets loadClientOrDie() as its argument, so each uses its own client.

See this one here for example:
https://github.com/filbranden/kubernetes/blob/ginkgo1/test/e2e/basic.go#L200

@satnam6502
Copy link
Contributor

That's fine. I was wrong about the rate limit being applied to each client connection. I think the rate limit applies to each instance of the apiserver. So having separate clients is not buying us anything here. So it is fine I think to switch back to using a shared client for all the tests -- if that makes things easier or run faster.

This commit uses `godep` to vendor these libraries into our project.

They are not yet in use but we plan to use them in `test/e2e` in a follow up commit.
In order to adopt ginkgo incrementally, let's start by replacing
test/e2e/driver.go with a call to ginkgo runner and convert each of the
other tests to a small Decscribe() snippet that simply calls the legacy
TestXYZ function.

From this basis we can take further incremental steps by converting
individual tests to native ginkgo format, using Fail() for all failure
cases, using By() for logs, enabling JUnit reports, etc.

Tested:
- cmd/e2e builds and `make check` passes.
- Running _output/bin/.../e2e on an alive cluster works.
- Running the full hack/e2e-test.sh works as expected.
Use ginkgo's native support for JUnit in order to generate the XML file.

This is a first step in better integration of our e2e tests with
Jenkins. In order to improve the logged information, we will probably
need to have more native ginkgo tests but this step allows us to see
what Jenkins can already do with this information and what we need to
tweak to improve it.

Tested by running the full e2e tests and inspecting the contents of
junit.xml on the top of the tree.

Textual output is still generated on the console to keep the current
goe2e.sh logs available until the full conversion of our Jenkins
instance to use the JUnit XML is completed.
@filbranden
Copy link
Contributor Author

OK I added --report_dir and modified the Jenkins setup to save the junit.xml file on top of the Jenkins tree.

PTAL, I'd like to get this one merged today so that we can start making progress on converting the Go tests to native Ginkgo.

Tested by running the full hack/e2e-test.sh and had all goe2e.sh tests succeed (only update.sh failed in that particular run.)

@zmerlynn
Copy link
Member

LGTM except for minor nit on last commit.

Use the E2E_REPORT_DIR global environment variable to define the
location where the JUnit XML reports should be saved.

Modify the Jenkins e2e.sh script to export that variable pointing to the
top of the Jenkins build tree.

Tested by running `E2E_REPORT_DIR=${PWD}/.. hack/e2e-test.sh` and
confirmed ../junit.xml was generated and looked good.
@zmerlynn
Copy link
Member

LGTM. Travis isn't going to say anything about hack/jenkins, so I'm merging this so we can see if we broke anything quickly.

zmerlynn added a commit that referenced this pull request Jan 29, 2015
Initial adoption of Ginkgo in Kubernetes e2e tests
@zmerlynn zmerlynn merged commit 668d853 into kubernetes:master Jan 29, 2015
@filbranden
Copy link
Contributor Author

Awesome thanks!

@rrati I think this means you can send us a PR to bring e.g. https://github.com/rrati/kubernetes/blob/ginkgo/test/ginkgo/pods_test.go into our tree.

(I wouldn't do network_test.go just now because that test has been flaky for a while... I think the others are better candidates.)

@filbranden filbranden deleted the ginkgo1 branch January 29, 2015 00:44
@zmerlynn
Copy link
Member

I believe I've also modified the Jenkins config to slurp junit*.xml (which
will also work for us for future parallel stuff), but it'll be another hour
or so before we can see if that worked.

On Wed Jan 28 2015 at 4:35:07 PM Filipe Brandenburger <
notifications@github.com> wrote:

Awesome thanks!

@rrati https://github.com/rrati I think this means you can send us a PR
to bring e.g.
https://github.com/rrati/kubernetes/blob/ginkgo/test/ginkgo/pods_test.go
into our tree.

(I wouldn't do network_test.go just now because that test has been flaky
for a while... I think the others are better candidates.)


Reply to this email directly or view it on GitHub
#3855 (comment)
.

@filbranden
Copy link
Contributor Author

@zmerlynn I'm really looking forward to seeing this! Will be very helpful and at least solve one of our current P0's which is the visibility of what inside goe2e.sh went bonkers when it fails... :-)

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.

4 participants