Commit Graph

155 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
da87af638f
Merge pull request #115856 from lanycrost/e2e-115780-grpc-probe-tests
Promote gRPC probe e2e test to Conformance
2023-03-09 01:06:03 -08:00
Khachatur Ashotyan
1033cf80df e2e: promote gRPC probe tests to conformance 2023-02-25 08:54:51 +04:00
Patrick Ohly
41f23f52d0 test: fix ginkgolinter issues
All of these issues were reported by https://github.com/nunnatsa/ginkgolinter.
Fixing these issues is useful (several expressions get simpler, using
framework.ExpectNoError is better because it has additional support for
failures) and a necessary step for enabling that linter in our golangci-lint
invocation.
2023-02-22 19:36:05 +01:00
Shogo Hida
7cbf007e47 Fix port number
Signed-off-by: Shogo Hida <shogo.hida@gmail.com>
2023-02-18 20:44:10 +09:00
Shogo Hida
26f95f475a Fix arguments
Signed-off-by: Shogo Hida <shogo.hida@gmail.com>
2023-02-18 09:51:17 +09:00
Shogo Hida
58ae449604 Change etcd to agnhost
Signed-off-by: Shogo Hida <shogo.hida@gmail.com>
2023-02-16 00:49:28 +09:00
Patrick Ohly
136f89dfc5 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-02-06 15:39:13 +01:00
Patrick Ohly
4d63e7d4d6 e2e: remove unused label filter from WaitForPodsRunningReady
None of the users of the functions passed anything other than nil or an empty
map and the implementation ignore the parameter - it seems like a candidate for
simplification.
2023-02-06 15:39:12 +01:00
Antonio Ojea
7f5ae1c0c1
Revert "e2e: wait for pods with gomega" 2023-02-06 12:08:22 +01:00
Patrick Ohly
222f655062 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-01-31 13:01:39 +01:00
Patrick Ohly
3ebab68c8a e2e: remove unused label filter from WaitForPodsRunningReady
None of the users of the functions passed anything other than nil or an empty
map and the implementation ignore the parameter - it seems like a candidate for
simplification.
2023-01-31 07:52:26 +01:00
David Porter
b96290c08f e2e node: Update runtime class handler skip logic
There are two runtime class tests which required the container runtime
config to include explicit configuration for `test-handler`. The current
logic skips these tests in non GCE environments. This skip is too strict
since the test is skipped in node e2e environments and in other
environments such as kind, which support running the test and also
configure `test-handler`.

Instead of skipping based on provider, add a new function
`NodeSupportsPreconfiguredRuntimeClassHandler` which examines the
underlying container runtime config and checks if the config includes
`test-handler`. The check is a bit brittle since it assumes container
runtime config paths, but it is a net improvement over skipping the test
entirely on non GCE environments.

This results in the test working in the common test environments, namely
GCE kube-up, node e2e, and kind.

Signed-off-by: David Porter <david@porter.me>
2023-01-24 14:43:24 -08:00
Patrick Ohly
6af5bf0585 e2e: enhance tests that check for pod staying pending
Using WaitTimeoutForPodRunningInNamespace followed by ExpectError was not very
precise (any error passed the check, not just the expected timeout) and
hard to read. Now the test's expectation is spelled out explicitly: the pod
must stay in pending.
2023-01-16 09:12:30 +01:00
TommyStarK
a46cfe5d1e test/e2e: Replace deprecated pointer function
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-01-05 18:43:58 +01:00
Patrick Ohly
2f6c4f5eab e2e: use Ginkgo context
All code must use the context from Ginkgo when doing API calls or polling for a
change, otherwise the code would not return immediately when the test gets
aborted.
2022-12-16 20:14:04 +01:00
Patrick Ohly
d4729008ef e2e: simplify test cleanup
ginkgo.DeferCleanup has multiple advantages:
- The cleanup operation can get registered if and only if needed.
- No need to return a cleanup function that the caller must invoke.
- Automatically determines whether a context is needed, which will
  simplify the introduction of context parameters.
- Ginkgo's timeline shows when it executes the cleanup operation.
2022-12-13 08:09:01 +01:00
Patrick Ohly
0d73c0d0e5 e2e: fix linter errors
Adding "ctx" as parameter in the previous commit led to some linter errors
about code that overwrites "ctx" without using it.

This gets fixed by replacing context.Background or context.TODO in those code
lines with the new ctx parameter.

Two context.WithCancel calls can get removed completely because the context
automatically gets cancelled by Ginkgo when the test returns.
2022-12-10 20:35:46 +01:00
Patrick Ohly
df5d84ae81 e2e: accept context from Ginkgo
Every ginkgo callback should return immediately when a timeout occurs or the
test run manually gets aborted with CTRL-C. To do that, they must take a ctx
parameter and pass it through to all code which might block.

This is a first automated step towards that: the additional parameter got added
with

    sed -i 's/\(framework.ConformanceIt\|ginkgo.It\)\(.*\)func() {$/\1\2func(ctx context.Context) {/' \
        $(git grep -l -e framework.ConformanceIt -e ginkgo.It )
    $GOPATH/bin/goimports -w $(git status | grep modified: | sed -e 's/.* //')

log_test.go was left unchanged.
2022-12-10 19:50:18 +01:00
Ionut Balutoiu
f092343300 tests: Spawn poststart / prestop pods on the same node as the https pod
In the PR https://github.com/kubernetes/kubernetes/pull/86139, two more lifecycle hook tests (poststart / prestop)
were added using HTTPS. They are similar with the existing HTTP tests.

However, this causes failures on Windows due to how networking
works there. We previously fixed this in the HTTP tests via f9e4a015e2.

This commit applies the same fix on the lifecycle hook HTTPS tests.

Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
2022-11-03 19:25:15 +02:00
Jason Simmons
5a6acf85fa Align lifecycle handlers and probes
Align the behavior of HTTP-based lifecycle handlers and HTTP-based
probers, converging on the probers implementation. This fixes multiple
deficiencies in the current implementation of lifecycle handlers
surrounding what functionality is available.

The functionality is gated by the features.ConsistentHTTPGetHandlers feature gate.
2022-10-19 09:51:52 -07:00
Patrick Ohly
5614a9d064 e2e framework: eliminate interim sub packages
The "todo" packages were necessary while moving code around to avoid hitting
cyclic dependencies. Now that any sub package can depend on the framework, they
are no longer needed and the code can be moved into the normal sub packages.
2022-10-06 08:16:47 +02:00
Patrick Ohly
a46fea53e6 e2e framework: move pod exec and create into sub package 2022-10-06 08:16:47 +02:00
Patrick Ohly
2c8ef492ae e2e framework: move kubectl and pod helper code 2022-10-06 08:16:47 +02:00
ZhangKe10140699
4f19b10567 fix:e2e test flake: Probing container should mark readiness on pods to false 2022-09-26 09:55:19 +08:00
Humble Chirammal
9e9fc2be88 various corrections in test/e2e package
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2022-09-16 18:59:30 +05:30
Kubernetes Prow Robot
25a3274a4f
Merge pull request #111440 from verb/111025-ec-conformance
Promote Ephemeral Containers e2e test to Conformance
2022-08-08 15:35:57 -07:00
Giuseppe Scrivano
b1eaf6a2d9 tests: add e2e tests for userns
Co-authored-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-08-03 19:53:22 +02:00
Kubernetes Prow Robot
cf2800b812
Merge pull request #111402 from verb/111030-ec-ga
Promote EphemeralContainers feature to GA
2022-07-29 19:29:20 -07:00
Kubernetes Prow Robot
4f469e63f4
Merge pull request #108592 from claudiubelu/tests/enable-etc-hosts
tests: Enables a few Conformance tests for Windows (part 2)
2022-07-29 13:17:23 -07:00
Kubernetes Prow Robot
1663ec0851
Merge pull request #111249 from Octopusjust/k8s-pr6
test/e2e/common/node: fix several typo
2022-07-27 11:35:08 -07:00
Lee Verberne
14ee775215 Promote Ephemeral Containers e2e test to Conformance 2022-07-26 16:52:02 +02:00
Kubernetes Prow Robot
00ace95226
Merge pull request #111046 from wongearl/omit-comparison
omit comparison to bool constant
2022-07-26 03:37:09 -07:00
Lee Verberne
d238e67ba6 Remove EphemeralContainers feature-gate checks 2022-07-26 02:55:30 +02:00
Lee Verberne
4ad08e13b2 Add Ephemeral Containers to node conformance tests 2022-07-24 17:31:16 +02:00
ZhangYu
9cbf198ce3 test/e2e/common/node: fix several typo 2022-07-19 17:51:18 +08:00
Kubernetes Prow Robot
b3057e7ccc
Merge pull request #106834 from mengjiao-liu/sysctl-allow-slashes
Add support for slash as sysctl separator to Pod securityContext field and to PodSecurityPolicy
2022-07-15 01:04:24 -07:00
wongearl
c2cb482181 omit comparison to bool constant 2022-07-09 17:15:27 +08:00
Kubernetes Prow Robot
9dc13f4f57
Merge pull request #111011 from ii/promote-patch-pod-status-test
Promote patchCoreV1NamespacedPodStatus test - +1 endpoint
2022-07-08 09:07:52 -07:00
Dave Chen
857458cfa5 update ginkgo from v1 to v2 and gomega to 1.19.0
- update all the import statements
- run hack/pin-dependency.sh to change pinned dependency versions
- run hack/update-vendor.sh to update go.mod files and the vendor directory
- update the method signatures for custom reporters

Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-08 10:44:46 +08:00
Stephen Heywood
c288ebe53c Promote PodStatus e2e test to Conformance 2022-07-08 11:51:58 +12:00
Kubernetes Prow Robot
6ed938fc8f
Merge pull request #110705 from ii/patch-pod-status-test
Write patchCoreV1NamespacedPodStatus test - +1 endpoint
2022-06-27 16:35:55 -07:00
Stephen Heywood
bc22560bb4 Create e2e test for PodStatus endpoint
e2e test validates the following endpoint
- patchCoreV1NamespacedPodStatus
2022-06-28 09:14:11 +12:00
Mengjiao Liu
5fca1112e1 Add test for sysctl support slash as separator 2022-06-22 10:39:52 +08:00
apeltop
e530336b18 fix typos 2022-06-15 13:38:48 +09:00
Ryan Phillips
230124f3d4 kubelet: add e2e test to verify probe readiness 2022-06-06 17:00:55 -05:00
Kubernetes Prow Robot
60481c944e
Merge pull request #109946 from tallclair/ps-e2e
Restricted Pod E2E tests
2022-05-25 14:45:22 -07:00
Kubernetes Prow Robot
b0991517e5
Merge pull request #110127 from jwtty/boolcheck
test/e2e/common/node: enhance assertions
2022-05-25 13:35:23 -07:00
Tim Allclair
702ab97722 Run common pod E2Es as restricted 2022-05-24 16:10:16 -07:00
Kubernetes Prow Robot
1ad8613d5c
Merge pull request #109790 from p0lyn0mial/users-watchtools-informerwatcher
users of watchtools.NewIndexerInformerWatcher should wait for the informer to sync
2022-05-24 08:52:05 -07:00
Lukasz Szaszkiewicz
4a7845b485 users of watchtools.NewIndexerInformerWatcher should wait for the informer to sync
previously users of this method were relying on the fact that a call to LIST was made.
Instead, users should use the dedicated `HasSynced` method.
2022-05-24 13:05:40 +02:00