diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4c086dd..cf467c8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ on: branches: [main] env: - BINK_COMMIT: 3ddb9da3b6e33f5dadd48abdb15ed550bbfe4f31 + BINK_COMMIT: 61899a68d69b0de1114e165d24364bf5b8b6da2e permissions: {} @@ -172,6 +172,9 @@ jobs: sudo apt-get update sudo apt-get install -y podman + - name: Write v2 registries.conf + run: printf 'unqualified-search-registries = ["docker.io"]\n' | sudo tee /etc/containers/registries.conf + - name: Start podman socket run: systemctl --user start podman.socket diff --git a/Makefile b/Makefile index c9e5f7d..222a654 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ KUBECONFIG_BINK ?= ./kubeconfig-$(BINK_CLUSTER_NAME) ARTIFACTS ?= $(abspath _output/logs) DEFAULT_KUBE_MINOR ?= 1.35 BINK_NODE_DISK_IMAGE ?= ghcr.io/bootc-dev/bink/node:v$(DEFAULT_KUBE_MINOR)-fedora-44-disk +BINK_NODE_DISK_IMAGE_COMPOSEFS ?= $(BINK_NODE_DISK_IMAGE)-composefs BINK_LOCAL_REGISTRY_NODE_IMAGE ?= registry.cluster.local:5000/node # YEAR defines the year value used for substituting the YEAR placeholder in the boilerplate header. YEAR ?= $(shell date +%Y) @@ -69,6 +70,7 @@ e2e: ## Run e2e tests (requires: make deploy-bink). V=1 for verbose. RUN= cd test/e2e && KUBECONFIG=$(abspath $(KUBECONFIG_BINK)) BINK_CLUSTER_NAME=$(BINK_CLUSTER_NAME) \ $(if $(BINK_NODE_IMAGE),BINK_NODE_IMAGE=$(BINK_NODE_IMAGE)) \ BINK_NODE_DISK_IMAGE=$(BINK_NODE_DISK_IMAGE) \ + BINK_NODE_DISK_IMAGE_COMPOSEFS=$(BINK_NODE_DISK_IMAGE_COMPOSEFS) \ BINK_LOCAL_REGISTRY_NODE_IMAGE=$(BINK_LOCAL_REGISTRY_NODE_IMAGE) \ ARTIFACTS=$(ARTIFACTS) \ BINK_NODE_IMAGE_DIGEST=$$(skopeo inspect --tls-verify=false --format '{{.Digest}}' docker://localhost:5000/node:latest) \ diff --git a/test/e2e/bootcnode_test.go b/test/e2e/bootcnode_test.go index 2b57b22..ffb440c 100644 --- a/test/e2e/bootcnode_test.go +++ b/test/e2e/bootcnode_test.go @@ -91,16 +91,45 @@ func TestControllerMembership(t *testing.T) { }).WithTimeout(3 * time.Minute).Should(Succeed()) } +type diskImage struct { + name string + envVar string +} + +var diskImages = []diskImage{ + {name: "ostree", envVar: "BINK_NODE_DISK_IMAGE"}, + {name: "composefs", envVar: "BINK_NODE_DISK_IMAGE_COMPOSEFS"}, +} + +func forEachDiskImage(t *testing.T, fn func(t *testing.T, nodeOpts ...e2eutil.NodeOption)) { + t.Helper() + for _, di := range diskImages { + t.Run(di.name, func(t *testing.T) { + img := os.Getenv(di.envVar) + if img == "" { + t.Skipf("%s not set", di.envVar) + } + fn(t, e2eutil.WithNodeDiskImage(img)) + }) + } +} + // TestUpdateReboot provisions a worker node, creates a pool with the // original image, then updates the pool to a new image and verifies the // full update lifecycle: staging, reboot, and idle with the new image. func TestUpdateReboot(t *testing.T) { + forEachDiskImage(t, testUpdateReboot) +} + +func testUpdateReboot(t *testing.T, nodeOpts ...e2eutil.NodeOption) { + t.Helper() + g := NewWithT(t) g.SetDefaultEventuallyTimeout(pollTimeout) g.SetDefaultEventuallyPollingInterval(pollInterval) env := e2eutil.New(t) - nodeName := env.AddNode(t) + nodeName := env.AddNode(t, nodeOpts...) ctx := context.Background() diff --git a/test/e2e/e2eutil/env.go b/test/e2e/e2eutil/env.go index 77efd88..907eae0 100644 --- a/test/e2e/e2eutil/env.go +++ b/test/e2e/e2eutil/env.go @@ -117,9 +117,10 @@ func New(t *testing.T) *Env { type NodeOption func(*nodeConfig) type nodeConfig struct { - memory int - labels map[string]string - targetImgRef string + memory int + labels map[string]string + targetImgRef string + nodeDiskImage string } // WithMemory sets the VM memory in MB for the node. @@ -140,6 +141,14 @@ func WithLabel(key, value string) NodeOption { } } +// WithNodeDiskImage sets the VM disk image passed as --node-image +// to bink node add. +func WithNodeDiskImage(img string) NodeOption { + return func(c *nodeConfig) { + c.nodeDiskImage = img + } +} + // WithTargetImgRef sets the target image reference for the node, // passed as --target-imgref to bink node add. Overrides the automatic // default that AddNode applies when registry metadata is available. @@ -178,8 +187,12 @@ func (e *Env) AddNode(t *testing.T, opts ...NodeOption) string { if cfg.memory > 0 { args = append(args, "--memory", fmt.Sprintf("%d", cfg.memory)) } - if img := os.Getenv("BINK_NODE_DISK_IMAGE"); img != "" { - args = append(args, "--node-image", img) + diskImage := cfg.nodeDiskImage + if diskImage == "" { + diskImage = os.Getenv("BINK_NODE_DISK_IMAGE") + } + if diskImage != "" { + args = append(args, "--node-image", diskImage) } args = append(args, "--target-imgref", cfg.targetImgRef) t.Logf("Adding node %q...", nodeName) @@ -289,6 +302,7 @@ func (e *Env) gatherLogs(t *testing.T) { // Panics if the result exceeds 63 characters (k8s label value limit). func sanitizeTestName(name string) string { name = strings.ToLower(name) + name = strings.ReplaceAll(name, "/", "-") if len(name) > 63 { panic(fmt.Sprintf("test name %q is %d characters (max 63)", name, len(name))) }