mirror of
https://github.com/containers/podman.git
synced 2025-08-02 17:22:30 +08:00
benchmarks: push/pull
Polish the push and pull benchmarks. In particular, make sure to not be network bound during these benchmarks by running a local registry and pushing a local image that can later on be pulled. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -31,10 +31,31 @@ type Registry struct {
|
||||
running bool
|
||||
}
|
||||
|
||||
// Options allows for customizing a registry.
|
||||
type Options struct {
|
||||
// Image - custom registry image.
|
||||
Image string
|
||||
}
|
||||
|
||||
// Start a new registry and return it along with it's image, user, password, and port.
|
||||
func Start() (*Registry, error) {
|
||||
return StartWithOptions(nil)
|
||||
}
|
||||
|
||||
// StartWithOptions a new registry and return it along with it's image, user, password, and port.
|
||||
func StartWithOptions(options *Options) (*Registry, error) {
|
||||
if options == nil {
|
||||
options = &Options{}
|
||||
}
|
||||
|
||||
var args []string
|
||||
if options.Image != "" {
|
||||
args = append(args, "-i", options.Image)
|
||||
}
|
||||
args = append(args, "start")
|
||||
|
||||
// Start a registry.
|
||||
out, err := utils.ExecCmd(binary, "start")
|
||||
out, err := utils.ExecCmd(binary, args...)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error running %q: %s", binary, out)
|
||||
}
|
||||
|
Reference in New Issue
Block a user