Simplify testExtendedResource structure and add proper field validation:
- Rename tests to distinguish explicit vs implicit modes clearly
- Remove unnecessary nested sub-test to flatten test hierarchy
- Validate ExtendedResourceName is correctly stored or stripped
based on feature gate state to ensure proper API behavior
- Remove outdated comment that no longer applies
Co-Authored-By: Patrick Ohly <patrick.ohly@intel.com>
Simplified testExtendedResource by using the helper functions added
in the previous commit:
- Removed unused global test data (podWithExtendedResource,
classWithExtendedResource, etc.)
- Used createTestClassWithSpec to create DeviceClass with extended resources
- Used createPodWithExtendedResource to create test pods
- Removed manual class and pod creation boilerplate
Add helper functions to use for testing DRA extended resources:
- Add createTestClassWithSpec to support custom DeviceClassSpec
- Add createPodWithExtendedResource to create pods requesting extended resources
so that configured liveness probes will fail
if the loopback certificate has expired,
forcing a restart.
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
there are recent changes in k8s e2e test for image pull test to switch
to use fake registry server,
https://github.com/kubernetes/kubernetes/pull/133272https://github.com/kubernetes/kubernetes/pull/134453
Unfortunately, this does not take into account of windows node. so the
corresonding test on windows node strat to break
The try to address this issue, by
(1): update the agnhost windows image to include the fake registery server
functionality as well
(2): update the (common) pull image test to include windows node, will require
(a): deploy the agnhost faker register server as a HPC pod
(b): update the comanndline/options for the windows container specific
When running with race detection enabled several tests have suffered from
timeouts recently, with no obvious commit which could be blamed for this.
Let's use a common constant and make it larger.
When aborting an integration test with CTRL-C while it runs,
the current test fails and etcd exits. But additional tests were still being
started and the failed slowly because they couldn't connect to etcd.
It's better to fail additional tests in ktesting.Init when the test run has
already been interrupted.
While at it, also make it a bit more obvious that testing was interrupted by
logging it and update one comment about this and clean up the naming of
contexts in the code.
Example:
$ go test -v ./test/integration/quota
...
I1106 11:42:48.857162 147325 etcd.go:416] "Not using watch cache" resource="events.events.k8s.io"
I1106 11:42:48.857204 147325 handler.go:286] Adding GroupVersion events.k8s.io v1 to ResourceManager
W1106 11:42:48.857209 147325 genericapiserver.go:765] Skipping API events.k8s.io/v1beta1 because it has no resources.
^C
INFO: canceling test context: received interrupt signal
{"level":"warn","ts":"2024-11-06T11:42:48.984676+0100","caller":"embed/serve.go:160","msg":"stopping insecure grpc server due to error","error":"accept tcp 127.0.0.1:44177: use of closed network connection"}
...
I1106 11:42:50.042430 147325 handler.go:142] kube-apiserver: GET "/apis/rbac.authorization.k8s.io/v1/clusterroles" satisfied by gorestful with webservice /apis/rbac.authorization.k8s.io/v1
test_server.go:241: timed out waiting for the condition
--- FAIL: TestQuota (11.45s)
=== RUN TestQuotaLimitedResourceDenial
quota_test.go:292: testing has been interrupted: received interrupt signal
--- FAIL: TestQuotaLimitedResourceDenial (0.00s)
=== RUN TestQuotaLimitService
quota_test.go:418: testing has been interrupted: received interrupt signal
--- FAIL: TestQuotaLimitService (0.00s)
FAIL
When cleaning up the progress channel properly (stop signal delivery, closing
the channel), the loop dumping progress reports no longer needs to check for
the separate shutdown context. Instead, it can distinguish between "signal
received" and "channel closed".
The signal context was getting cleanup by canceling it, but a channel is better
because it avoids the slightly misleading "received interrupt signal"
cancellation when the test was only shutting down.
The "received interrupt signal" is useful also when running with "go test"
without -v because it shows that the shutdown has started.
But more important is that a progress report gets shown because that feature is
useful in particular when "go test" produces no output while it runs.