Commit Graph

76 Commits

Author SHA1 Message Date
Michal Wozniak
3d68f362c3 Give terminal phase correctly to all pods that will not be restarted 2023-03-16 21:25:29 +01:00
Patrick Ohly
1bd1167d56 e2e pod: remove dead code 2023-02-06 15:39:13 +01:00
Patrick Ohly
3bb735e6fa e2e pod: use gomega.Eventually in WaitForRestartablePods 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
89a5d6d8af e2e pod: use gomega.Eventually in WaitForPodNotFoundInNamespace 2023-02-06 15:39:13 +01:00
Patrick Ohly
9df3e2a47a e2e: replace WaitForPodToDisappear with WaitForPodNotFoundInNamespace
WaitForPodToDisappear was always called such that it listed all pods, which
made it less efficient than trying to get just the one pod it was checking for.

Being able to customize the poll interval in practice wasn't useful, therefore
it can be replaced with WaitForPodNotFoundInNamespace.
2023-02-06 15:39:12 +01:00
Patrick Ohly
45d4631069 e2e: consolidate checking a pod list
WaitForPods is now a generic function which lists pods and then checks the pods
that it found against some provided condition. A parameter determines how many
pods must be found resp. match the condition for the check to succeed.
2023-02-06 15:39:12 +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
Patrick Ohly
3dd185aa40 e2e pod: use gomega.Eventually in WaitForPodsRunningReady
The code becomes simpler (78 insertions, 91 deletions), easier to read (all
code entirely inside WaitForPodsRunningReady, no need to declare and later
overwrite variables) and possibly more correct (if all API calls failed,
the resulting error was ignored when allowedNotReadyPods > 0).
2023-02-06 15:39:12 +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
Patrick Ohly
005a9da0cc e2e framework: implement pod polling with gomega.Eventually
gomega.Eventually provides better progress reports: instead of filling up the
log with rather useless one-line messages that are not enough to to understand
the current state, it integrates with Gingko's progress reporting (SIGUSR1,
--poll-progress-after) and then dumps the same complete failure message as
after a timeout. That makes it possible to understand why progress isn't
getting made without having to wait for the timeout.

The other advantage is that the failure message for some unexpected pod state
becomes more readable: instead of encapsulating it as "observed object" inside
an error, it directly gets rendered by gomega.
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
901928cd54 e2e pod: remove dead code 2023-01-31 13:01:39 +01:00
Patrick Ohly
f5782f1dbd e2e pod: use gomega.Eventually in WaitForRestartablePods 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
4491c80074 e2e pod: use gomega.Eventually in WaitForPodNotFoundInNamespace 2023-01-31 13:01:39 +01:00
Patrick Ohly
6eea1b2efa e2e: replace WaitForPodToDisappear with WaitForPodNotFoundInNamespace
WaitForPodToDisappear was always called such that it listed all pods, which
made it less efficient than trying to get just the one pod it was checking for.

Being able to customize the poll interval in practice wasn't useful, therefore
it can be replaced with WaitForPodNotFoundInNamespace.
2023-01-31 13:01:39 +01:00
Patrick Ohly
4740d34edb e2e: consolidate checking a pod list
WaitForPods is now a generic function which lists pods and then checks the pods
that it found against some provided condition. A parameter determines how many
pods must be found resp. match the condition for the check to succeed.
2023-01-31 07:52:26 +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
671835e976 e2e pod: use gomega.Eventually in WaitForPodsRunningReady
The code becomes simpler (78 insertions, 91 deletions), easier to read (all
code entirely inside WaitForPodsRunningReady, no need to declare and later
overwrite variables) and possibly more correct (if all API calls failed,
the resulting error was ignored when allowedNotReadyPods > 0).
2023-01-31 07:52:26 +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
Patrick Ohly
e8a50b0583 e2e framework: implement pod polling with gomega.Eventually
gomega.Eventually provides better progress reports: instead of filling up the
log with rather useless one-line messages that are not enough to to understand
the current state, it integrates with Gingko's progress reporting (SIGUSR1,
--poll-progress-after) and then dumps the same complete failure message as
after a timeout. That makes it possible to understand why progress isn't
getting made without having to wait for the timeout.

