Merge pull request #6532 from egernst/image-param-for-ctr-stress
containerd-stress: introduce option for specifying image
This commit is contained in:
commit
e8a5a5443f
@ -52,6 +52,7 @@ var densityCommand = cli.Command{
|
|||||||
Duration: cliContext.GlobalDuration("duration"),
|
Duration: cliContext.GlobalDuration("duration"),
|
||||||
Concurrency: cliContext.GlobalInt("concurrent"),
|
Concurrency: cliContext.GlobalInt("concurrent"),
|
||||||
Exec: cliContext.GlobalBool("exec"),
|
Exec: cliContext.GlobalBool("exec"),
|
||||||
|
Image: cliContext.GlobalString("image"),
|
||||||
JSON: cliContext.GlobalBool("json"),
|
JSON: cliContext.GlobalBool("json"),
|
||||||
Metrics: cliContext.GlobalString("metrics"),
|
Metrics: cliContext.GlobalString("metrics"),
|
||||||
Snapshotter: cliContext.GlobalString("snapshotter"),
|
Snapshotter: cliContext.GlobalString("snapshotter"),
|
||||||
@ -65,8 +66,8 @@ var densityCommand = cli.Command{
|
|||||||
if err := cleanup(ctx, client); err != nil {
|
if err := cleanup(ctx, client); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logrus.Infof("pulling %s", imageName)
|
logrus.Infof("pulling %s", config.Image)
|
||||||
image, err := client.Pull(ctx, imageName, containerd.WithPullUnpack, containerd.WithPullSnapshotter(config.Snapshotter))
|
image, err := client.Pull(ctx, config.Image, containerd.WithPullUnpack, containerd.WithPullSnapshotter(config.Snapshotter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@ import (
|
|||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
const imageName = "docker.io/library/alpine:latest"
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ct metrics.LabeledTimer
|
ct metrics.LabeledTimer
|
||||||
execTimer metrics.LabeledTimer
|
execTimer metrics.LabeledTimer
|
||||||
@ -136,6 +134,11 @@ func main() {
|
|||||||
Name: "exec",
|
Name: "exec",
|
||||||
Usage: "add execs to the stress tests",
|
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{
|
cli.BoolFlag{
|
||||||
Name: "json,j",
|
Name: "json,j",
|
||||||
Usage: "output results in json format",
|
Usage: "output results in json format",
|
||||||
@ -173,6 +176,7 @@ func main() {
|
|||||||
Duration: context.GlobalDuration("duration"),
|
Duration: context.GlobalDuration("duration"),
|
||||||
Concurrency: context.GlobalInt("concurrent"),
|
Concurrency: context.GlobalInt("concurrent"),
|
||||||
Exec: context.GlobalBool("exec"),
|
Exec: context.GlobalBool("exec"),
|
||||||
|
Image: context.GlobalString("image"),
|
||||||
JSON: context.GlobalBool("json"),
|
JSON: context.GlobalBool("json"),
|
||||||
Metrics: context.GlobalString("metrics"),
|
Metrics: context.GlobalString("metrics"),
|
||||||
Runtime: context.GlobalString("runtime"),
|
Runtime: context.GlobalString("runtime"),
|
||||||
@ -194,6 +198,7 @@ type config struct {
|
|||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
Address string
|
Address string
|
||||||
Exec bool
|
Exec bool
|
||||||
|
Image string
|
||||||
JSON bool
|
JSON bool
|
||||||
Metrics string
|
Metrics string
|
||||||
Runtime string
|
Runtime string
|
||||||
@ -228,8 +233,8 @@ func test(c config) error {
|
|||||||
if err := cleanup(ctx, client); err != nil {
|
if err := cleanup(ctx, client); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logrus.Infof("pulling %s", imageName)
|
logrus.Infof("pulling %s", c.Image)
|
||||||
image, err := client.Pull(ctx, imageName, containerd.WithPullUnpack, containerd.WithPullSnapshotter(c.Snapshotter))
|
image, err := client.Pull(ctx, c.Image, containerd.WithPullUnpack, containerd.WithPullSnapshotter(c.Snapshotter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user