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

Run integration tests on circleci #372

Merged
merged 1 commit into from
Dec 15, 2016

Conversation

rodrigosaito
Copy link
Contributor

This PR is to address the following issue: #328

This is still working in progress, I'd be happy to finish this if it's looking good.

There are some workarounds to fix the GOPATH in circle.yml, it might not be necessary on the original repo.

@@ -1,4 +1,4 @@
// +build integration
// +build integration-ignore
Copy link
Member

Choose a reason for hiding this comment

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

What does this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just ignoring those tests for now, will remove that once everything is done.

pre:
- sudo pip install docker-compose
- docker-compose -f docker-compose-integration.yml up -d --force-recreate
- mkdir -p ${HOME}/.go_workspace/src/github.com/go-kit/ && ln -sf ${HOME}/kit ${HOME}/.go_workspace/src/github.com/go-kit/
Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's probably not with go-kit/kit repo, but it's needed with mine. something related to internal packages.

- docker-compose -f docker-compose-integration.yml up -d --force-recreate
- mkdir -p ${HOME}/.go_workspace/src/github.com/go-kit/ && ln -sf ${HOME}/kit ${HOME}/.go_workspace/src/github.com/go-kit/
override:
- cd ${HOME}/.go_workspace/src/github.com/go-kit/kit && go get -t -d -v ./...
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be sufficient to go get -d -t -v ./... without the cd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, probably with go-kit/kit repo, not with my fork.

before sending the final PR I will remove all this workaround that I need to run builds on circle from my fork.

@peterbourgon
Copy link
Member

Ping? :)

@rodrigosaito
Copy link
Contributor Author

@peterbourgon sorry about the delay.

so should I keep going with this one?

@peterbourgon
Copy link
Member

peterbourgon commented Oct 19, 2016

No worries at all! Yes, please, if you can; otherwise I can take it over at some point. Thanks for the contribution :)

@rodrigosaito
Copy link
Contributor Author

Yes, I can and will be happy to help. Will try to finish this by the weekend.

@peterbourgon
Copy link
Member

Friendly ping :) Any update here?

@rodrigosaito
Copy link
Contributor Author

I am being busy lately, will try to find some time to work on this in the next few days.

@rodrigosaito rodrigosaito force-pushed the integration_tests branch 3 times, most recently from 1a92b06 to 306c92e Compare November 18, 2016 02:17
@rodrigosaito rodrigosaito changed the title [WIP] Run integration tests on circleci Run integration tests on circleci Nov 18, 2016
@rodrigosaito
Copy link
Contributor Author

@peterbourgon done!

the tests are failing now, probably because circleci is configured to use the old image (12.04) instead of the new one (14.04). If you change that, then the build should pass. Another solution is to stop zookeeper on circle.yml, I can do that if you prefer this solution.

@peterbourgon
Copy link
Member

peterbourgon commented Nov 19, 2016

Well, the error is pretty explicit; the docker-compose up fails with

ERROR: for zk  Cannot start service zk: failed to create endpoint kit_zk_1 on 
network kit_default: Error starting userland proxy: listen tcp 0.0.0.0:2181: 
bind: address already in use

When I try to do the same thing locally, I get a similar error:

ERROR: for etcd  Cannot start service etcd: driver failed programming 
external connectivity on endpoint kit_etcd_1 (0577dd6...): Error starting 
userland proxy: listen tcp 0.0.0.0:2379: bind: address already in use

I think there must be some error in the way you've got the docker-compose file orchestrating things. Does this work for you locally?

@rodrigosaito
Copy link
Contributor Author

The error happens on circle ci, probably because it's running on 12.04 image which has the zookeeper up and running(https://circleci.com/docs/build-image-precise/#databases), conflicting the ports as the docker-compose is using default ports for every key store (consul, etcd and zk). I tested on circle ci using 14.04 (https://circleci.com/docs/build-image-trusty/#databases) which doesn't have a zookeeper running.

On your machine you might have a etcd running which will also conflict the ports.

Yes it works locally for me and when I run on circle ci from my repo.

I can change to use random ports if you prefer.

@peterbourgon
Copy link
Member

Ah, OK! Thanks for the more lengthy explanation. You're probably right; I was running that in a minikube (Kubernetes) VM which probably has etcd listening on the default port. I'll poke around a bit more.

@rodrigosaito
Copy link
Contributor Author

hey @peterbourgon any update on this? do you need some help?

@peterbourgon
Copy link
Member

Thanks for the poke :) I got it working locally. A few changes I'd like to see to the PR itself incoming...

environment:
ETCD_ADDR: http://localhost:2379
CONSUL_ADDR: localhost:8500
ZK_ADDR: localhost:2181
Copy link
Member

Choose a reason for hiding this comment

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

Can you make whatever changes are necessary to get this working on Circle in the file, or do I need to change something in the repo settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say that it's better if you go to Circle repo settings and change the box image option from ubuntu 12.04 to 14.04.

Copy link
Member

Choose a reason for hiding this comment

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

Done. Takes a fresh commit to test; we'll do it on master! ;)

if err != nil {
fmt.Printf("ZooKeeper server error: %v\n", err)
os.Exit(1)
func init() {
Copy link
Member

Choose a reason for hiding this comment

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

Why was this moved out of TestMain and into init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the code that was starting zookeeper (this previously needed the zk jar file somewhere). Not really sure the difference of init and TestMain. Would you prefer to have this code on TestMain instead?

Copy link
Member

Choose a reason for hiding this comment

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

init is executed when the package is imported; TestMain is executed when the test driver starts. I like to avoid init whenever possible, so yes, please :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, got it. Will do that later today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@peterbourgon
Copy link
Member

Brilliant! Works locally and I'm happy with the delta. Thanks very much for the contribution! 👍

@peterbourgon peterbourgon merged commit c3ae78b into go-kit:master Dec 15, 2016
@rodrigosaito rodrigosaito deleted the integration_tests branch December 15, 2016 23:01
jamesgist pushed a commit to jamesgist/kit that referenced this pull request Nov 1, 2024
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.

2 participants