diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index cc11e954..ff20fb5d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -101,3 +101,6 @@ jobs: - name: Test Max Checkpoint Size run: sudo -E bats -f "test_max_checkpoint_size" ./test/run_tests.bats + + - name: Test orphan retention + run: sudo -E bats -f "test_orphan_retention_policy" ./test/run_tests.bats diff --git a/test/run_tests.bats b/test/run_tests.bats index 0720e488..389f0ae2 100755 --- a/test/run_tests.bats +++ b/test/run_tests.bats @@ -82,3 +82,14 @@ function teardown() { log_and_run ls -la "$CHECKPOINT_DIR" [ "$status" -eq 0 ] } + +@test "test_orphan_retention_policy" { + log_and_run kubectl apply -f ./test/test_orphan_checkpointrestoreoperator.yaml + [ "$status" -eq 0 ] + log_and_run ./test/generate_checkpoint_tar.sh + [ "$status" -eq 0 ] + log_and_run ./test/wait_for_checkpoint_reduction.sh 0 + [ "$status" -eq 0 ] + log_and_run ls -la "$CHECKPOINT_DIR" + [ "$status" -eq 0 ] +} diff --git a/test/test_orphan_checkpointrestoreoperator.yaml b/test/test_orphan_checkpointrestoreoperator.yaml new file mode 100644 index 00000000..ac868389 --- /dev/null +++ b/test/test_orphan_checkpointrestoreoperator.yaml @@ -0,0 +1,20 @@ +apiVersion: criu.org/v1 +kind: CheckpointRestoreOperator +metadata: + labels: + app.kubernetes.io/name: checkpointrestoreoperator + app.kubernetes.io/instance: checkpointrestoreoperator-sample + app.kubernetes.io/part-of: checkpoint-restore-operator + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: checkpoint-restore-operator + name: checkpointrestoreoperator-sample +spec: + checkpointDirectory: /var/lib/kubelet/checkpoints + applyPoliciesImmediately: true + globalPolicy: + retainOrphan: true + containerPolicies: + - namespace: namespace + pod: podname + container: containername + retainOrphan: false