Skip to content

Commit

Permalink
smoke: add basic nydusify copy test
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Song <yansong.ys@antgroup.com>
  • Loading branch information
imeoer committed Nov 2, 2023
1 parent d5a23ce commit 77d8913
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions smoke/tests/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func (i *ImageTestSuite) TestConvertImages() test.Generator {

image := i.prepareImage(i.T, scenario.GetString(paramImage))
return scenario.Str(), func(t *testing.T) {
i.TestConvertImage(t, *ctx, image)
i.TestConvertAndCopyImage(t, *ctx, image)
}
}
}

func (i *ImageTestSuite) TestConvertImage(t *testing.T, ctx tool.Context, source string) {
func (i *ImageTestSuite) TestConvertAndCopyImage(t *testing.T, ctx tool.Context, source string) {

// Prepare work directory
ctx.PrepareWorkDir(t)
Expand Down Expand Up @@ -119,6 +119,21 @@ func (i *ImageTestSuite) TestConvertImage(t *testing.T, ctx tool.Context, source
nydusifyPath, logLevel, source, target, ctx.Binary.Builder, ctx.Binary.Nydusd, filepath.Join(ctx.Env.WorkDir, "check"),
)
tool.RunWithoutOutput(t, checkCmd)

// Copy image
targetCopied := fmt.Sprintf("%s_copied", target)
copyCmd := fmt.Sprintf(
"%s %s copy --source %s --target %s --nydus-image %s --work-dir %s",
ctx.Binary.Nydusify, logLevel, target, targetCopied, ctx.Binary.Builder, ctx.Env.WorkDir,
)
tool.RunWithoutOutput(t, copyCmd)

// Check copied image
checkCmd = fmt.Sprintf(
"%s %s check --source %s --target %s --nydus-image %s --nydusd %s --work-dir %s",
nydusifyPath, logLevel, source, targetCopied, ctx.Binary.Builder, ctx.Binary.Nydusd, filepath.Join(ctx.Env.WorkDir, "check"),
)
tool.RunWithoutOutput(t, checkCmd)
}

func (i *ImageTestSuite) prepareImage(t *testing.T, image string) string {
Expand Down

0 comments on commit 77d8913

Please sign in to comment.