Skip to content

Commit db506ce

Browse files
cmainasurunc-bot[bot]
authored andcommitted
feat(libcontainer): Add tests for libcontainer in CI
Since we currently have 2 versions of urunc, we need to test both urunc native way and the libcontainer one for the setup of the monitor's execution environment setup To do that, repeat the vm_tests and kind test by simply editing the urunc configuration enabling libcontainer. We might want to check how to improve this in the future. PR: #982 Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com> Reviewed-by: Anastassios Nanos <ananos@nubificus.co.uk> Approved-by: Anastassios Nanos <ananos@nubificus.co.uk>
1 parent 7e1dbd4 commit db506ce

3 files changed

Lines changed: 72 additions & 8 deletions

File tree

.github/workflows/kind_test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,48 @@ jobs:
335335
grep "Hello world" /tmp/logs.txt
336336
kubectl describe pod hello-spt-rumprun-block || true
337337
338+
# Re-run the hello-world deployment with urunc's libcontainer runtime
339+
# enabled, reusing the same kind cluster and urunc install.
340+
- name: Deploy and verify with libcontainer
341+
run: |
342+
docker exec urunc-test-control-plane bash -c '
343+
cat >> /etc/urunc/config.toml <<EOF
344+
345+
[runtime]
346+
libcontainer = true
347+
EOF
348+
'
349+
cat <<EOF | kubectl apply -f -
350+
apiVersion: v1
351+
kind: Pod
352+
metadata:
353+
name: hello-libcontainer
354+
labels:
355+
run: hello-libcontainer
356+
spec:
357+
runtimeClassName: urunc
358+
restartPolicy: Never
359+
containers:
360+
- name: hello-libcontainer
361+
image: harbor.nbfc.io/nubificus/urunc/hello-spt-rumprun-block:latest
362+
imagePullPolicy: Always
363+
ports:
364+
- containerPort: 80
365+
protocol: TCP
366+
resources:
367+
requests:
368+
cpu: 10m
369+
EOF
370+
kubectl wait --for=condition=Succeeded pod/hello-libcontainer --timeout=180s || true
371+
kubectl logs hello-libcontainer | tee /tmp/logs-libcontainer.txt
372+
if ! grep "Hello world" /tmp/logs-libcontainer.txt; then
373+
echo "=== LOGS (libcontainer) ==="
374+
cat /tmp/logs-libcontainer.txt
375+
kubectl describe pod hello-libcontainer || true
376+
exit 1
377+
fi
378+
kubectl describe pod hello-libcontainer || true
379+
338380
- name: Debug pod failure
339381
if: failure()
340382
run: |

.github/workflows/vm_test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,24 @@ jobs:
376376
sudo -E env "PATH=$PATH" "GOROOT=$GOROOT" make ${{ matrix.test }}
377377
fi
378378
379+
# Re-run the same suite with urunc's libcontainer runtime enabled,
380+
# changing the configuration.
381+
- name: Run ${{ matrix.test }} with libcontainer
382+
id: test_libcontainer
383+
run: |
384+
sudo tee -a /etc/urunc/config.toml > /dev/null <<'EOF'
385+
386+
[runtime]
387+
libcontainer = true
388+
EOF
389+
export GOROOT=$(go env GOROOT)
390+
export PATH="$GOROOT/bin:$PATH"
391+
if [ "${{ matrix.arch }}" = "arm64" ]; then
392+
sudo -E env "PATH=$PATH" "GOROOT=$GOROOT" make ${{ matrix.test }}_Spt
393+
else
394+
sudo -E env "PATH=$PATH" "GOROOT=$GOROOT" make ${{ matrix.test }} SKIP="Firecracker-unikraft-httpreply-static-net"
395+
fi
396+
379397
- name: Dump urunc logs on failure
380398
if: failure()
381399
run: |

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ CGO := CGO_ENABLED=1
5252
NOCGO := CGO_ENABLED=0
5353
TEST_FLAGS := "-count=1"
5454
TEST_OPTS += -timeout 20m
55+
# Skip the execution of a test
56+
# make test_crictl SKIP="Firecracker-unikraft-httpreply-static-net"
57+
# make test_crictl SKIP="Crictl.*(CaseA|CaseB)"
58+
GINKGO_SKIP := $(if $(SKIP),--ginkgo.skip="$(SKIP)")
5559
BUILD_TAGS ?= netgo osusergo
5660

5761
# Linking variables
@@ -273,56 +277,56 @@ test_unikernels:
273277
.PHONY: test_nerdctl
274278
test_nerdctl:
275279
@echo "Testing nerdctl"
276-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Nerdctl"
280+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Nerdctl" $(GINKGO_SKIP)
277281
@echo " "
278282

279283
## test_ctr Run all end-to-end tests with ctr
280284
.PHONY: test_ctr
281285
test_ctr:
282286
@echo "Testing ctr"
283-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Ctr"
287+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Ctr" $(GINKGO_SKIP)
284288
@echo " "
285289

286290
## test_crictl Run all end-to-end tests with crictl
287291
.PHONY: test_crictl
288292
test_crictl:
289293
@echo "Testing crictl"
290-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Crictl"
294+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Crictl" $(GINKGO_SKIP)
291295
@echo " "
292296

293297
## test_docker Run all end-to-end tests with docker
294298
.PHONY: test_docker
295299
test_docker:
296300
@echo "Testing docker"
297-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Docker"
301+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -run TestE2E -v --ginkgo.v --ginkgo.focus="Docker" $(GINKGO_SKIP)
298302
@echo " "
299303

300304
## test_nerdctl_[pattern] Run all end-to-end tests with nerdctl that match pattern
301305
.PHONY: test_nerdctl_%
302306
test_nerdctl_%:
303307
@echo "Testing nerdctl"
304-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Nerdctl.*$*"
308+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Nerdctl.*$*" $(GINKGO_SKIP)
305309
@echo " "
306310

307311
## test_ctr_[pattern] Run all end-to-end tests with ctr that match pattern
308312
.PHONY: test_ctr_%
309313
test_ctr_%:
310314
@echo "Testing ctr"
311-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Ctr.*$*"
315+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Ctr.*$*" $(GINKGO_SKIP)
312316
@echo " "
313317

314318
## test_crictl_[pattern] Run all end-to-end tests with crictl that match pattern
315319
.PHONY: test_crictl_%
316320
test_crictl_%:
317321
@echo "Testing crictl"
318-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Crictl.*$*"
322+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Crictl.*$*" $(GINKGO_SKIP)
319323
@echo " "
320324

321325
## test_docker_[pattern] Run all end-to-end tests with docker that match pattern
322326
.PHONY: test_docker_%
323327
test_docker_%:
324328
@echo "Testing docker"
325-
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Docker.*$*"
329+
@GOFLAGS=$(TEST_FLAGS) $(GO) test $(TEST_OPTS) ./tests/e2e -v --ginkgo.v -run TestE2E --ginkgo.focus="Docker.*$*" $(GINKGO_SKIP)
326330
@echo " "
327331

328332
## help Show this help message

0 commit comments

Comments
 (0)