Skip to content

Commit 24b3e57

Browse files
e2e: add composefs update-reboot test
Factor the TestUpdateReboot body into a shared testUpdateReboot helper and add TestUpdateRebootComposefs, which boots the worker node from a composefs disk image and runs the same update lifecycle. A new WithNodeDiskImage NodeOption lets tests override the VM disk image passed as --node-image to bink node add. The Makefile and CI workflow pass BINK_NODE_DISK_IMAGE_COMPOSEFS through to the test binary; the test skips when the variable is unset. Closes: #74 Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
1 parent 874e2af commit 24b3e57

4 files changed

Lines changed: 40 additions & 7 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
run: make gather-bink
153153

154154
- name: Run e2e tests
155-
run: make e2e V=1
155+
run: make e2e V=1 BINK_NODE_DISK_IMAGE_COMPOSEFS=ghcr.io/bootc-dev/bink/node:v1.35-fedora-44-disk-composefs
156156

157157
- name: Upload logs
158158
if: always()

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ BINK_CLUSTER_NAME ?= e2e
77
KUBECONFIG_BINK ?= ./kubeconfig-$(BINK_CLUSTER_NAME)
88
ARTIFACTS ?= $(abspath _output/logs)
99
BINK_NODE_DISK_IMAGE ?= ghcr.io/bootc-dev/bink/node:v1.35-fedora-44-disk
10+
BINK_NODE_DISK_IMAGE_COMPOSEFS ?=
1011
BINK_LOCAL_REGISTRY_NODE_IMAGE ?= registry.cluster.local:5000/node
1112
# YEAR defines the year value used for substituting the YEAR placeholder in the boilerplate header.
1213
YEAR ?= $(shell date +%Y)
@@ -65,6 +66,7 @@ e2e: ## Run e2e tests (requires: make deploy-bink). V=1 for verbose. RUN=<regex>
6566
cd test/e2e && KUBECONFIG=$(abspath $(KUBECONFIG_BINK)) BINK_CLUSTER_NAME=$(BINK_CLUSTER_NAME) \
6667
$(if $(BINK_NODE_IMAGE),BINK_NODE_IMAGE=$(BINK_NODE_IMAGE)) \
6768
BINK_NODE_DISK_IMAGE=$(BINK_NODE_DISK_IMAGE) \
69+
$(if $(BINK_NODE_DISK_IMAGE_COMPOSEFS),BINK_NODE_DISK_IMAGE_COMPOSEFS=$(BINK_NODE_DISK_IMAGE_COMPOSEFS)) \
6870
BINK_LOCAL_REGISTRY_NODE_IMAGE=$(BINK_LOCAL_REGISTRY_NODE_IMAGE) \
6971
ARTIFACTS=$(ARTIFACTS) \
7072
BINK_NODE_IMAGE_DIGEST=$$(skopeo inspect --tls-verify=false --format '{{.Digest}}' docker://localhost:5000/node:latest) \

test/e2e/bootcnode_test.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,29 @@ func TestControllerMembership(t *testing.T) {
9595
// original image, then updates the pool to a new image and verifies the
9696
// full update lifecycle: staging, reboot, and idle with the new image.
9797
func TestUpdateReboot(t *testing.T) {
98+
testUpdateReboot(t)
99+
}
100+
101+
// TestUpdateRebootComposefs runs the same update lifecycle as
102+
// TestUpdateReboot but boots the worker node from a composefs disk
103+
// image. Skipped when BINK_NODE_DISK_IMAGE_COMPOSEFS is not set.
104+
func TestUpdateRebootComposefs(t *testing.T) {
105+
img := os.Getenv("BINK_NODE_DISK_IMAGE_COMPOSEFS")
106+
if img == "" {
107+
t.Skip("BINK_NODE_DISK_IMAGE_COMPOSEFS not set")
108+
}
109+
testUpdateReboot(t, e2eutil.WithNodeDiskImage(img))
110+
}
111+
112+
func testUpdateReboot(t *testing.T, nodeOpts ...e2eutil.NodeOption) {
113+
t.Helper()
114+
98115
g := NewWithT(t)
99116
g.SetDefaultEventuallyTimeout(pollTimeout)
100117
g.SetDefaultEventuallyPollingInterval(pollInterval)
101118

102119
env := e2eutil.New(t)
103-
nodeName := env.AddNode(t)
120+
nodeName := env.AddNode(t, nodeOpts...)
104121

105122
ctx := context.Background()
106123

test/e2e/e2eutil/env.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ func New(t *testing.T) *Env {
117117
type NodeOption func(*nodeConfig)
118118

119119
type nodeConfig struct {
120-
memory int
121-
labels map[string]string
122-
targetImgRef string
120+
memory int
121+
labels map[string]string
122+
targetImgRef string
123+
nodeDiskImage string
123124
}
124125

125126
// WithMemory sets the VM memory in MB for the node.
@@ -140,6 +141,15 @@ func WithLabel(key, value string) NodeOption {
140141
}
141142
}
142143

144+
// WithNodeDiskImage overrides the VM disk image passed as --node-image
145+
// to bink node add. When unset, AddNode falls back to the
146+
// BINK_NODE_DISK_IMAGE environment variable.
147+
func WithNodeDiskImage(img string) NodeOption {
148+
return func(c *nodeConfig) {
149+
c.nodeDiskImage = img
150+
}
151+
}
152+
143153
// WithTargetImgRef sets the target image reference for the node,
144154
// passed as --target-imgref to bink node add. Overrides the automatic
145155
// default that AddNode applies when registry metadata is available.
@@ -178,8 +188,12 @@ func (e *Env) AddNode(t *testing.T, opts ...NodeOption) string {
178188
if cfg.memory > 0 {
179189
args = append(args, "--memory", fmt.Sprintf("%d", cfg.memory))
180190
}
181-
if img := os.Getenv("BINK_NODE_DISK_IMAGE"); img != "" {
182-
args = append(args, "--node-image", img)
191+
diskImage := cfg.nodeDiskImage
192+
if diskImage == "" {
193+
diskImage = os.Getenv("BINK_NODE_DISK_IMAGE")
194+
}
195+
if diskImage != "" {
196+
args = append(args, "--node-image", diskImage)
183197
}
184198
args = append(args, "--target-imgref", cfg.targetImgRef)
185199
t.Logf("Adding node %q...", nodeName)

0 commit comments

Comments
 (0)