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

Use a random port for the test etcd server #15586

Closed
wants to merge 6 commits into from

Conversation

ixdy
Copy link
Member

@ixdy ixdy commented Oct 14, 2015

This allows us to run multiple instances of the verification checks, the integration test, etc. simultaneously on a single host (e.g. the PR Jenkins).

ref #14781

@kubernetes/goog-testing

@k8s-bot
Copy link

k8s-bot commented Oct 14, 2015

GCE e2e test build/test passed for commit d9838d7f93978dd428625ed8c383354eb800a601.

@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 14, 2015
@@ -955,6 +959,7 @@ type testFunc func(*client.Client)
func addFlags(fs *pflag.FlagSet) {
fs.IntVar(
&maxConcurrency, "max-concurrency", -1, "Maximum number of tests to be run simultaneously. Unlimited if set to negative.")
fs.StringVar(&etcdServer, "etcd-server", "", "etcd server URL.")
Copy link
Member

Choose a reason for hiding this comment

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

this also needs port, right? (maybe ... URL in http://host:port format)?

Also, how about being consistent with other places and use "etcd-servers" instead to handle multiple etcd servers too:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-apiserver/app/server.go#L214

Copy link
Member

Choose a reason for hiding this comment

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

Or make it consistent with the other integration tests... weird to use a flag in one place and env vars in the other.

@wojtek-t
Copy link
Member

Just one minor comment - other than that LGTM.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 14, 2015
kube::log::info "etcd -data-dir ${ETCD_DIR} --bind-addr ${host}:${port} >/dev/null 2>/dev/null"
etcd -data-dir ${ETCD_DIR} --bind-addr ${host}:${port} >/dev/null 2>/dev/null &
kube::log::info "Starting etcd with data-dir ${ETCD_DIR} and bind-addr ${ETCD_HOST}:${ETCD_PORT}"
etcd -data-dir ${ETCD_DIR} --bind-addr ${ETCD_HOST}:${ETCD_PORT} >/dev/null 2>/dev/null &
Copy link
Member

Choose a reason for hiding this comment

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

If it fails, retry with different port?

Copy link
Member

Choose a reason for hiding this comment

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

I think you need to change the negotiation port, too? (the 7001 port)

@lavalamp
Copy link
Member

cc @timothysc

@timothysc
Copy link
Member

@ixdy this affects the integration tests but do we run the UTs concurrently at all?

I'm currently working on a PR which will standup and teardown etcd on a well known port for the UTs. If they are run concurrently upstream then that could be an issue.

@lavalamp
Copy link
Member

Yes, we run unit tests concurrently (but before the integration tests).

The tests in test/integration are also possibly run concurrently with each
other?

On Wed, Oct 14, 2015 at 9:53 AM, Timothy St. Clair <notifications@github.com

wrote:

@ixdy https://github.com/ixdy this affects the integration tests but do
we run the UTs concurrently at all?


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

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 15, 2015
@k8s-bot
Copy link

k8s-bot commented Oct 15, 2015

GCE e2e test build/test passed for commit 190e89b1601bf0173ee129caabe6f8539e56fea8.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2015
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2015
@k8s-bot
Copy link

k8s-bot commented Oct 16, 2015

GCE e2e test build/test passed for commit d80665e9f3ca939ca964271f4813f754f81b02e0.

@timothysc
Copy link
Member

@lavalamp, my mods are available and starts up an etcd on a random port. imho we could probably leverage in the integration tests as well...

#15392

@ixdy
Copy link
Member Author

ixdy commented Oct 19, 2015

The local etcd is started in a number of tests:

hack/local-up-cluster.sh:    kube::etcd::start
hack/test-update-storage-objects.sh:kube::etcd::start
hack/after-build/update-swagger-spec.sh:kube::etcd::start
hack/test-cmd.sh:kube::etcd::start
hack/test-integration.sh:  kube::etcd::start
hack/benchmark-integration.sh:  kube::etcd::start

My main focus here was on update-swagger-spec.sh (used in the verification scripts), test-cmd.sh, and test-integration.sh, since we'd like to start running all of those in the PR Jenkins instance, which runs several builds in parallel.

While the etcd stuff seems to work now in parallel, I've noticed that the integration test (in particular cmd/integration) still uses static ports, so the integration test is still not parallel-invocation-safe.

@k8s-bot
Copy link

k8s-bot commented Oct 20, 2015

GCE e2e build/test failed for commit 785c0cd.

@timothysc
Copy link
Member

imho #15392 should solve this issue, and randomizes the port properly to the clients to run in parallel.

The issue will be updating the integration tests to leverage.

@ixdy
Copy link
Member Author

ixdy commented Oct 20, 2015

@timothysc will that also work for hack/after-build/update-swagger-spec.sh, which starts an apiserver and thus needs etcd?

@ixdy
Copy link
Member Author

ixdy commented Oct 29, 2015

Closing since #16287 makes this unnecessary.

@ixdy ixdy closed this Oct 29, 2015
@ixdy ixdy deleted the etcd-in-tests branch December 1, 2015 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test-infra size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants