Commit Graph

69 Commits

Author SHA1 Message Date
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
1bd1167d56 e2e pod: remove dead code 2023-02-06 15:39:13 +01:00
Patrick Ohly
1e346c4e4a e2e pod: convert ProxyResponseChecker into matcher
Instead of pod responses being printed to the log each time polling fails, we
get a consolidated failure message with all unexpected pod responses if (and
only if) the check times out or a progress report gets produced.
2023-02-06 15:39:13 +01:00
Patrick Ohly
c3266cde77 e2e: consolidate pod response checking
This renames PodsResponding to WaitForPodsResponding for the sake of
consistency and adds a timeout parameter. That is necessary because some other
users of NewProxyResponseChecker used a much lower timeout (2min vs. 15min).

Besides simplifying some code, it also makes it easier to rewrite
ProxyResponseChecker because it only gets used in WaitForPodsResponding.
2023-02-06 15:39:13 +01:00
Patrick Ohly
d8428c6fb1 e2e pod: use gomega.Eventually in WaitTimeoutForPodReadyInNamespace/WaitForPodCondition
These get converted together because they relied on FinalErr which now isn't
needed anymore.
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
901928cd54 e2e pod: remove dead code 2023-01-31 13:01:39 +01:00
Patrick Ohly
5d8e970be6 e2e pod: convert ProxyResponseChecker into matcher
Instead of pod responses being printed to the log each time polling fails, we
get a consolidated failure message with all unexpected pod responses if (and
only if) the check times out or a progress report gets produced.
2023-01-31 13:01:39 +01:00
Patrick Ohly
3b579fca91 e2e: consolidate pod response checking
This renames PodsResponding to WaitForPodsResponding for the sake of
consistency and adds a timeout parameter. That is necessary because some other
users of NewProxyResponseChecker used a much lower timeout (2min vs. 15min).

Besides simplifying some code, it also makes it easier to rewrite
ProxyResponseChecker because it only gets used in WaitForPodsResponding.
2023-01-31 13:01:39 +01:00
Patrick Ohly
cd0c756c72 e2e pod: use gomega.Eventually in WaitTimeoutForPodReadyInNamespace/WaitForPodCondition
These get converted together because they relied on FinalErr which now isn't
needed anymore.
2023-01-31 07:52:26 +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
Michal Wozniak
c803892bd8 Enable the feature into beta 2022-11-09 09:02:40 +01: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
2d21acb1be e2e framework: eliminate redundant framework/[log|ginkgowrapper]
These sub packages were created by mistake. Logging and failure handling are
core features and must be implemented in the framework package.
2022-10-06 08:16:47 +02:00
Patrick Ohly
004c1b6441 e2e framework: abort polling for running pod early
When the pod state is failed or completed, the pod will never again enter the
running state and polling can stop.
2022-09-19 18:10:04 +02:00
Patrick Ohly
0bd901afea e2e framework: better error messages when pod has failed or completed
Getting a message about "pod ran to completion" is confusing when the pod
hasn't been able to start at all. The failed state now has a different message.

