Merge pull request #6532 from egernst/image-param-for-ctr-stress

containerd-stress: introduce option for specifying image
This commit is contained in:
Michael Crosby 2022-02-09 11:44:25 -05:00 committed by GitHub
commit e8a5a5443f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -52,6 +52,7 @@ var densityCommand = cli.Command{
Duration: cliContext.GlobalDuration("duration"),
Concurrency: cliContext.GlobalInt("concurrent"),
Exec: cliContext.GlobalBool("exec"),
Image: cliContext.GlobalString("image"),
JSON: cliContext.GlobalBool("json"),
Metrics: cliContext.GlobalString("metrics"),
Snapshotter: cliContext.GlobalString("snapshotter"),
@ -65,8 +66,8 @@ var densityCommand = cli.Command{
if err := cleanup(ctx, client); err != nil {
return err
}
logrus.Infof("pulling %s", imageName)
image, err := client.Pull(ctx, imageName, containerd.WithPullUnpack, containerd.WithPullSnapshotter(config.Snapshotter))
logrus.Infof("pulling %s", config.Image)
image, err := client.Pull(ctx, config.Image, containerd.WithPullUnpack, containerd.WithPullSnapshotter(config.Snapshotter))
if err != nil {
return err
}

View File

@ -36,8 +36,6 @@ import (
"github.com/urfave/cli"
)
const imageName = "docker.io/library/alpine:latest"
var (
ct metrics.LabeledTimer
execTimer metrics.LabeledTimer
@ -136,6 +134,11 @@ func main() {
Name: "exec",
Usage: "add execs to the stress tests",
},
cli.StringFlag{
Name: "image,i",
Value: "docker.io/library/alpine:latest",
Usage: "image to be utilized for testing",
},
cli.BoolFlag{
Name: "json,j",
Usage: "output results in json format",
@ -173,6 +176,7 @@ func main() {
Duration: context.GlobalDuration("duration"),
Concurrency: context.GlobalInt("concurrent"),
Exec: context.GlobalBool("exec"),
Image: context.GlobalString("image"),
JSON: context.GlobalBool("json"),
Metrics: context.GlobalString("metrics"),
Runtime: context.GlobalString("runtime"),
@ -194,6 +198,7 @@ type config struct {
Duration time.Duration
Address string
Exec bool
Image string
JSON bool
Metrics string
Runtime string
@ -228,8 +233,8 @@ func test(c config) error {
if err := cleanup(ctx, client); err != nil {
return err
}
logrus.Infof("pulling %s", imageName)
image, err := client.Pull(ctx, imageName, containerd.WithPullUnpack, containerd.WithPullSnapshotter(c.Snapshotter))
logrus.Infof("pulling %s", c.Image)
image, err := client.Pull(ctx, c.Image, containerd.WithPullUnpack, containerd.WithPullSnapshotter(c.Snapshotter))
if err != nil {
return err
}