Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [main]

env:
BINK_COMMIT: 3ddb9da3b6e33f5dadd48abdb15ed550bbfe4f31
BINK_COMMIT: 61899a68d69b0de1114e165d24364bf5b8b6da2e

permissions: {}

Expand Down Expand Up @@ -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

Comment on lines +175 to +177

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 should be a separate commit ideally with its own rationale. And a smaller version of that rationale as a comment here.

- name: Start podman socket
run: systemctl --user start podman.socket

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -69,6 +70,7 @@ e2e: ## Run e2e tests (requires: make deploy-bink). V=1 for verbose. RUN=<regex>
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) \
Expand Down
31 changes: 30 additions & 1 deletion test/e2e/bootcnode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
24 changes: 19 additions & 5 deletions test/e2e/e2eutil/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)))
}
Expand Down
Loading