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

create make test cached k/k presubmit (optional, always_run: false) #20977

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

BenTheElder
Copy link
Member

/cc @spiffxp @liggitt @dims

It's time to ship @Katharine's cache work to presubmit :-)

This is the first step, just adding a job we can manually trigger to sanity check.

Once that's done I intend to make it at minimum skip_report: true but always_run: true (and still optional: true).

See how the current CI jobs are faring:
https://prow.k8s.io/?job=ci-kubernetes*make*

Part of kubernetes/enhancements#2420

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/config Issues or PRs related to code in /config area/jobs sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Feb 23, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder

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 added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 23, 2021
mkdir -p _output/local/go/
time tar -xzf cache.tar.gz -C _output/local/go
# Run tests as usual
time make test KUBE_RACE=-race KUBE_TIMEOUT=--timeout=240s
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: what timeout do we really want here? This one is observed from GKE's equivalent infra, and is at least lower than the 600s below.
TODO: should KUBE_RACE=-race be default? In bazel we just had race by default IIRC. Ideally locally I should just make test and it should do the preferred thing ... I don't know why it isn't default yet though.

@BenTheElder
Copy link
Member Author

BenTheElder commented Feb 23, 2021

Fun fact:
https://prow.k8s.io/?job=periodic-kubernetes-bazel-test-master ~22+ minutes
https://prow.k8s.io/?job=ci-kubernetes*make* ~6 minutes (for the cached job)

Bazel is basically not caching unit tests still even after disabling the run per test bump ...?

@dims
Copy link
Member

dims commented Feb 23, 2021

/lgtm

yes please!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 23, 2021
@k8s-ci-robot k8s-ci-robot merged commit f7bf66e into kubernetes:master Feb 23, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Feb 23, 2021
@k8s-ci-robot
Copy link
Contributor

@BenTheElder: Updated the job-config configmap in namespace default at cluster test-infra-trusted using the following files:

  • key make-test.yaml using file config/jobs/kubernetes/sig-testing/make-test.yaml

In response to this:

/cc @spiffxp @liggitt @dims

It's time to ship @Katharine's cache work to presubmit :-)

This is the first step, just adding a job we can manually trigger to sanity check.

Once that's done I intend to make it at minimum skip_report: true but always_run: true (and still optional: true).

See how the current CI jobs are faring:
https://prow.k8s.io/?job=ci-kubernetes*make*

Part of kubernetes/enhancements#2420

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@BenTheElder BenTheElder deleted the make-test-cached branch February 23, 2021 23:47
@BenTheElder
Copy link
Member Author

@BenTheElder
Copy link
Member Author

Ah, go test -race disables caching.

The rule for a match in the cache is that the run involves the same
test binary and the flags on the command line come entirely from a
restricted set of 'cacheable' test flags, defined as -cpu, -list,
-parallel, -run, -short, and -v. If a run of go test has any test
or non-test flags outside this set, the result is not cached. To
disable test caching, use any test flag or argument other than the
cacheable flags. The idiomatic way to disable test caching explicitly
is to use -count=1. Tests that open files within the package's source
root (usually $GOPATH) or that consult environment variables only
match future runs in which the files and environment variables are unchanged.
A cached test result is treated as executing in no time at all,
so a successful package test result will be cached and reused
regardless of -timeout setting.

test docs

So we can have very fast presubmits, but without -race. We could run with -race in a periodic ...
Or we can give up on caching and accept that < 30m is OK for kubernetes presubmits for now.

@BenTheElder
Copy link
Member Author

AFAICT we'd have to patch go test to cache with -race:
https://golang.org/src/cmd/go/internal/test/test.go#L1318

@BenTheElder
Copy link
Member Author

It is however still within a few minutes of the bazel job, and passing.

@BenTheElder
Copy link
Member Author

#20991 to disable -race so we can get the results with caching, we can flip it back on if we decide it's more important (these jobs are not blocking / monitored yet except by me).

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. area/config Issues or PRs related to code in /config area/jobs 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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

3 participants