Skip to content

e2e: add daemon-recovery, reboot-timeout, and operator-upgrade tests - #174

Open
ptalgulk01 wants to merge 1 commit into
bootc-dev:mainfrom
ptalgulk01:e2e-remaining-tests
Open

ptalgulk01 wants to merge 1 commit into
bootc-dev:mainfrom
ptalgulk01:e2e-remaining-tests

Conversation

@ptalgulk01

Copy link
Copy Markdown
Collaborator

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.

Signed-off-by: Prachiti Talgulkar <ptalgulk01@users.noreply.github.com>
Comment thread test/e2e/e2eutil/env.go

container := "k8s-" + e.clusterName + "-" + nodeName
t.Logf("Powering off node %q (podman stop %s)", nodeName, container)
cmd := exec.Command("podman", "stop", container)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function can be reused also in order existing tests. Can you please move the refactoring into a separate commit?

Comment on lines +1026 to +1052
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")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are start having a lot of helper functions, maybe it will be better to move them under test/util/

Comment thread Makefile
# 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would we make bink working with this image? do we need to change the firmware?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned for the test, I would keep this as separate PR once bink is able to work with both

@alicefr

alicefr commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

@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

@alicefr

alicefr commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

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?

@alicefr

alicefr commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants