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

Disable Go Unit Test Cache in Go 1.12 #873

Merged
merged 2 commits into from
Jun 20, 2019

Conversation

sgreene570
Copy link
Contributor

- What I did
In #818, the flag to disable GOCACHE was removed for go 1.12 compatibility. Turns out, running unit tests with the cache enabled is frustrating. For example, if a test asset (and not a test file itself) is updated, re-running make test-unit will pull test results from the test cache. Also, changing some parts of a unit test may not actually clear the entire test cache for that particular test (even though it should).

The new way to disable the go testing cache is to use -count=1 in the go test command.
(see golang/go#24573)

- How to verify it
make test-unit and verify that no test were pulled from the cache (ie. look for (cached))

- Description for the changelog

Disable Go Cache for unit tests in Makefile

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 20, 2019
@cgwalters
Copy link
Member

cgwalters commented Jun 20, 2019

/approve
Thanks for this. As this says,

There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.

And this is incorrect caching, the go test framework's caching would need to know external inputs.

Will give this a bit for someone else to lgtm.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2019
@kikisdeliveryservice
Copy link
Contributor

@sgreene570 and I discovered this yesterday while debugging a unit test, so A+ on this PR 😄

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 20, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, kikisdeliveryservice, sgreene570

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:
  • OWNERS [cgwalters,kikisdeliveryservice]

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

@openshift-merge-robot openshift-merge-robot merged commit 9ed1736 into openshift:master Jun 20, 2019
@runcom
Copy link
Member

runcom commented Jun 21, 2019

Great catch Steve!

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/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.

6 participants