To address the previous ambiguity, the success state is described as "ran to
completion successfully".
2022-09-16 09:12:51 +02: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
Tim Allclair
07c34eb400
[E2E] Refactor pod polling functions (WaitForX) (#109704)
* Clean up WaitFor Pod functions

* Handle retryable errors when polling

* Log more context on timeout

* #squash Address PR feedback
2022-05-05 01:42:32 -07:00
Kubernetes Prow Robot
7d3fd15200
Merge pull request #108409 from 249043822/br-e2e-ciro
Add pod status info log for e2e creating pods failure
2022-05-03 18:23:19 -07:00
Claudiu Belu
87123c49a0 tests: Enables a few Conformance tests for Windows
Some of these tests could not be run previously, especially on Windows
Docker containers. But now, by using Windows Containerd, we can finally
run them:

- HostNetwork=true tests: This can now be enabled on Windows Privileged Containers.
- /etc/hosts related tests: These were not supported because it required single
  file mappings, which is possible in Containerd.
- termination message as non-root user: Requires RunAsUsername, and single file
  mappings.
2022-03-06 09:36:39 -08:00
ZhangKe10140699
34c90a4014 Add pod status info log for e2e creating pods 2022-03-01 18:20:47 +08:00
Kubernetes Prow Robot
51b94de68f
Merge pull request #105451 from claudiubelu/tests/log-pod-logs
tests: Fetch the pod logs in failed cases
2021-11-18 13:33:36 -08:00
Claudiu Belu
afb8569620 tests: Fetch the pod logs in failed cases
For some test failures, checking the pod logs could potentially
yield some interesting information, which could be used to further
investigate certain failures / flakes (for example, if there are some
networking issues, we could at least see if requests reach the containers,
(agnhost logs the connections / requests), or if there were any
other issues during the container's startup).
2021-11-03 11:10:26 -07:00
Lee Verberne
da8ddb7485 Create node_e2e test for ephemeral containers 2021-09-27 13:13:33 +02:00
Kubernetes Prow Robot
7563d3092e
Merge pull request #96216 from knight42/refactor/disable-insecure-port-in-ctrler-mgr
refactor: disable insecure serving in controller-manager
2021-05-10 13:49:36 -07:00
Jian Zeng
c4c2574778
refactor(e2e): grab metrics from controller-manager via nginx
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
2021-05-03 00:12:06 +08:00
Matthias Bertschy
b203fb0565 Deflake e2e test for startupProbe 2021-03-06 14:43:45 +01:00
Kubernetes Prow Robot
e25f3d75b8
Merge pull request #95065 from JornShen/replace_restarting_kas_kp_e2e_network_provider
refector service some e2e cases to make it runing in multi providers
2020-11-03 17:04:03 -08:00
jornshen
1d83b28dfe refector service some e2e cases to make it runing in multi providers
the cases are as fellow:
- "should work after restarting kube-proxy"
- "should work after restarting apiserver"
2020-10-30 19:39:02 +08:00
David Eads
64c099d670 remove secondary client retries in e2e tests 2020-10-15 08:30:42 -04:00
Kubernetes Prow Robot
2603cc1fcf
Merge pull request #94835 from zshihang/upgrade
upgrade test for BoundServiceAccountTokenVolume
2020-10-03 14:17:05 -07:00
Antonio Ojea
3e182e84ea e2e can't use both pod.Name and pod.GenerateName
This fixes a problem when using the framework helper
e2epod.CreateExecPodOrFail() more than once in the same test.

The problem is that this function was creating pods with both the
pod.Name and pod.GenerateName set.
The second pod failed to be created with a 500 with Reason ServerTimeout
indicating a unique name could not be found in the time allotted,
xref https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/
2020-10-01 12:28:06 +02:00
Shihang Zhang
637235e893 upgrade test for BoundServiceAccountTokenVolume 2020-09-24 09:55:05 -07:00
Claudiu Belu
13849214c1 tests: Refactor agnhost image pod usage
Creates a few agnhost related functions that creates agnhost
pods / containers for general purposes.

The following commits will refactor tests to use those functions.
2020-08-29 15:48:03 -07:00
Claudiu Belu
72a26aed7d tests: Fixes variable expansion false positive test
Some of the tests are negative test cases which are supposed to ensure that those
invalid usecases are handled properly.

However, some of the tests are false positives, they can pass due to various reasons.
One such example is: "should fail substituting values in a volume subpath with absolute path".
This test can pass if:

- the Pod cannot start due to various reasons (e.g.: the container image cannot be pulled or does
  not exist).
- the Pod ran to completion, even though the container was not supposed to start in the first place.
2020-07-31 01:23:09 -07:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Antonio Ojea
aa4df0422b
improve error logging on e2e pod create function 2020-05-12 13:41:56 +02:00
tanjunchen
fb078347e3 test/e2e/framework: remove direct imports to k8s.io/kubernetes/pkg 2020-03-31 09:26:07 +08:00
tanjunchen
d7e787adce test/e2e/framework: remove direct dependency to k8s.io/kubernetes/pkg/controller 2020-03-26 23:21:22 +08:00
SataQiu
86fe8f6472 e2e/framework: remove direct imports to /pkg/client/conditions
Signed-off-by: SataQiu <1527062125@qq.com>
2020-03-20 15:13:12 +08:00
Kubernetes Prow Robot
e5c67f75a9
Merge pull request #89199 from SataQiu/staging-test-framework-20200318
e2e/framework: remove direct imports to pkg/api/v1/pod
2020-03-19 08:27:37 -07:00
SataQiu
6a41f331da e2e/framework: remove direct imports to pkg/api/v1/pod 2020-03-18 11:10:06 +08:00
tanjunchen
97db7f4b99 move GetPodSecretUpdateTimeout from framework/utils to framework/pod 2020-03-11 15:48:15 +08:00
Wei Huang
c83a860e9d
Fix a bug in e2epod function 2020-02-13 16:45:16 -08:00
Shukun
0421b40d79 Remove tautological condition in test/e2e/framework/pod/resource.go 2020-02-12 20:49:24 +09:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Mike Danese
968adfa993 cleanup req.Context() and ResponseWrapper 2020-01-29 08:50:45 -08:00
Mike Danese
d55d6175f8 refactor 2020-01-29 08:50:45 -08:00