mirror of https://github.com/knative/pkg.git
* TestEnqueue: remove unnecessary calls to Sleep The rate limiter applies only when multiple items are put onto the workqueue, which is not the case in those tests. Execution: ~7.6s -> ~2.1s * TestEnqueueAfter: remove assumptions on execution times Instead of sleeping for a conservative amount of time, keep watching the state of the workqueue in a goroutine, and notify the test logic as soon as the item is observed. Execution: ~1s -> ~0.05s * TestEnqueueKeyAfter: remove assumptions on execution times Instead of sleeping for a conservative amount of time, keep watching the state of the workqueue in a goroutine, and notify the test logic as soon as the item is observed. Execution: ~1s -> ~0.05s * TestStartAndShutdownWithErroringWork: remove sleep Instead of sleeping for a conservative amount of time, keep watching the state number of requeues in a goroutine, and notify the test logic as soon as the expected threshold is reached. Logs, for an idea of timings ---------------------------- Started workers Processing from queue bar (depth: 0) Reconcile error {"error": "I always error"} Requeuing key bar due to non-permanent error (depth: 0) Reconcile failed. Time taken: 104µs {"knative.dev/key": "bar"} Processing from queue bar (depth: 0) Reconcile error {"error": "I always error"} Requeuing key bar due to non-permanent error (depth: 0) Reconcile failed. Time taken: 48.2µs {"knative.dev/key": "bar"} Execution: ~1s -> ~0.01s * TestStart*/TestRun*: reduce sleep time There is no need to sleep for that long. If an error was returned, it would activate the second select case immediately. Execution: ~1s -> ~0.05s * TestImplGlobalResync: reduce sleep time We know the fast lane is empty in this test, so we can safely assume immediate enqueuing of all items on the slow lane. Logs, for an idea of timings ---------------------------- Started workers Processing from queue foo/bar (depth: 0) Reconcile succeeded. Time taken: 11.5µs {"knative.dev/key": "foo/bar"} Processing from queue bar/foo (depth: 1) Processing from queue fizz/buzz (depth: 0) Reconcile succeeded. Time taken: 9.7µs {"knative.dev/key": "fizz/buzz"} Reconcile succeeded. Time taken: 115µs {"knative.dev/key": "bar/foo"} Shutting down workers Execution: ~4s -> ~0.05s * review: Replace for/select with PollUntil * review: Remove redundant duration multiplier * review: Replace defer with t.Cleanup |
||
---|---|---|
.github | ||
apiextensions | ||
apis | ||
changeset | ||
client/injection | ||
codegen | ||
configmap | ||
controller | ||
hack | ||
hash | ||
injection | ||
kflag | ||
kmeta | ||
kmp | ||
kvstore | ||
leaderelection | ||
logging | ||
metrics | ||
network | ||
pool | ||
profiling | ||
ptr | ||
reconciler | ||
resolver | ||
signals | ||
source | ||
system | ||
test | ||
testing | ||
testutils | ||
third_party/mako | ||
tracing | ||
tracker | ||
vendor | ||
version | ||
webhook | ||
websocket | ||
.gitattributes | ||
.gitignore | ||
CONTRIBUTING.md | ||
DEVELOPMENT.md | ||
LICENSE | ||
OWNERS | ||
OWNERS_ALIASES | ||
README.md | ||
RELEASE-LEADS.md | ||
code-of-conduct.md | ||
go.mod | ||
go.sum |
README.md
Knative Common Packages
Knative pkg
provides a place for sharing common Knative packages across the
Knative repos.
To learn more about Knative, please visit our Knative docs repository.
If you are interested in contributing, see CONTRIBUTING.md and DEVELOPMENT.md.