kubernetes/test/utils
Patrick Ohly 11dcfc6c15 ktesting: replace Begin/End with TContext.Step
Manually pairing Being with End is too error prone to be useful. It had the
advantage of keeping variables created between them visible to the following
code, but that doesn't justify using those calls.

By using a callback we can achieve a few things:

- Code using it automatically shadows the parent tCtx, thus enforcing
  that within a code block the tCtx with step is used consistently.
- The code block is clearly delineated with curly braces.
- When the code block ends, the unmodified parent tCtx is automatically
  in scope again.

Downsides:

- Extra boilerplate for the anonymous function.
  Python's `with tCtx.Step(...) as tCtx: ` would be nicer.
  As an approximation of that `for tCtx := range tCtx.Step(...)` was
  tried with `Step` returning an iterator, but that wasn't very idiomatic.
- Variables created inside the code block are not visible outside of it.

(cherry picked from commit 047682908d)
2026-01-16 08:10:36 +01:00
..
apiserver svm: set UID and RV on SSA patch to cause conflict on logical create 2024-07-18 17:19:11 -04:00
crd chore: depr. pointer pkg replacement for test/e2e and utils 2025-07-06 22:18:03 +02:00
fakedns integration test: webhook proxy behavior 2025-10-02 22:31:08 +00:00
format dependencies: ginkgo v2.27.3 + gomega v1.38.3 2025-12-19 10:37:54 +01:00
harness Generate and format files 2022-07-26 13:14:05 -04:00
hermeticpodcertificatesigner Add e2e tests, metrics and events for podcertificaterequests v1beta1 2025-11-05 18:12:39 +00:00
image etcd: Update etcd to v3.6.7 2025-12-18 19:05:14 +05:30
junit
ktesting ktesting: replace Begin/End with TContext.Step 2026-01-16 08:10:36 +01:00
kubeconfig svm: set UID and RV on SSA patch to cause conflict on logical create 2024-07-18 17:19:11 -04:00
localupcluster ktesting: replace Begin/End with TContext.Step 2026-01-16 08:10:36 +01:00
oidc Bump to mockery v3 2025-08-29 13:43:54 +02:00
admission_webhook.go Generate and format files 2022-07-26 13:14:05 -04:00
audit.go svm: set UID and RV on SSA patch to cause conflict on logical create 2024-07-18 17:19:11 -04:00
conditions.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
create_resources.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
delete_resources.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
density_utils.go Fix Go vet errors for master golang 2024-09-20 12:36:38 +05:30
deployment.go Fix Go vet errors for master golang 2024-09-20 12:36:38 +05:30
node.go e2e tests 2024-11-08 03:00:54 +00:00
paths.go Setup e2e_node to support testing on ARM64 2023-05-20 00:07:44 +00:00
pki_helpers.go update serial number to a valid non-zero number in ca certificate (#117791) 2023-05-09 06:34:08 -07:00
pod_store.go
replicaset.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
runners.go test: remove usage of storage v1beta1 APIs 2025-10-27 10:12:25 +01:00
tmpdir.go
update_resources.go Replace PollImmediate with PollUntilContextTimeout (#128147) 2024-11-07 14:57:29 +00:00