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

Prevent e2e-tests from running on non-local clusters #3829

Merged
merged 1 commit into from
Mar 2, 2019

Conversation

alexkursell
Copy link
Contributor

Right now, if you run make e2e-test with your kubectl context set to some other cluster, it will dump a bunch of stuff into it. With this PR make e2e-test will only run if the context is a local one (currently just checking if it's one of minikube, kind, and docker-for-desktop).

Just putting up PR now to see how CI reacts.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 27, 2019
@alexkursell
Copy link
Contributor Author

I'm wondering whether or not there is a better way to do this. Just checking the context name against a few common strings seems hacky, and annoying if someone is using something different as they would have to edit the Makefile. Maybe the right thing to do would be to explicitly require a CONTEXT environment variable to run make e2e-test, so that you would have to type CONTEXT=minikube make e2e-test to run it. I'd be interested to hear suggestions.

Makefile Outdated
--serviceaccount=default:ingress-nginx-e2e || true

kubectl run --rm -i --tty \
--attach \
--restart=Never \
--generator=run-pod/v1 \
--context $(KUBE_CONTEXT) \
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 this will not age well - we can easily forget to add --context later when we decide to create anothe resource.

@ElvinEfendi
Copy link
Member

@alexkursell wile hacky I liked your previous approach better. If we see it creates an extra friction for developers then maybe we can introduce an env variable like SKIP_CONTEXT_CHECK to skip that check but for now let's just whitelist those three contexts.

@alexkursell
Copy link
Contributor Author

@ElvinEfendi fair enough. I've rolled back to that commit.

@alexkursell alexkursell changed the title [wip] Prevent e2e-tests from running on non-local clusters Prevent e2e-tests from running on non-local clusters Feb 28, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 28, 2019
@ElvinEfendi
Copy link
Member

@alexkursell squash the commits, looking good to me.

@aledbf
Copy link
Member

aledbf commented Mar 2, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 2, 2019
@aledbf
Copy link
Member

aledbf commented Mar 2, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, alexkursell

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 79c52cf into kubernetes:master Mar 2, 2019
@alexkursell alexkursell deleted the protect-e2e-test branch March 4, 2019 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants