Commit Graph

47 Commits

Author SHA1 Message Date
Ed Bartosh
3aa95dafea e2e_node: refactor stopping and restarting kubelet
Moved Kubelet health checks from test cases to the stopKubelet API.
This should make the API cleaner and easier to use.
2024-11-06 11:34:48 +02:00
Kubernetes Prow Robot
98b4ee6bfa Merge pull request #126525 from dshebib/addSidecarE2EImgTest
Restart sidecar container when the image has changed
2024-11-06 00:35:35 +00:00
Daniel Shebib
43d527ad68 add restart on definition change 2024-10-18 15:35:06 -05:00
Kubernetes Prow Robot
de8f6b0db7 Merge pull request #128037 from dshebib/e2eNode_containerLifecycleContext
[e2e_node] Use shared context in regular container tests
2024-10-14 13:10:28 +01:00
Daniel Shebib
266d1c886a linter 2024-10-13 10:12:35 -05:00
Daniel Shebib
51883d5821 sidecar containers restart on definition change 2024-10-13 01:21:57 -05:00
Daniel Shebib
1618dbe695 Add context to tests 2024-10-12 21:23:29 -05:00
Tsubasa Nagasawa
04c6d9324e Check for restarts without being affected by container startup order
The test for checking container restarts in a Pod with restartable-init-1
and regular-1 is flaky. Right now, when we check if restartable-init-1 has
restarted, we see if it hasn’t written the "Started" log after regular-1 has
written its "Started" log.
But even though the startup sequence starts with restartable-init-1 and then
regular-1, there’s no guarantee they’ll finish starting up in that order.
Sometimes regular-1 finishes first and writes its "Started" log before restartable-init-1.

1. restartable-init-1 Starting
2. regular-1 Starting
3. regular-1 Started
4. restartable-init-1 Started

In this test, the startup order doesn’t really matter; all we need to check is
if restartable-init-1 restarted. So I changed the test to simply look for
more than one "Starting" log in restartable-init-1's logs.

There were other places that used the same helper function DoesntStartAfter,
so replaced those as well and deleted the helper function.
2024-10-12 15:17:47 +09:00
Tsubasa Nagasawa
82b690ddf6 Add more Node E2E tests to cover pod termination for Sidecar Containers
* A pod with restartable init container that exits with
  a non-zero code is marked as a pod succeeded phase
* A pod with restartable init containers that exits with
  a non-zero code by prestop hook is marked as a pod succeeded phase
* A pod with regular container that exceeds its termination grace period
  seconds is marked as a pod failed phase
* A pod with restartable init containers that exceeds its termination
  grace period seconds is marked as a pod succeeded phase
* A pod with a regular container that exceeded its termination grace
  period seconds by PreStop hook is marked as a pod failed phase
* A pod with restartable init containers that exceeds its termination
  grace period seconds by PreStop hook is marked as a pod succeeded phase

Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
2024-10-10 09:43:41 +09:00
Tsubasa Nagasawa
bd00f83578 Add step to existing pod termination Node E2E tests to check the container’s exit code
Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
2024-10-10 09:17:43 +09:00
Daniel Shebib
2d28e6803c typo 2024-10-06 07:40:56 -05:00
Daniel Shebib
7155404eb5 format whitespace 2024-10-05 18:46:26 -05:00
Daniel Shebib
252fb59bf9 Encase tests in When() 2024-10-05 18:46:26 -05:00
Kubernetes Prow Robot
d770dd695a Merge pull request #121888 from SD-13/e2e-gomega-be-true-or-false
Enhance boolean assertions when fail
2024-08-20 04:24:42 -07:00
Sujay
223aedcf6b enhance boolean assertions 2024-07-31 15:58:15 +00:00
Kubernetes Prow Robot
638128e74f Merge pull request #119019 from gjkim42/add-e2e-node-test-restarting-the-kubelet
Add node serial e2e tests that simulate the kubelet restart
2024-07-23 18:01:36 -07:00
Kubernetes Prow Robot
fa4b8f32ac Merge pull request #125935 from gjkim42/fix-125880
Terminate restartable init containers ignoring not-started containers
2024-07-23 15:45:11 -07:00
Gunju Kim
45a243e102 Add node serial e2e tests that simulate the kubelet restart
This adds node e2e tests to make sure a completed init container is not
restarted due to the kubelet restart.
2024-07-19 21:18:34 +09:00
Davanum Srinivas
f6836df520 [e2e-node] Cleanup pods after the test runs
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-07-09 16:53:28 -04:00
Gunju Kim
a03affab78 Terminate restartable init containers ignoring not-started containers
This ensures that the restartable init containers receive a termination
signal even if there are any not-started restartable init containers, by
ignoring the not-running containers.
2024-07-10 05:50:51 +09:00
Matthias Bertschy
367e8c5578 ignore starting order in RunTogether, add another that does
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2024-06-02 22:00:40 +02:00
Gunju Kim
65b9e560ce e2e: Increase preStop hook delay to deflake the test
This delays the preStop hook to allow sufficient time for the readiness
probe to be executed.
2024-05-23 21:31:02 +09:00
Maciej Szulik
ceb0387e39 Update PodSecurityLevel used during tests 2024-05-15 16:50:30 +02:00
Matthias Bertschy
18f9a08463 add coverage tests for probes behavior
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2024-05-07 07:18:27 +02:00
Ed Bartosh
6ecf0da1a5 node_e2e: refactor RunTogether function 2024-05-02 13:41:47 +03:00
Matthias Bertschy
f7ea5f3fe1 e2e lifecycle: increase delay for restartable init containers
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2024-05-01 22:12:04 +02:00
Matthias Bertschy
851d149a88 e2e lifecycle: use millisecond resolution for logs
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2024-05-01 18:27:10 +02:00
Ed Bartosh
e4c6adacf0 Revert "add coverage tests for probes behavior"
This reverts commit 9be9832184.
2024-04-24 20:56:46 +03:00
Matthias Bertschy
9be9832184 add coverage tests for probes behavior
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2024-03-27 22:31:47 +01:00
Gunju Kim
1cd1092dd9 Remove NodeAlphaFeature label from sidecar e2e tests 2023-11-06 19:50:05 +09:00
Patrick Ohly
f2cfbf44b1 e2e: use framework labels
This changes the text registration so that tags for which the framework has a
dedicated API (features, feature gates, slow, serial, etc.) those APIs are
used.