The other advantage is that the failure message for some unexpected pod state
becomes more readable: instead of encapsulating it as "observed object" inside
an error, it directly gets rendered by gomega.
2023-01-31 07:52:26 +01:00
Patrick Ohly
6b5f77b163 e2e framework/pod: add gomega matchers
They can be used for polling with a get function and gomega.Eventually or
gomega.Consistently.
2023-01-16 09:05:37 +01:00
Patrick Ohly
63ab23200b e2e framework: support polling with Get
These helper functions can be used in combination with
omega.Eventually/Consistently to implement polling of objects that is aware of
Kubernetes apiserver conventions:

- retry on certain errors instead of giving up,
  with "not found" handling decided by the caller (may or may not
  be fatal, depending on the test)
- sleep if requested by apiserver
2023-01-16 09:05:37 +01:00
Patrick Ohly
16a6f70e11 e2e: add PollInterval()
Various different tests all have their own poll intervals. As a start towards
consolidating that, the interval from test/e2e/framework/pod (as one of the
most common cases for polling) is moved into the framework.

Changing other helper packages and tests needs to follow.
2023-01-09 17:29:35 +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
Maciej Szulik
0253397fbd
Use goroutine to speed up volume clenaups
This removes WaitTimeoutForPodNoLongerRunningOrNotFoundInNamespace
introduced in f2b9479f8e and changes
the test to use goroutines to speed up the cleanups.
2022-11-10 13:15:06 +01:00
Michal Wozniak
c803892bd8 Enable the feature into beta 2022-11-09 09:02:40 +01:00
Wei Huang
abe0c5d5b4
E2E test for KEP Scheduling Readiness Gates 2022-11-08 12:38:21 -08:00
Maciej Szulik
f2b9479f8e
Wait for pod not running or gone in storage tests 2022-10-18 13:18:54 +02: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
Kubernetes Prow Robot
f0823c0f59
Merge pull request #112503 from pohly/e2e-framework-pod-polling
e2e framework: pod polling
2022-09-20 00:05:20 -07: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
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
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
Mikko Ylinen
3128b1a773 e2e: use user provided timeout in WaitForPodsWithLabelRunningReady
The WaitFor* refactoring in 07c34eb400 had an oversight what timeout parameter
is used for calling WaitForAllPodsCondition() in WaitForPodsWithLabelRunningReady()
so the calls to WaitForPodsWithLabelRunningReady() ended up ignoring the user
provided timeout. Fix that.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-08-18 12:05:06 +03:00
Tim Allclair
b289c23394 [e2epod] wait: Don't override non-timeout errors 2022-07-29 17:11:50 -07:00
Tim Allclair
55ec0f2d9d [e2epod] wait: Don't retry on 50X errors 2022-07-29 14:56:33 -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
Patrick Ohly
2b299526b2 e2e: include more information in pod timeout error
The advantage is that the extra error information is guaranteed to be printed
directly before the failure and we avoid one extra log line that would have to
be correlated with the failure.
2022-06-03 13:41:05 +02: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
ravisantoshgudimetla
82f701aae2 pod admission test 2022-03-22 14:58:27 -04:00
Lee Verberne
da8ddb7485 Create node_e2e test for ephemeral containers 2021-09-27 13:13:33 +02:00
pacoxu
ddaa3466eb correct unsafe sysctls e2e test case & use status reason check instead of events watch
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2021-08-18 15:11:09 +08:00
Kubernetes Prow Robot
ed5618e2d5
Merge pull request #104061 from aojea/waitForPodsReady
replace e2e WaitForPodsReady by WaitTimeoutForPodReadyInNamespace
2021-08-05 08:18:24 -07:00
Antonio Ojea
34f4959633 replace e2e WaitForPodsReady by WaitTimeoutForPodReadyInNamespace 2021-08-01 19:24:52 +02:00
Antonio Ojea
50b3cbe999 e2e: remove unused sync.WaitGroup 2021-07-19 18:24:03 +02:00
Konstantin Misyutin
351f4e9c9c cleanup: remove TODO at e2e scheduling preemption test
Signed-off-by: Konstantin Misyutin <konstantin.misyutin@huawei.com>
2021-05-19 17:34:50 +08:00