Skip to content

Commit 8731888

Browse files
author
Kazuyoshi Kato
committed
Re-enable CRIU tests by not using overlayfs snapshotter
While the issue hasn't been fixed in the kernel yet, we can workaround the issue by not using overlayfs snapshotter. The newly added step runs all tests that match /TestCheckpoint/. So, TestCRWithImagePath has been renamed to match the regexp. Fixes #3930. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent b520428 commit 8731888

3 files changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,22 @@ jobs:
322322
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR TESTFLAGS_PARALLEL=1 make integration EXTRA_TESTFLAGS=-no-criu
323323
working-directory: src/github.com/containerd/containerd
324324

325+
# CRIU wouldn't work with overlay snapshotter yet.
326+
# See https://github.com/containerd/containerd/pull/4708#issuecomment-724322294.
327+
- name: CRIU Integration
328+
env:
329+
GOPROXY: direct
330+
TEST_RUNTIME: ${{ matrix.runtime }}
331+
RUNC_FLAVOR: ${{ matrix.runc }}
332+
# crun doesn't have "checkpoint" command.
333+
if: ${{ matrix.runc == 'runc' }}
334+
run: |
335+
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY \
336+
TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR TESTFLAGS_PARALLEL=1 \
337+
TEST_SNAPSHOTTER=native \
338+
make integration EXTRA_TESTFLAGS='-run TestCheckpoint'
339+
working-directory: src/github.com/containerd/containerd
340+
325341
- name: CRI Integration Test
326342
env:
327343
TEST_RUNTIME: ${{ matrix.runtime }}

integration/client/client_test.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var (
5050
noCriu bool
5151
supportsCriu bool
5252
testNamespace = "testing"
53+
testSnapshotter = DefaultSnapshotter
5354
ctrdStdioFilePath string
5455

5556
ctrd = &daemon{}
@@ -132,11 +133,30 @@ func TestMain(m *testing.M) {
132133

133134
// allow comparison with containerd under test
134135
log.G(ctx).WithFields(logrus.Fields{
135-
"version": version.Version,
136-
"revision": version.Revision,
137-
"runtime": os.Getenv("TEST_RUNTIME"),
136+
"version": version.Version,
137+
"revision": version.Revision,
138+
"runtime": os.Getenv("TEST_RUNTIME"),
139+
"snapshotter": os.Getenv("TEST_SNAPSHOTTER"),
138140
}).Info("running tests against containerd")
139141

142+
snapshotter := DefaultSnapshotter
143+
if ss := os.Getenv("TEST_SNAPSHOTTER"); ss != "" {
144+
snapshotter = ss
145+
}
146+
147+
ns, ok := namespaces.Namespace(ctx)
148+
if !ok {
149+
fmt.Fprintln(os.Stderr, "error getting namespace")
150+
os.Exit(1)
151+
}
152+
err = client.NamespaceService().SetLabel(ctx, ns, defaults.DefaultSnapshotterNSLabel, snapshotter)
153+
if err != nil {
154+
fmt.Fprintf(os.Stderr, "error setting %s's default snapshotter as %s: %s\n", ns, snapshotter, err)
155+
os.Exit(1)
156+
}
157+
158+
testSnapshotter = snapshotter
159+
140160
// pull a seed image
141161
log.G(ctx).WithField("image", testImage).Info("start to pull seed image")
142162
if _, err = client.Pull(ctx, testImage, WithPullUnpack); err != nil {
@@ -285,7 +305,7 @@ func TestImagePullWithDiscardContent(t *testing.T) {
285305
t.Fatalf("there is no layers in the target image(parent: %v)", img.Target())
286306
}
287307
var (
288-
sn = client.SnapshotService("")
308+
sn = client.SnapshotService(testSnapshotter)
289309
chain []digest.Digest
290310
)
291311
for i, dgst := range layers {

integration/client/container_checkpoint_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func TestCheckpointLeaveRunning(t *testing.T) {
414414
<-statusC
415415
}
416416

417-
func TestCRWithImagePath(t *testing.T) {
417+
func TestCheckpointRestoreWithImagePath(t *testing.T) {
418418
if !supportsCriu {
419419
t.Skip("system does not have criu installed")
420420
}

0 commit comments

Comments
 (0)