e2e: add daemon-recovery, reboot-timeout, and operator-upgrade tests - #174
ptalgulk01 wants to merge 1 commit into
Conversation
Signed-off-by: Prachiti Talgulkar <ptalgulk01@users.noreply.github.com>
|
|
||
| container := "k8s-" + e.clusterName + "-" + nodeName | ||
| t.Logf("Powering off node %q (podman stop %s)", nodeName, container) | ||
| cmd := exec.Command("podman", "stop", container) |
There was a problem hiding this comment.
You can also use bink node remove
| // CentOS Stream) and verifies the node upgrades across the distro boundary. | ||
| // Covers scenario 8 of #69. Skipped when the different-OS image is not seeded | ||
| // (run `make seed-different-os-image`). | ||
| func TestDifferentOSUpgrade(t *testing.T) { |
There was a problem hiding this comment.
Can we remove this test and enable when we have the bink support
|
|
||
| // expectNodeIdleOnDigest waits until the named node is Idle (no active update | ||
| // cycle) with the given booted image digest. | ||
| func expectNodeIdleOnDigest( |
There was a problem hiding this comment.
I think this function can be reused also in order existing tests. Can you please move the refactoring into a separate commit?
| patched := pool.DeepCopy() | ||
| patched.Spec.Image.Ref = updateRef | ||
| if patched.Spec.Rollout == nil { | ||
| patched.Spec.Rollout = &bootcv1alpha1.RolloutSpec{} | ||
| } | ||
| patched.Spec.Rollout.Paused = true | ||
| g.Expect(env.Client.Patch(ctx, patched, client.MergeFrom(pool))).To(Succeed()) | ||
| *pool = *patched | ||
|
|
||
| t.Logf("Patched pool to update image %s (paused)", updateRef) | ||
|
|
||
| // Phase 3: Wait until the node has staged the update but has not rebooted. | ||
| g.Eventually(func() (bootcv1alpha1.BootcNodeStatus, error) { | ||
| var bn bootcv1alpha1.BootcNode | ||
| err := env.Client.Get(ctx, client.ObjectKey{Name: nodeName}, &bn) | ||
| return bn.Status, err | ||
| }).WithTimeout(5*time.Minute).Should(And( | ||
| HaveField("Staged", And( | ||
| Not(BeNil()), | ||
| HaveField("ImageDigest", Equal(env.NodeImageUpdateDigest())), | ||
| )), | ||
| HaveField("Conditions", ContainElement(And( | ||
| HaveField("Type", bootcv1alpha1.NodeIdle), | ||
| HaveField("Status", metav1.ConditionFalse), | ||
| HaveField("Reason", bootcv1alpha1.NodeReasonStaged), | ||
| ))), | ||
| ), "expected node to stage the update before killing the daemon") |
There was a problem hiding this comment.
This can be also refactored in a function and unified with the previous test you implemented in #152
| // (both the controller Deployment and the DaemonSet). Kubernetes recreates | ||
| // them as it would after an image bump. It waits for a fresh controller pod and | ||
| // a fresh daemon pod on the given node to be Running before returning. | ||
| func restartOperator(t *testing.T, env *e2eutil.Env, ctx context.Context, nodeName string) { |
There was a problem hiding this comment.
we are start having a lot of helper functions, maybe it will be better to move them under test/util/
| # Base image for the cross-distro upgrade test. Deliberately a different OS | ||
| # lineage than the Fedora-based node image so the test exercises switching | ||
| # across distributions (CentOS Stream vs Fedora). | ||
| DIFFERENT_OS_IMAGE ?= quay.io/centos-bootc/centos-bootc:stream10 |
There was a problem hiding this comment.
How would we make bink working with this image? do we need to change the firmware?
There was a problem hiding this comment.
As mentioned for the test, I would keep this as separate PR once bink is able to work with both
|
@ptalgulk01 thanks for the work. Could you please try to split the PR into multiple commits and add a short description as commit body? Thanks |
|
The test suite is also becoming quite large and time consuming, we should prioritizing also #77 over new tests in the future. Do you have some cycles to take a look? |
|
Probably, you will also need to increase the overall timeout for the test suite https://github.com/bootc-dev/bootc-operator/blob/main/Makefile#L106 |
e2e: add daemon-recovery, reboot-timeout, and operator-upgrade tests
Automates scenarios 4, 5, and 9 from #69, plus scaffolding for the
cross-distro upgrade (#8), which is skipped because a different-OS
image does not boot under bink (see in-code TODO).
Adds env.PowerOffNode and different-OS image plumbing, and a
seed-different-os-image Makefile target.