-
Notifications
You must be signed in to change notification settings - Fork 453
Improve running end-to-end tests locally #972
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
base: master
Are you sure you want to change the base?
Conversation
* Allow users to run end-to-end tests with a fully-qualified and/or private alpine image * Allow users to run end-to-end tests behind a proxy * Sort .gitgnore for convenience for future diffs * Add .idea/ to .gitignore
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: NBardelot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Allow the user running end-to-end tests to override the repository's URL in order to use a mirror if need be.
Introduces a new LIST_OF_E2E_TESTS option in order to select end-to-end tests that will be executed when calling `make test`. It uses the tests script's arguments parsing that already exists.
This reverts commit 560274698e3b42eaad01648a1afa81bc8e91ea0a.
Introduces a new LIST_OF_E2E_TESTS option in order to select end-to-end tests that will be executed when calling `make test`. It uses the tests script's arguments parsing that already exists.
thockin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the PR, but I don't think we want this. The argument to test_e2e.sh is a pattern, not just a list, and besides that, you can just run the script. It's easier than passing a named argument to make.
Cf. my comment in the Running a subset of tests directly from By the way, you might already know of |
|
Somehow I only saw part of this PR when I looked at it before. I learned of bats well after I did all the work, so didn't bother to convert it. |
| fi | ||
|
|
||
| # Build it | ||
| # NOTE: If you want to run the end-to-end tests locally and you need specific Makefile arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not pass the important args?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance I was surpised that the script was running its prerequisites by calling the Makefile. And I ended up calling the given goals ahead of time myself, and finding it simpler. The alternative would be to map 1..1 every Makefile arg as an env variable in the script, which is possible but not very practical.
| /bin/sh -c " \ | ||
| ./build/test.sh ./... \ | ||
| " | ||
| @if [ -n "$(HTTP_PROXY)" ]; then \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this do anything? Each of these blocks runs in its own shell, so export has no meaning:
thockin@thockin-glaptop4:/tmp/m$ cat Makefile
foo:
@export FOO=bar
@echo $$FOO
bar:
@export FOO=bar; \
echo $$FOO
thockin@thockin-glaptop4:/tmp/m$ make foo
thockin@thockin-glaptop4:/tmp/m$ make bar
bar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. Let me add a commit to fix this.
I think someone who uses a proxy will have all three variables already configured in a dotenv file or profile, expecting the NO_PROXY standard variable to be passed alongside the two others. It looks strange when this one is not. So the goal here was to be consistent (and not having to debug why something will be routed through the proxy when the user's config contains an exclusion, for example: the private/local images registries, or the github project's local mirror).
test_e2e.sh
Outdated
| GIT_SYNC \ | ||
| --one-time \ | ||
| --repo="https://github.com/kubernetes/git-sync" \ | ||
| --repo="${GIT_SYNC_REPOSITORY_URL:-https://github.com/kubernetes/git-sync}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I get something like:
local default_repo="https://github.com/kubernetes/git-sync"
local repo="${REMOTE_TEST_REPO_URL:-$default_repo}"
Makefile
Outdated
| # Allow alpine to be pulled from a private registry when building the end-to-end tests images | ||
| ALPINE_REGISTRY_PREFIX ?= | ||
|
|
||
| # By default all end-to-end tests are executed, but this allows for a manual selection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarify that the values here are regexes against the testcase names
| export NO_PROXY="$(NO_PROXY)"; \ | ||
| fi | ||
| VERBOSE=1 ./test_e2e.sh | ||
| VERBOSE=1 ./test_e2e.sh $(LIST_OF_E2E_TESTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does make pass "" here if the list is empty? I think not, but I am not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without quotes no argument is passed.
Example:
printargs.sh
#!/bin/bash
for a in "$@"; do
echo "Arg: >$a<"
done> ./printargs.sh foo $not_declared bar $not_declared
Arg: >foo<
Arg: >bar<vs.
> ./printargs.sh foo "$not_declared" bar "$not_declared"
Arg: >foo<
Arg: ><
Arg: >bar<
Arg: ><
alpineimageNO_PROXYparameter in theMakefilethat is propagated alongsideHTTP_PROXYandHTTPS_PROXYLIST_OF_E2E_TESTSparameter in theMakefilethat drives the names of the tests passed to./test_e2e.shto run a selection of tests, running all tests by defaultGIT_SYNC_REPOSITORY_URLin their environment, in order to use a mirror if need be.gitgnorefor convenience for future diffs.idea/to.gitignoreNOTE : I propose this in parallel of the feature request #970 as I had to make some adaptations locally to be able to run the end-to-end tests and I think they could be used by others. It completes the PR #971 that has already been merged.
/kind feature