Arbitrary, custom tags are still left in place for now.
2023-11-01 15:17:34 +01:00
Kubernetes Prow Robot
ac6f707155 Merge pull request #120620 from tzneal/sidecar-termination-ordering
sidecars: terminate sidecars after main containers
2023-10-31 19:16:11 +01:00
Todd Neal
7bcc98c46b sidecars: terminate sidecars after main containers
Sidecars should terminate:
- after all main containers have exited
- serialized and in reverse order
2023-10-17 19:07:21 -05:00
Gunju Kim
ca6fda05ce Restart containers in right order after the podSandboxChanged
This is a workaround for the issue that the kubelet cannot differentiate
the container statuses of the previous podSandbox from the current one.

If the node is rebooted, all containers will be in the exited state and
the kubelet will try to recreate a new podSandbox. In this case, the
kubelet should not mistakenly think that the newly created podSandbox
has been initialized.
2023-10-17 22:11:31 +09:00
Patrick Ohly
0e8a1f1816 e2e: remove redundant spaces in test names
The spaces are redundant because Ginkgo will add them itself when concatenating
the different test name components. Upcoming change in the framework will
enforce that there are no such redundant spaces.
2023-09-29 08:30:57 +02:00
Kubernetes Prow Robot
160fe010f3 Merge pull request #120464 from gjkim42/deflake-container-lifecycle-e2e-test
e2e_node: Assign enough time to finish the postStart hook
2023-09-12 17:44:44 -07:00
Todd Neal
af151eeba2 specifically check that the pod was successful 2023-09-12 13:40:20 -05:00
Gunju Kim
1fb4eee94e Use container log instead of termination log
Since the termination log cannot be accessed until the container is
terminated, use the container log.
2023-09-11 22:55:09 +09:00
Gunju Kim
b468e4eb1c e2e_node: Assign enough time to finish the postStart hook
This deflakes the "Containers Lifecycle should not launch second
container before PostStart of the first container completed" test by
assigning enough time to finish the postStart hook.
2023-09-07 00:42:54 +09:00
Gunju Kim
63177db32c Add an e2e test for the pod sandbox changed scenario
This adds an e2e test to ensure that a pod should restart its containers
in right order after the pod sandbox is changed.
2023-09-01 00:13:47 +09:00
Todd Neal
e258228e4a use a buffer equivalent to grace period to eliminate test flakes
This modifies the test to wait up to 2x the grace period for the pod to
be removed.
2023-08-11 14:08:11 -05:00
Gunju Kim
3bf282652f Allow restartable init containers to have lifecycle 2023-07-18 08:12:24 +09:00
Gunju Kim
8fb5b6eb4c node-e2e: Add container lifecycle e2e tests for preStop hook
This ensures that the container's pre-stop hook is invoked if the
startup or liveness probe fails.
2023-07-10 08:55:48 +09:00
Gunju Kim
03c2217687 Sidecar: Add e2e tests
Co-authored-by: Sergey Kanzhelev <S.Kanzhelev@live.com>
2023-07-08 07:26:12 +09:00
Stanislav Laznicka
7f532891c9 e2e tests: set all PSa labels instead of just enforcing 2023-06-21 15:05:13 +02:00
Gunju Kim
f520f6fd06 Add Pod Termination e2e tests to test termination grace period seconds 2023-06-04 01:12:02 +08:00
Todd Neal
28c573358b test for init container restarts
Refactor tests and add an additional one to ensure init containers
don't restart upon regular container restart.
2023-04-28 13:13:55 -05:00