Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e-test: grep for container id in nydus test #1623

Merged
Merged
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
7 changes: 4 additions & 3 deletions test/e2e/assessment_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ func watchImagePullTime(ctx context.Context, client klient.Client, caaPod v1.Pod
// not
// <date time> 15:18:43 [adaptor/proxy] CreateContainer: calling PullImage for <image> before CreateContainer (cid: "<cid>")
// was output
func IsPulledWithNydusSnapshotter(ctx context.Context, t *testing.T, client klient.Client, nodeName string) (bool, error) {
func IsPulledWithNydusSnapshotter(ctx context.Context, t *testing.T, client klient.Client, nodeName string, containerId string) (bool, error) {
var podlist v1.PodList

nydusSnapshotterPullRegex, err := regexp.Compile(`.*mount_point:/run/kata-containers.*driver:image_guest_pull.*$`)
nydusSnapshotterPullRegex, err := regexp.Compile(`.*mount_point:/run/kata-containers.*` + containerId + `.*driver:image_guest_pull.*$`)
if err != nil {
return false, err
}
legacyPullRegex, err := regexp.Compile(`.*CreateContainer: calling PullImage.*before CreateContainer.*$`)

legacyPullRegex, err := regexp.Compile(`.*CreateContainer: calling PullImage.*before CreateContainer.*` + containerId + `.*$`)
if err != nil {
return false, err
}
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/assessment_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,14 @@ func (tc *testCase) run() {
t.Fatal(err)
}
log.Tracef("Test pod running on node %s", nodeName)
usedNydusSnapshotter, err := IsPulledWithNydusSnapshotter(ctx, t, client, nodeName)

containerId := tc.pod.Status.ContainerStatuses[0].ContainerID
containerId, found := strings.CutPrefix(containerId, "containerd://")
if !found {
t.Fatal("unexpected container id format")
}

usedNydusSnapshotter, err := IsPulledWithNydusSnapshotter(ctx, t, client, nodeName, containerId)
if err != nil {
t.Fatal(err)
}
Expand Down
Loading