mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-17 06:14:26 +01:00
This PR updates general FIO tests by adding the recent date of a change. Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
35 lines
707 B
Go
35 lines
707 B
Go
// Copyright (c) 2021-2023 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
package k8s
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
exec "github.com/kata-containers/kata-containers/tests/metrics/exec"
|
|
)
|
|
|
|
type execOpt struct {
|
|
showInStdOut bool
|
|
}
|
|
|
|
type ExecOption func(e *execOpt)
|
|
|
|
func ExecOptShowStdOut() ExecOption {
|
|
return func(e *execOpt) {
|
|
e.showInStdOut = true
|
|
}
|
|
|
|
}
|
|
|
|
func (p *Pod) Exec(cmd string, opts ...ExecOption) (output string, err error) {
|
|
log.Debugf("Exec %q in %s", cmd, p.YamlPath)
|
|
o := &execOpt{showInStdOut: false}
|
|
for _, opt := range opts {
|
|
opt(o)
|
|
|
|
}
|
|
execCmd := fmt.Sprintf("kubectl exec -f %s -- /bin/bash -c %q", p.YamlPath, cmd)
|
|
return exec.ExecCmd(execCmd, Debug || o.showInStdOut)
|
|
}
|