Skip to content

Conversation

@enj
Copy link
Contributor

@enj enj commented Sep 5, 2017

This change restores the previous behavior of running hack/test-integration.sh <regex>. The timeout flag is no longer passed to the integration test runner. To do so correctly requires using go test -args which would add further complexity to hack/test-go.sh.

Signed-off-by: Monis Khan mkhan@redhat.com

/assign @smarterclayton

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 5, 2017
@enj
Copy link
Contributor Author

enj commented Sep 5, 2017

@stevekuznetsov my BASH hacks are probably wrong...


var timeout = flag.Duration("sub.timeout", 0, "Specify the timeout for each sub test")
var retries = flag.Int("sub.retries", 1, "Specify the flake retries for each sub test")
var run = flag.String("sub.run", ".*", "Run only those sub tests matching the regular expression")
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't do this. All the sub tests are TestIntegration/*. Use that.

os::util::environment::update_path_var

COVERAGE_SPEC=" " DETECT_RACES=false TMPDIR="${BASETMPDIR}" TIMEOUT=45m GOTESTFLAGS="-sub.timeout=120s" "${OS_ROOT}/hack/test-go.sh" "test/integration/runner"
COVERAGE_SPEC=" " DETECT_RACES=false TMPDIR="${BASETMPDIR}" TIMEOUT=45m GOTESTBINARY_FLAGS="-sub.timeout=120s -sub.run=${1:-}" "${OS_ROOT}/hack/test-go.sh" "test/integration/runner"
Copy link
Contributor

Choose a reason for hiding this comment

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

Pass the flag to test-go, not to the sub run.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, ${1:+-run TestIntegration/}${1:-}

hack/test-go.sh Outdated
coverage_output_dir="${COVERAGE_OUTPUT_DIR:-}"
coverage_spec="${COVERAGE_SPEC:--cover -covermode atomic}"
gotest_flags="${GOTEST_FLAGS:-}"
gotestbinary_flags="${GOTESTBINARY_FLAGS:-}"
Copy link
Contributor

Choose a reason for hiding this comment

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

why isn't this gotestflags?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is my only comment Bash-wise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current file in master has a typo GOTESTFLAGS vs GOTEST_FLAGS. If you correct the typo, the runner breaks because you cannot pass arguments to a test binary without using -args .... So I do not understand how to pass arguments (sub.timeout) to test-go and somehow have the test runner honor that.

GOTEST_FLAGS="-v -run TestIntegration/${1:-.*}" works.

These do not work:

"-v -run TestIntegration/${1:-.*}" -args -sub.timeout=120s"
"-v -run TestIntegration/${1:-.*}" -sub.timeout=120s"

Copy link
Contributor

Choose a reason for hiding this comment

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

The command-line package list, if present, must appear before any
flag not known to the go test command. Continuing the example above,
the package list would have to appear before -myflag, but could appear
on either side of -v.
—from go test -help

test-go.sh uses GOTEST_FLAGS before a package name, therefore -sub.timeout=120s cannot be used in GOTEST_FLAGS. On the other side, we can try to change the order of arguments in test-go.sh.

@enj enj force-pushed the enj/t/integration_run_regex branch from 194fbc4 to 7792806 Compare September 18, 2017 14:53
@enj enj changed the title Correctly pass flags to integration tests Allow running a subset of the integration tests Sep 18, 2017
@enj
Copy link
Contributor Author

enj commented Sep 18, 2017

@smarterclayton @stevekuznetsov @dmage PTAL.

I went with the smallest change that allows running a subset of integration tests and does not further complicate test-go.sh. Instead of trying to override the timeout value for the integration test runner, I just gave it a more reasonable default value.

This change restores the previous behavior of running
`hack/test-integration.sh <regex>`.  The timeout flag is no longer
passed to the integration test runner.  To do so correctly requires
using `go test -args` which would add further complexity to
`hack/test-go.sh`.

Signed-off-by: Monis Khan <mkhan@redhat.com>
@enj enj force-pushed the enj/t/integration_run_regex branch from 7792806 to d4a566c Compare September 18, 2017 16:03
@stevekuznetsov
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 18, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enj, stevekuznetsov

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

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 18, 2017
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 16226, 16377, 15766, 16299, 16153)

@openshift-merge-robot openshift-merge-robot merged commit 125120c into openshift:master Sep 18, 2017
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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants