Skip to content

Commit

Permalink
Move TestSnapshotterStartup to startup_test.go
Browse files Browse the repository at this point in the history
This change consolidates snapshotter startup tests into a single file
instead of putting it in pull_test.go

Signed-off-by: Kern Walster <[email protected]>
  • Loading branch information
Kern-- committed Oct 7, 2024
1 parent d5fb19a commit 97bb872
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
24 changes: 0 additions & 24 deletions integration/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,6 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

// TestSnapshotterStartup tests to run containerd + snapshotter and check plugin is
// recognized by containerd
func TestSnapshotterStartup(t *testing.T) {
t.Parallel()
sh, done := newSnapshotterBaseShell(t)
defer done()
rebootContainerd(t, sh, "", "")
found := false
err := sh.ForEach(shell.C("ctr", "plugin", "ls"), func(l string) bool {
info := strings.Fields(l)
if len(info) < 4 {
t.Fatalf("malformed plugin info: %v", info)
}
if info[0] == "io.containerd.snapshotter.v1" && info[1] == "soci" && info[3] == "ok" {
found = true
return false
}
return true
})
if err != nil || !found {
t.Fatalf("failed to get soci snapshotter status using ctr plugin ls: %v", err)
}
}

// TestOptimizeConsistentSociArtifact tests if the Soci artifact is produced consistently across runs.
// This test does the following:
// 1. Generate Soci artifact
Expand Down
25 changes: 25 additions & 0 deletions integration/startup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,36 @@ package integration

import (
"regexp"
"strings"
"testing"

shell "github.com/awslabs/soci-snapshotter/util/dockershell"
)

// TestSnapshotterStartup tests to run containerd + snapshotter and check plugin is
// recognized by containerd
func TestSnapshotterStartup(t *testing.T) {
t.Parallel()
sh, done := newSnapshotterBaseShell(t)
defer done()
rebootContainerd(t, sh, "", "")
found := false
err := sh.ForEach(shell.C("ctr", "plugin", "ls"), func(l string) bool {
info := strings.Fields(l)
if len(info) < 4 {
t.Fatalf("malformed plugin info: %v", info)
}
if info[0] == "io.containerd.snapshotter.v1" && info[1] == "soci" && info[3] == "ok" {
found = true
return false
}
return true
})
if err != nil || !found {
t.Fatalf("failed to get soci snapshotter status using ctr plugin ls: %v", err)
}
}

// TestSnapshotterSystemdStartup tests that SOCI interacts with systemd socket activation correctly.
// It verifies that SOCI works when using socket activation and that SOCI starts up correctly when
// it is configured for socket activation, but it launches directly.
Expand Down

0 comments on commit 97bb872

Please sign in to comment.