From 6293c17bdea950a6c62dc92944686750b86f6c89 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 16:04:14 +0000 Subject: [PATCH 1/8] metrics: Add FIO benchmark for metrics tests This PR adds the FIO benchmark scripts and resources for the metrics tests section. Fixes #7441 Signed-off-by: Gabriela Cervantes --- .../storage/fio-k8s/cmd/fiotest/Makefile | 24 ++ .../storage/fio-k8s/cmd/fiotest/main.go | 373 ++++++++++++++++++ 2 files changed, 397 insertions(+) create mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile create mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/main.go diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile b/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile new file mode 100644 index 0000000000..6a31d4ca9e --- /dev/null +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile @@ -0,0 +1,24 @@ +# +# Copyright (c) 2021-2022 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +MKFILE_DIR := $(dir $(MKFILE_PATH)) + +build: + GO111MODULE=on go build + +run: build + $(MKFILE_DIR)/fio-k8s --debug --fio.size 10M --output-dir test-results --test-name kata $(MKFILE_DIR)/../../configs/example-config/ + $(MKFILE_DIR)/fio-k8s --debug --fio.size 10M --output-dir test-results --test-name runc --container-runtime runc $(MKFILE_DIR)/../../configs/example-config/ + +gomod: + go mod edit -replace=github.com/kata-containers/tests/metrics/k8s=../../pkg/k8s + go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../../pkg/exec + go mod edit -replace=github.com/kata-containers/tests/metrics/env=../../pkg/env + go mod tidy + +runci: build + $(MKFILE_DIR)/fio-k8s --debug --fio.size 10M --output-dir test-results --test-name kata $(MKFILE_DIR)/../../configs/example-config/ diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go b/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go new file mode 100644 index 0000000000..041cabce76 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go @@ -0,0 +1,373 @@ +// Copyright (c) 2021 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +package main + +import ( + "encoding/csv" + "encoding/json" + "fmt" + "os" + "path" + "path/filepath" + "strings" + "time" + + env "github.com/kata-containers/tests/metrics/env" + exec "github.com/kata-containers/tests/metrics/exec" + "github.com/kata-containers/tests/metrics/k8s" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/urfave/cli" +) + +var log = logrus.New() + +var ( + optContainerRuntime = "container-runtime" + optDebug = "debug" + optOutputDir = "output-dir" + optTestName = "test-name" + // fio options + optFioBlockSize = "fio.block-size" + optFioDirect = "fio.direct" + optFioIoDepth = "fio.iodepth" + optFioSize = "fio.size" + optFioNumJobs = "fio.numjobs" +) + +type RwFioOp struct { + BandwidthKb int `json:"bw"` + IOPS float64 `json:"iops"` +} + +type fioResult struct { + GlobalOptions struct { + IOEngine string `json:"ioengine"` + RW string `json:"rw"` + } `json:"global options"` + Jobs []struct { + JobName string `json:"jobname"` + Read RwFioOp `json:"read"` + Write RwFioOp `json:"write"` + } `json:"jobs"` +} + +// Run fio in k8s metrics test in K8s +func (c fioTestConfig) run() (result fioResult, err error) { + log.Infof("Running fio config: %s", c.jobFile) + + pod := k8s.Pod{YamlPath: c.k8sYaml} + + log.Infof("Delete pod if already created") + err = pod.Delete() + if err != nil { + return result, err + } + + log.Infof("Create pod: %s", pod.YamlPath) + err = pod.Run() + if err != nil { + return result, err + } + + defer func() { + log.Info("Deleting pod") + delErr := pod.Delete() + if delErr != nil { + log.Error(delErr) + if err != nil { + err = errors.Wrapf(err, "Could not delete pod after: %s", delErr) + } + } + }() + + destDir := "/home/fio-jobs" + _, err = pod.Exec("mkdir " + destDir) + if err != nil { + return result, err + } + + dstJobFile := path.Join(destDir, "jobFile") + err = pod.CopyFromHost(c.jobFile, dstJobFile) + if err != nil { + return result, err + } + + _, err = pod.Exec("apt update") + if err != nil { + return result, err + } + _, err = pod.Exec("apt install -y fio") + if err != nil { + return result, err + } + + err = env.DropCaches() + if err != nil { + return result, err + } + + var directStr string + if c.direct { + directStr = "1" + } else { + directStr = "0" + } + + cmdFio := "fio" + cmdFio += " --append-terse " + cmdFio += " --blocksize=" + c.blocksize + cmdFio += " --direct=" + directStr + cmdFio += " --directory=" + c.directory + cmdFio += " --iodepth=" + c.iodepth + cmdFio += " --numjobs=" + c.numjobs + cmdFio += " --runtime=" + c.runtime + cmdFio += " --size=" + c.size + cmdFio += " --output-format=json" + cmdFio += " " + dstJobFile + + log.Infof("Exec fio") + output, err := pod.Exec(cmdFio, k8s.ExecOptShowStdOut()) + if err != nil { + return result, err + } + err = json.Unmarshal([]byte(output), &result) + if err != nil { + return result, errors.Wrapf(err, "failed to unmarshall output : %s", output) + } + + log.Infof("ioengine:%s", result.GlobalOptions.IOEngine) + log.Infof("rw:%s", result.GlobalOptions.RW) + if len(result.Jobs) == 0 { + return result, errors.New("No jobs found after parsing fio results") + } + + testDir := path.Join(c.outputDir, filepath.Base(c.jobFile)) + err = os.MkdirAll(testDir, 0775) + if err != nil { + return result, errors.Wrapf(err, "failed to create test directory for :%s", c.jobFile) + } + outputFile := path.Join(testDir, "output.json") + log.Infof("Store results output in : %s", outputFile) + + err = os.WriteFile(outputFile, []byte(output), 0644) + if err != nil { + return result, err + } + + return result, nil +} + +type fioTestConfig struct { + //test options + k8sYaml string + containerRuntime string + outputDir string + + //fio options + blocksize string + directory string + iodepth string + numjobs string + jobFile string + loops string + runtime string + size string + + direct bool +} + +func runFioJobs(testDirPath string, cfg fioTestConfig) (results []fioResult, err error) { + fioJobsDir, err := filepath.Abs(path.Join(testDirPath, "fio-jobs")) + if err != nil { + return results, err + } + + files, err := os.ReadDir(fioJobsDir) + if err != nil { + log.Fatal(err) + return results, err + } + + if cfg.containerRuntime == "" { + return results, errors.New("containerRuntime is empty") + } + + podYAMLName := cfg.containerRuntime + ".yaml" + cfg.k8sYaml = path.Join(testDirPath, podYAMLName) + + if len(files) == 0 { + return results, errors.New("No fio configs found") + } + + for _, file := range files { + cfg.jobFile = path.Join(fioJobsDir, file.Name()) + r, err := cfg.run() + if err != nil { + return results, err + } + results = append(results, r) + + log.Infof("workload:%s", r.Jobs[0].JobName) + log.Infof("bw_r:%d", r.Jobs[0].Read.BandwidthKb) + log.Infof("IOPS_r:%f", r.Jobs[0].Read.IOPS) + log.Infof("bw_w:%d", r.Jobs[0].Write.BandwidthKb) + log.Infof("IOPS_w:%f", r.Jobs[0].Write.IOPS) + + waitTime := 5 + log.Debugf("Sleep %d seconds(if not wait sometimes create another pod timesout)", waitTime) + time.Sleep(time.Duration(waitTime) * time.Second) + } + return results, err + +} + +func generateResultsView(testName string, results []fioResult, outputDir string) error { + outputFile := path.Join(outputDir, "results.csv") + f, err := os.Create(outputFile) + if err != nil { + return err + } + defer f.Close() + + log.Infof("Creating results output in %s", outputFile) + + w := csv.NewWriter(f) + + headers := []string{"NAME", "WORKLOAD", "bw_r", "bw_w", "IOPS_r", "IOPS_w"} + err = w.Write(headers) + if err != nil { + return err + } + + for _, r := range results { + if len(r.Jobs) == 0 { + return errors.Errorf("fio result has no jobs: %v", r) + } + row := []string{testName} + row = append(row, r.Jobs[0].JobName) + row = append(row, fmt.Sprintf("%d", r.Jobs[0].Read.BandwidthKb)) + row = append(row, fmt.Sprintf("%d", r.Jobs[0].Write.BandwidthKb)) + row = append(row, fmt.Sprintf("%f", r.Jobs[0].Read.IOPS)) + row = append(row, fmt.Sprintf("%f", r.Jobs[0].Write.IOPS)) + if err := w.Write(row); err != nil { + return err + } + } + + w.Flush() + + return w.Error() +} + +func main() { + + app := &cli.App{ + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: optDebug, + Usage: "Logs in debug level", + }, + &cli.StringFlag{ + Name: optTestName, + Value: "kata-fio-test", + Usage: "Change the fio test name for reports", + }, + &cli.StringFlag{ + Name: optOutputDir, + Value: ".", + Usage: "Use a file to store results", + }, + &cli.StringFlag{ + Name: optContainerRuntime, + Value: "kata", + Usage: "Choose the runtime to use", + }, + //fio options + &cli.StringFlag{ + Name: optFioSize, + Value: "200M", + Usage: "File size to use for tests", + }, + &cli.StringFlag{ + Name: optFioBlockSize, + Value: "4K", + Usage: "Block size for fio tests", + }, + &cli.BoolFlag{ + Name: optFioDirect, + Usage: "Use direct io", + }, + &cli.StringFlag{ + Name: optFioIoDepth, + Value: "16", + Usage: "Number of I/O units to keep in flight against the file", + }, + &cli.StringFlag{ + Name: optFioNumJobs, + Value: "1", + Usage: "Number of clones (processes/threads performing the same workload) of this job", + }, + }, + Action: func(c *cli.Context) error { + jobsDir := c.Args().First() + + if jobsDir == "" { + cli.SubcommandHelpTemplate = strings.Replace(cli.SubcommandHelpTemplate, "[arguments...]", "", -1) + cli.ShowCommandHelp(c, "") + return errors.New("Missing ") + } + + if c.Bool(optDebug) { + log.SetLevel(logrus.DebugLevel) + k8s.Debug = true + env.Debug = true + } + + exec.SetLogger(log) + k8s.SetLogger(log) + env.SetLogger(log) + + testName := c.String(optTestName) + + outputDir, err := filepath.Abs(path.Join(c.String(optOutputDir), testName)) + if err != nil { + return err + } + + cfg := fioTestConfig{ + blocksize: c.String(optFioBlockSize), + direct: c.Bool(optFioDirect), + directory: ".", + iodepth: c.String(optFioIoDepth), + loops: "3", + numjobs: c.String(optFioNumJobs), + runtime: "20", + size: c.String(optFioSize), + containerRuntime: c.String(optContainerRuntime), + outputDir: outputDir, + } + + log.Infof("Results will be created in %s", cfg.outputDir) + + err = os.MkdirAll(cfg.outputDir, 0775) + if err != nil { + return err + } + + results, err := runFioJobs(jobsDir, cfg) + if err != nil { + return err + } + + return generateResultsView(c.String(optTestName), results, outputDir) + }, + } + + err := app.Run(os.Args) + if err != nil { + log.Fatal(err) + } + +} From 8f7ef41c1405e9b72e066c7d6fbd735fe165c076 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 17:13:01 +0000 Subject: [PATCH 2/8] metrics: Add FIO vendor code This PR adds the FIO vendor code. Signed-off-by: Gabriela Cervantes --- .../storage/fio-k8s/cmd/fiotest/go.mod | 12 +++++++++ .../storage/fio-k8s/cmd/fiotest/go.sum | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod create mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod new file mode 100644 index 0000000000..bddb4e5480 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod @@ -0,0 +1,12 @@ +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/cmd/fiotest + +go 1.19 + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/urfave/cli v1.22.14 // indirect + golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect +) diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum new file mode 100644 index 0000000000..3155296b0b --- /dev/null +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum @@ -0,0 +1,27 @@ +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= +github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From ea198fddccf266f345c13b33847e5def663ae6aa Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 17:34:29 +0000 Subject: [PATCH 3/8] metrics: Add FIO runner k8s Add program to execute FIO workloads using k8s. Signed-off-by: Gabriela Cervantes --- .../metrics/storage/fio-k8s/pkg/k8s/Makefile | 8 +++ tests/metrics/storage/fio-k8s/pkg/k8s/exec.go | 35 ++++++++++ tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go | 69 +++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/Makefile create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/exec.go create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile b/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile new file mode 100644 index 0000000000..c596cec7cb --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile @@ -0,0 +1,8 @@ +# +# Copyright (c) 2021 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# +gomod: + GO111MODULE=on go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../exec + GO111MODULE=on go mod tidy diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go new file mode 100644 index 0000000000..1d37a1b875 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go @@ -0,0 +1,35 @@ +// Copyright (c) 2021 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// +package k8s + +import ( + "fmt" + + exec "github.com/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) +} diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go new file mode 100644 index 0000000000..6e1e7a0482 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go @@ -0,0 +1,69 @@ +// Copyright (c) 2021 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// +package k8s + +import ( + "fmt" + + exec "github.com/kata-containers/tests/metrics/exec" + "github.com/pkg/errors" +) + +//logger interface for pkg +var log logger +var Debug bool = false + +type logger interface { + Infof(string, ...interface{}) + Debugf(string, ...interface{}) + Errorf(string, ...interface{}) +} + +func SetLogger(l logger) { + log = l +} + +type Pod struct { + YamlPath string +} + +func (p *Pod) waitForReady() (err error) { + log.Debugf("Wait for pod %s", p.YamlPath) + _, err = exec.ExecCmd("kubectl wait --for=condition=ready -f "+p.YamlPath, Debug) + return err +} + +func (p *Pod) Run() (err error) { + + log.Debugf("Creating K8s Pod %s", p.YamlPath) + _, err = exec.ExecCmd("kubectl apply -f "+p.YamlPath, Debug) + if err != nil { + return errors.Wrapf(err, "Failed to run pod %s", p.YamlPath) + } + + err = p.waitForReady() + if err != nil { + return errors.Wrapf(err, "Failed to wait for pod %s", p.YamlPath) + } + return err +} + +func (p *Pod) Delete() (err error) { + log.Debugf("Delete pod %s", p.YamlPath) + _, err = exec.ExecCmd("kubectl delete --ignore-not-found -f "+p.YamlPath, Debug) + return errors.Wrapf(err, "Failed to delete pod %s", p.YamlPath) +} + +func (p *Pod) CopyFromHost(src, dst string) (err error) { + podName, err := exec.ExecCmd("kubectl get -f "+p.YamlPath+" -o jsonpath={.metadata.name}", Debug) + if err != nil { + return nil + } + + log.Debugf("Copy from host %q->%q in pod %s", src, dst, p.YamlPath) + execCmd := fmt.Sprintf("kubectl cp %s %s:%s", src, podName, dst) + _, err = exec.ExecCmd(execCmd, Debug) + return err +} From a45900324d35dbd8eb271fab2a6a5b34cd7e87a8 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 17:36:08 +0000 Subject: [PATCH 4/8] metrics: Add fio exec This PR adds fio exec for the FIO benchmark. Signed-off-by: Gabriela Cervantes --- .../metrics/storage/fio-k8s/pkg/exec/Exec.go | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/metrics/storage/fio-k8s/pkg/exec/Exec.go diff --git a/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go b/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go new file mode 100644 index 0000000000..b94a5403a7 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go @@ -0,0 +1,68 @@ +// Copyright (c) 2021 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// +package exec + +import ( + "bytes" + "io" + "os" + "os/exec" + + "github.com/pkg/errors" +) + +//logger interface for pkg +var log logger + +type logger interface { + Infof(string, ...interface{}) + Debugf(string, ...interface{}) + Errorf(string, ...interface{}) +} + +func SetLogger(l logger) { + log = l +} + +// Exec a command +// err != nil if command fails to execute +// output is a string with a combined stdout and stderr +func ExecCmd(c string, showInStdout bool) (stdout string, err error) { + if c == "" { + return "", errors.New("command is empty") + } + + log.Debugf("Exec: %s", c) + cmd := exec.Command("bash", "-o", "pipefail", "-c", c) + var stdBuffer bytes.Buffer + var writers []io.Writer + writers = append(writers, &stdBuffer) + if showInStdout { + writers = append(writers, os.Stdout) + } + mw := io.MultiWriter(writers...) + + cmd.Stdout = mw + cmd.Stderr = mw + + err = cmd.Run() + output := stdBuffer.String() + + return stdBuffer.String(), errors.Wrap(err, output) +} + +// Exec a command +// Send output to Stdout and Stderr +func ExecStdout(c string) error { + if c == "" { + return errors.New("command is empty") + } + + log.Debugf("Exec: %s", c) + cmd := exec.Command("bash", "-o", "pipefail", "-c", c) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + return cmd.Run() +} From 6177a0db3e62948dfe7e89b101acacb8ff61828c Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 17:48:45 +0000 Subject: [PATCH 5/8] metrics: Add env files for FIO This PR adds the env files for FIO for kata metrics. Signed-off-by: Gabriela Cervantes --- .../metrics/storage/fio-k8s/pkg/env/Makefile | 9 +++++ tests/metrics/storage/fio-k8s/pkg/env/env.go | 39 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/metrics/storage/fio-k8s/pkg/env/Makefile create mode 100644 tests/metrics/storage/fio-k8s/pkg/env/env.go diff --git a/tests/metrics/storage/fio-k8s/pkg/env/Makefile b/tests/metrics/storage/fio-k8s/pkg/env/Makefile new file mode 100644 index 0000000000..01e0d92098 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/env/Makefile @@ -0,0 +1,9 @@ +# +# Copyright (c) 2021 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +gomod: + GO111MODULE=on go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../exec + GO111MODULE=on go mod tidy diff --git a/tests/metrics/storage/fio-k8s/pkg/env/env.go b/tests/metrics/storage/fio-k8s/pkg/env/env.go new file mode 100644 index 0000000000..e5deb29e4a --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/env/env.go @@ -0,0 +1,39 @@ +// Copyright (c) 2021 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// +package env + +import ( + exec "github.com/kata-containers/tests/metrics/exec" +) + +//logger interface for pkg +var log logger +var Debug bool = false + +type logger interface { + Infof(string, ...interface{}) + Debugf(string, ...interface{}) + Errorf(string, ...interface{}) +} + +func SetLogger(l logger) { + log = l +} + +var sysDropCachesPath = "/proc/sys/vm/drop_caches" + +func DropCaches() (err error) { + log.Infof("drop caches") + _, err = exec.ExecCmd("sync", Debug) + if err != nil { + return err + } + + _, err = exec.ExecCmd("echo 3 | sudo tee "+sysDropCachesPath, Debug) + if err != nil { + return err + } + return nil +} From 3c1044d9d594f13dd1cd3ca82a912431e9f12696 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 18:00:24 +0000 Subject: [PATCH 6/8] metrics: Update FIO paths for k8s runner This PR updates the FIO paths for k8s runner. Signed-off-by: Gabriela Cervantes --- tests/metrics/storage/fio-k8s/.gitignore | 1 + .../storage/fio-k8s/cmd/fiotest/Makefile | 6 +-- .../storage/fio-k8s/cmd/fiotest/go.mod | 22 ++++++---- .../storage/fio-k8s/cmd/fiotest/go.sum | 40 +++++++++---------- .../storage/fio-k8s/cmd/fiotest/main.go | 6 +-- .../metrics/storage/fio-k8s/pkg/env/Makefile | 2 +- tests/metrics/storage/fio-k8s/pkg/env/env.go | 2 +- tests/metrics/storage/fio-k8s/pkg/env/go.mod | 10 +++++ tests/metrics/storage/fio-k8s/pkg/env/go.sum | 2 + tests/metrics/storage/fio-k8s/pkg/exec/go.mod | 3 ++ .../metrics/storage/fio-k8s/pkg/k8s/Makefile | 2 +- tests/metrics/storage/fio-k8s/pkg/k8s/exec.go | 2 +- tests/metrics/storage/fio-k8s/pkg/k8s/go.mod | 10 +++++ tests/metrics/storage/fio-k8s/pkg/k8s/go.sum | 2 + tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go | 2 +- 15 files changed, 71 insertions(+), 41 deletions(-) create mode 100644 tests/metrics/storage/fio-k8s/.gitignore create mode 100644 tests/metrics/storage/fio-k8s/pkg/env/go.mod create mode 100644 tests/metrics/storage/fio-k8s/pkg/env/go.sum create mode 100644 tests/metrics/storage/fio-k8s/pkg/exec/go.mod create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/go.mod create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/go.sum diff --git a/tests/metrics/storage/fio-k8s/.gitignore b/tests/metrics/storage/fio-k8s/.gitignore new file mode 100644 index 0000000000..1caa97b150 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/.gitignore @@ -0,0 +1 @@ +./cmd/fiotest/fio-k8s diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile b/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile index 6a31d4ca9e..69888b39d8 100644 --- a/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/Makefile @@ -15,9 +15,9 @@ run: build $(MKFILE_DIR)/fio-k8s --debug --fio.size 10M --output-dir test-results --test-name runc --container-runtime runc $(MKFILE_DIR)/../../configs/example-config/ gomod: - go mod edit -replace=github.com/kata-containers/tests/metrics/k8s=../../pkg/k8s - go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../../pkg/exec - go mod edit -replace=github.com/kata-containers/tests/metrics/env=../../pkg/env + go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/k8s=../../pkg/k8s + go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/exec=../../pkg/exec + go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/env=../../pkg/env go mod tidy runci: build diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod index bddb4e5480..574b50bcd9 100644 --- a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod @@ -1,12 +1,18 @@ -module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/cmd/fiotest +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s -go 1.19 +go 1.15 require ( - github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect - github.com/urfave/cli v1.22.14 // indirect - golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect + github.com/kata-containers/kata-containers/tests/metrics/env v0.0.0-00010101000000-000000000000 + github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 + github.com/kata-containers/kata-containers/tests/metrics/k8s v0.0.0-00010101000000-000000000000 + github.com/pkg/errors v0.9.1 + github.com/sirupsen/logrus v1.8.1 + github.com/urfave/cli v1.22.5 ) + +replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../../pkg/exec + +replace github.com/kata-containers/kata-containers/tests/metrics/k8s => ../../pkg/k8s + +replace github.com/kata-containers/kata-containers/tests/metrics/env => ../../pkg/env diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum index 3155296b0b..9577b966fb 100644 --- a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum @@ -1,27 +1,23 @@ -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= -github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= +github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go b/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go index 041cabce76..641836c556 100644 --- a/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/main.go @@ -13,9 +13,9 @@ import ( "strings" "time" - env "github.com/kata-containers/tests/metrics/env" - exec "github.com/kata-containers/tests/metrics/exec" - "github.com/kata-containers/tests/metrics/k8s" + env "github.com/kata-containers/kata-containers/tests/metrics/env" + exec "github.com/kata-containers/kata-containers/tests/metrics/exec" + "github.com/kata-containers/kata-containers/tests/metrics/k8s" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" diff --git a/tests/metrics/storage/fio-k8s/pkg/env/Makefile b/tests/metrics/storage/fio-k8s/pkg/env/Makefile index 01e0d92098..5f0a330df5 100644 --- a/tests/metrics/storage/fio-k8s/pkg/env/Makefile +++ b/tests/metrics/storage/fio-k8s/pkg/env/Makefile @@ -5,5 +5,5 @@ # gomod: - GO111MODULE=on go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../exec + GO111MODULE=on go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/exec=../exec GO111MODULE=on go mod tidy diff --git a/tests/metrics/storage/fio-k8s/pkg/env/env.go b/tests/metrics/storage/fio-k8s/pkg/env/env.go index e5deb29e4a..6ca46ed73c 100644 --- a/tests/metrics/storage/fio-k8s/pkg/env/env.go +++ b/tests/metrics/storage/fio-k8s/pkg/env/env.go @@ -5,7 +5,7 @@ package env import ( - exec "github.com/kata-containers/tests/metrics/exec" + exec "github.com/kata-containers/kata-containers/tests/metrics/exec" ) //logger interface for pkg diff --git a/tests/metrics/storage/fio-k8s/pkg/env/go.mod b/tests/metrics/storage/fio-k8s/pkg/env/go.mod new file mode 100644 index 0000000000..6df33edfe4 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/env/go.mod @@ -0,0 +1,10 @@ +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/exec + +go 1.14 + +replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../exec + +require ( + github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 + github.com/pkg/errors v0.9.1 // indirect +) diff --git a/tests/metrics/storage/fio-k8s/pkg/env/go.sum b/tests/metrics/storage/fio-k8s/pkg/env/go.sum new file mode 100644 index 0000000000..7c401c3f58 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/env/go.sum @@ -0,0 +1,2 @@ +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/exec/go.mod b/tests/metrics/storage/fio-k8s/pkg/exec/go.mod new file mode 100644 index 0000000000..664090f980 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/exec/go.mod @@ -0,0 +1,3 @@ +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/exec + +go 1.14 diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile b/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile index c596cec7cb..8070ca876d 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile @@ -4,5 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # gomod: - GO111MODULE=on go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../exec + GO111MODULE=on go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/pkg/exec=../exec GO111MODULE=on go mod tidy diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go index 1d37a1b875..597e9aaa56 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go @@ -7,7 +7,7 @@ package k8s import ( "fmt" - exec "github.com/kata-containers/tests/metrics/exec" + exec "github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/pkg/exec" ) type execOpt struct { diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod b/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod new file mode 100644 index 0000000000..5b8e70d7a1 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod @@ -0,0 +1,10 @@ +module github.com/kata-containers/kata-containers/tests/metrics/k8s + +go 1.15 + +replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../exec + +require ( + github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 + github.com/pkg/errors v0.9.1 +) diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum b/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum new file mode 100644 index 0000000000..7c401c3f58 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum @@ -0,0 +1,2 @@ +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go index 6e1e7a0482..a14cf7b775 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go @@ -7,7 +7,7 @@ package k8s import ( "fmt" - exec "github.com/kata-containers/tests/metrics/exec" + exec "github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/pkg/exec" "github.com/pkg/errors" ) From 37641a5430d5c2f94f54bf906c303dfe559e45ff Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Tue, 25 Jul 2023 21:13:32 +0000 Subject: [PATCH 7/8] metrics: Add example config for fio jobs This PR adds example config for fio jobs. Signed-off-by: Gabriela Cervantes --- .../storage/fio-k8s/cmd/fiotest/go.mod | 18 --------------- .../storage/fio-k8s/cmd/fiotest/go.sum | 23 ------------------- .../example-config/fio-jobs/randrw-async.job | 10 ++++++++ .../example-config/fio-jobs/randrw-libaio.job | 10 ++++++++ .../example-config/fio-jobs/randrw-sync.job | 10 ++++++++ .../fio-k8s/configs/example-config/kata.yaml | 16 +++++++++++++ .../fio-k8s/configs/example-config/runc.yaml | 15 ++++++++++++ .../test-config/fio-jobs/randread-libaio.job | 9 ++++++++ .../test-config/fio-jobs/randread-mmpap.job | 9 ++++++++ .../test-config/fio-jobs/randrw-libaio.job | 10 ++++++++ .../test-config/fio-jobs/randrw-mmap.job | 10 ++++++++ .../test-config/fio-jobs/randwrite-libaio.job | 9 ++++++++ .../test-config/fio-jobs/randwrite-mmap.job | 9 ++++++++ .../test-config/fio-jobs/seqread-libaio.job | 9 ++++++++ .../test-config/fio-jobs/seqread-mmap.job | 9 ++++++++ .../test-config/fio-jobs/seqread-psync.job | 8 +++++++ .../test-config/fio-jobs/seqwrite-libaio.job | 9 ++++++++ .../test-config/fio-jobs/seqwrite-mmap.job | 10 ++++++++ .../fio-k8s/configs/test-config/kata.yaml | 16 +++++++++++++ .../fio-k8s/configs/test-config/runc.yaml | 15 ++++++++++++ tests/metrics/storage/fio-k8s/pkg/env/go.mod | 10 -------- tests/metrics/storage/fio-k8s/pkg/env/go.sum | 2 -- tests/metrics/storage/fio-k8s/pkg/exec/go.mod | 3 --- .../metrics/storage/fio-k8s/pkg/k8s/Makefile | 2 +- tests/metrics/storage/fio-k8s/pkg/k8s/exec.go | 2 +- tests/metrics/storage/fio-k8s/pkg/k8s/go.mod | 10 -------- tests/metrics/storage/fio-k8s/pkg/k8s/go.sum | 2 -- tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go | 2 +- 28 files changed, 196 insertions(+), 71 deletions(-) delete mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod delete mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum create mode 100644 tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-async.job create mode 100644 tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-libaio.job create mode 100644 tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-sync.job create mode 100644 tests/metrics/storage/fio-k8s/configs/example-config/kata.yaml create mode 100644 tests/metrics/storage/fio-k8s/configs/example-config/runc.yaml create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-libaio.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-mmpap.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-libaio.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-mmap.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-libaio.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-mmap.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-libaio.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-mmap.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-psync.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-libaio.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-mmap.job create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/kata.yaml create mode 100644 tests/metrics/storage/fio-k8s/configs/test-config/runc.yaml delete mode 100644 tests/metrics/storage/fio-k8s/pkg/env/go.mod delete mode 100644 tests/metrics/storage/fio-k8s/pkg/env/go.sum delete mode 100644 tests/metrics/storage/fio-k8s/pkg/exec/go.mod delete mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/go.mod delete mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/go.sum diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod deleted file mode 100644 index 574b50bcd9..0000000000 --- a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod +++ /dev/null @@ -1,18 +0,0 @@ -module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s - -go 1.15 - -require ( - github.com/kata-containers/kata-containers/tests/metrics/env v0.0.0-00010101000000-000000000000 - github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 - github.com/kata-containers/kata-containers/tests/metrics/k8s v0.0.0-00010101000000-000000000000 - github.com/pkg/errors v0.9.1 - github.com/sirupsen/logrus v1.8.1 - github.com/urfave/cli v1.22.5 -) - -replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../../pkg/exec - -replace github.com/kata-containers/kata-containers/tests/metrics/k8s => ../../pkg/k8s - -replace github.com/kata-containers/kata-containers/tests/metrics/env => ../../pkg/env diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum deleted file mode 100644 index 9577b966fb..0000000000 --- a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum +++ /dev/null @@ -1,23 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= -github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-async.job b/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-async.job new file mode 100644 index 0000000000..9e0edb96c2 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-async.job @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2022 Intel Corporation +[global] +name=io_uring +filename=fio-file +rw=randrw +rwmixread=75 +ioengine=io_uring + +[randrw-io_uring] diff --git a/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-libaio.job b/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-libaio.job new file mode 100644 index 0000000000..327852e442 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-libaio.job @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randrw-libaio +filename=fio-file +rw=randrw +rwmixread=75 +ioengine=libaio + +[randrw-libaio] diff --git a/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-sync.job b/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-sync.job new file mode 100644 index 0000000000..3f7f2b6ed8 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/example-config/fio-jobs/randrw-sync.job @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2022 Intel Corporation +[global] +name=sync +filename=fio-file +rw=randrw +rwmixread=75 +ioengine=sync + +[randrw-sync] diff --git a/tests/metrics/storage/fio-k8s/configs/example-config/kata.yaml b/tests/metrics/storage/fio-k8s/configs/example-config/kata.yaml new file mode 100644 index 0000000000..08f397deae --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/example-config/kata.yaml @@ -0,0 +1,16 @@ +## Copyright (c) 2021 Intel Corporation +# +## SPDX-License-Identifier: Apache-2.0 +# +apiVersion: v1 +kind: Pod +metadata: + name: iometrics +spec: + runtimeClassName: kata + containers: + - name: iometrics + image: ubuntu:latest + # Just spin & wait forever + command: [ "/bin/bash", "-c", "--" ] + args: [ "sleep infinity" ] diff --git a/tests/metrics/storage/fio-k8s/configs/example-config/runc.yaml b/tests/metrics/storage/fio-k8s/configs/example-config/runc.yaml new file mode 100644 index 0000000000..4fd96d3c1e --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/example-config/runc.yaml @@ -0,0 +1,15 @@ +## Copyright (c) 2021 Intel Corporation +# +## SPDX-License-Identifier: Apache-2.0 +# +apiVersion: v1 +kind: Pod +metadata: + name: iometrics +spec: + containers: + - name: iometrics + image: ubuntu:latest + # Just spin & wait forever + command: [ "/bin/bash", "-c", "--" ] + args: [ "sleep infinity" ] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-libaio.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-libaio.job new file mode 100644 index 0000000000..5ab2260610 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-libaio.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randread-libaio +filename=fio-file +rw=randread +ioengine=libaio + +[randread-libaio] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-mmpap.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-mmpap.job new file mode 100644 index 0000000000..cd79854f26 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randread-mmpap.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randread-mmap +rw=randread +ioengine=mmap + +[randread-mmap] +filename=fio-file diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-libaio.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-libaio.job new file mode 100644 index 0000000000..327852e442 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-libaio.job @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randrw-libaio +filename=fio-file +rw=randrw +rwmixread=75 +ioengine=libaio + +[randrw-libaio] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-mmap.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-mmap.job new file mode 100644 index 0000000000..cf0c1288a9 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randrw-mmap.job @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randrw-mmap +rw=randrw +rwmixread=75 +ioengine=mmap + +[randrw-mmap] +filename=fio-file diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-libaio.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-libaio.job new file mode 100644 index 0000000000..ef3bfc5a56 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-libaio.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randwrite-libaio +filename=fio-file +rw=randwrite +ioengine=libaio + +[randwrite-libaio] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-mmap.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-mmap.job new file mode 100644 index 0000000000..0d4f6ef73a --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/randwrite-mmap.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=randwrite-mmap +rw=randwrite +ioengine=mmap + +[randwrite-mmap] +filename=fio-file diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-libaio.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-libaio.job new file mode 100644 index 0000000000..6f8a16a3fa --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-libaio.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=seqread-libaio +filename=fio-file +rw=read +ioengine=libaio + +[seqread-libaio] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-mmap.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-mmap.job new file mode 100644 index 0000000000..9829726d3a --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-mmap.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=seqread-mmap +rw=read +ioengine=mmap + +[seqread-mmap] +filename=fio-file diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-psync.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-psync.job new file mode 100644 index 0000000000..a1f54ca7c0 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqread-psync.job @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=seqread-psync +filename=fio-file +rw=read + +[seqread-psync] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-libaio.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-libaio.job new file mode 100644 index 0000000000..9927e05c98 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-libaio.job @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=seqwrite-libaio +filename=fio-file +rw=write +ioengine=libaio + +[seqwrite-libaio] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-mmap.job b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-mmap.job new file mode 100644 index 0000000000..e3485db4f6 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/fio-jobs/seqwrite-mmap.job @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 Intel Corporation +[global] +name=seqwrite-mmap +filename=fio-file +rw=write +ioengine=mmap + +[seqwrite-mmap] +filename=fio-file diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/kata.yaml b/tests/metrics/storage/fio-k8s/configs/test-config/kata.yaml new file mode 100644 index 0000000000..08f397deae --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/kata.yaml @@ -0,0 +1,16 @@ +## Copyright (c) 2021 Intel Corporation +# +## SPDX-License-Identifier: Apache-2.0 +# +apiVersion: v1 +kind: Pod +metadata: + name: iometrics +spec: + runtimeClassName: kata + containers: + - name: iometrics + image: ubuntu:latest + # Just spin & wait forever + command: [ "/bin/bash", "-c", "--" ] + args: [ "sleep infinity" ] diff --git a/tests/metrics/storage/fio-k8s/configs/test-config/runc.yaml b/tests/metrics/storage/fio-k8s/configs/test-config/runc.yaml new file mode 100644 index 0000000000..4fd96d3c1e --- /dev/null +++ b/tests/metrics/storage/fio-k8s/configs/test-config/runc.yaml @@ -0,0 +1,15 @@ +## Copyright (c) 2021 Intel Corporation +# +## SPDX-License-Identifier: Apache-2.0 +# +apiVersion: v1 +kind: Pod +metadata: + name: iometrics +spec: + containers: + - name: iometrics + image: ubuntu:latest + # Just spin & wait forever + command: [ "/bin/bash", "-c", "--" ] + args: [ "sleep infinity" ] diff --git a/tests/metrics/storage/fio-k8s/pkg/env/go.mod b/tests/metrics/storage/fio-k8s/pkg/env/go.mod deleted file mode 100644 index 6df33edfe4..0000000000 --- a/tests/metrics/storage/fio-k8s/pkg/env/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/exec - -go 1.14 - -replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../exec - -require ( - github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 - github.com/pkg/errors v0.9.1 // indirect -) diff --git a/tests/metrics/storage/fio-k8s/pkg/env/go.sum b/tests/metrics/storage/fio-k8s/pkg/env/go.sum deleted file mode 100644 index 7c401c3f58..0000000000 --- a/tests/metrics/storage/fio-k8s/pkg/env/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/exec/go.mod b/tests/metrics/storage/fio-k8s/pkg/exec/go.mod deleted file mode 100644 index 664090f980..0000000000 --- a/tests/metrics/storage/fio-k8s/pkg/exec/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/exec - -go 1.14 diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile b/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile index 8070ca876d..fb26740dc0 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/Makefile @@ -4,5 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # gomod: - GO111MODULE=on go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/pkg/exec=../exec + GO111MODULE=on go mod edit -replace=github.com/kata-containers/kata-containers/tests/metrics/exec=../exec GO111MODULE=on go mod tidy diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go index 597e9aaa56..3c3333e324 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go @@ -7,7 +7,7 @@ package k8s import ( "fmt" - exec "github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/pkg/exec" + exec "github.com/kata-containers/kata-containers/tests/metrics/exec" ) type execOpt struct { diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod b/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod deleted file mode 100644 index 5b8e70d7a1..0000000000 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/kata-containers/kata-containers/tests/metrics/k8s - -go 1.15 - -replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../exec - -require ( - github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 - github.com/pkg/errors v0.9.1 -) diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum b/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum deleted file mode 100644 index 7c401c3f58..0000000000 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go index a14cf7b775..6e849d5371 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go @@ -7,7 +7,7 @@ package k8s import ( "fmt" - exec "github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/pkg/exec" + exec "github.com/kata-containers/kata-containers/tests/metrics/exec" "github.com/pkg/errors" ) From 662f87539ebc1d5fc06f5e1f80fad6c4ddba25f9 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Wed, 26 Jul 2023 16:04:39 +0000 Subject: [PATCH 8/8] metrics: Add general FIO makefile This PR adds a general FIO makefile for kata metrics. Signed-off-by: Gabriela Cervantes --- tests/metrics/storage/fio-k8s/Makefile | 28 +++++++++++++++++ .../storage/fio-k8s/cmd/fiotest/go.mod | 24 ++++++++++++++ .../storage/fio-k8s/cmd/fiotest/go.sum | 31 +++++++++++++++++++ tests/metrics/storage/fio-k8s/pkg/env/env.go | 3 +- tests/metrics/storage/fio-k8s/pkg/env/go.mod | 10 ++++++ tests/metrics/storage/fio-k8s/pkg/env/go.sum | 2 ++ .../metrics/storage/fio-k8s/pkg/exec/Exec.go | 3 +- tests/metrics/storage/fio-k8s/pkg/exec/go.mod | 5 +++ tests/metrics/storage/fio-k8s/pkg/exec/go.sum | 2 ++ tests/metrics/storage/fio-k8s/pkg/k8s/exec.go | 1 - tests/metrics/storage/fio-k8s/pkg/k8s/go.mod | 10 ++++++ tests/metrics/storage/fio-k8s/pkg/k8s/go.sum | 2 ++ tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go | 3 +- 13 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 tests/metrics/storage/fio-k8s/Makefile create mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod create mode 100644 tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum create mode 100644 tests/metrics/storage/fio-k8s/pkg/env/go.mod create mode 100644 tests/metrics/storage/fio-k8s/pkg/env/go.sum create mode 100644 tests/metrics/storage/fio-k8s/pkg/exec/go.mod create mode 100644 tests/metrics/storage/fio-k8s/pkg/exec/go.sum create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/go.mod create mode 100644 tests/metrics/storage/fio-k8s/pkg/k8s/go.sum diff --git a/tests/metrics/storage/fio-k8s/Makefile b/tests/metrics/storage/fio-k8s/Makefile new file mode 100644 index 0000000000..ba96203baa --- /dev/null +++ b/tests/metrics/storage/fio-k8s/Makefile @@ -0,0 +1,28 @@ +# +# Copyright (c) 2021-2022 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +MKFILE_DIR := $(dir $(MKFILE_PATH)) + +build: + make -C $(MKFILE_DIR)/cmd/fiotest/ gomod + make -C $(MKFILE_DIR)/cmd/fiotest/ build + +test-report: + $(MKFILE_DIR)/scripts/dax-compare-test/report/gen-html-fio-report.sh $(MKFILE_DIR)/cmd/fiotest/test-results/ + +test-report-interactive: + $(MKFILE_DIR)/scripts/dax-compare-test/report/run-docker-jupyter-server.sh $(MKFILE_DIR)/cmd/fiotest/test-results/ + +test: build + make -C $(MKFILE_DIR)/cmd/fiotest/ run + make test-report + +run: build + make -C $(MKFILE_DIR)/scripts/dax-compare-test/ run + +test-ci: build + make -C $(MKFILE_DIR)/cmd/fiotest/ runci diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod new file mode 100644 index 0000000000..4d6f8fb455 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.mod @@ -0,0 +1,24 @@ +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s + +go 1.19 + +replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../../pkg/exec + +replace github.com/kata-containers/kata-containers/tests/metrics/k8s => ../../pkg/k8s + +replace github.com/kata-containers/kata-containers/tests/metrics/env => ../../pkg/env + +require ( + github.com/kata-containers/kata-containers/tests/metrics/env v0.0.0-00010101000000-000000000000 + github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 + github.com/kata-containers/kata-containers/tests/metrics/k8s v0.0.0-00010101000000-000000000000 + github.com/pkg/errors v0.9.1 + github.com/sirupsen/logrus v1.9.3 + github.com/urfave/cli v1.22.14 +) + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect +) diff --git a/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum new file mode 100644 index 0000000000..45fbeb4a09 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/cmd/fiotest/go.sum @@ -0,0 +1,31 @@ +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= +github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tests/metrics/storage/fio-k8s/pkg/env/env.go b/tests/metrics/storage/fio-k8s/pkg/env/env.go index 6ca46ed73c..efb0e9adad 100644 --- a/tests/metrics/storage/fio-k8s/pkg/env/env.go +++ b/tests/metrics/storage/fio-k8s/pkg/env/env.go @@ -1,14 +1,13 @@ // Copyright (c) 2021 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 -// package env import ( exec "github.com/kata-containers/kata-containers/tests/metrics/exec" ) -//logger interface for pkg +// logger interface for pkg var log logger var Debug bool = false diff --git a/tests/metrics/storage/fio-k8s/pkg/env/go.mod b/tests/metrics/storage/fio-k8s/pkg/env/go.mod new file mode 100644 index 0000000000..4e59e60d96 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/env/go.mod @@ -0,0 +1,10 @@ +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/exec + +go 1.19 + +require ( + github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 // indirect + github.com/pkg/errors v0.9.1 // indirect +) + +replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../exec diff --git a/tests/metrics/storage/fio-k8s/pkg/env/go.sum b/tests/metrics/storage/fio-k8s/pkg/env/go.sum new file mode 100644 index 0000000000..7c401c3f58 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/env/go.sum @@ -0,0 +1,2 @@ +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go b/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go index b94a5403a7..7d8a724b88 100644 --- a/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go +++ b/tests/metrics/storage/fio-k8s/pkg/exec/Exec.go @@ -1,7 +1,6 @@ // Copyright (c) 2021 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 -// package exec import ( @@ -13,7 +12,7 @@ import ( "github.com/pkg/errors" ) -//logger interface for pkg +// logger interface for pkg var log logger type logger interface { diff --git a/tests/metrics/storage/fio-k8s/pkg/exec/go.mod b/tests/metrics/storage/fio-k8s/pkg/exec/go.mod new file mode 100644 index 0000000000..c74fcbeb83 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/exec/go.mod @@ -0,0 +1,5 @@ +module github.com/kata-containers/kata-containers/tests/metrics/storage/fio-k8s/exec + +go 1.19 + +require github.com/pkg/errors v0.9.1 diff --git a/tests/metrics/storage/fio-k8s/pkg/exec/go.sum b/tests/metrics/storage/fio-k8s/pkg/exec/go.sum new file mode 100644 index 0000000000..7c401c3f58 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/exec/go.sum @@ -0,0 +1,2 @@ +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go index 3c3333e324..8ed5aaa2c2 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/exec.go @@ -1,7 +1,6 @@ // Copyright (c) 2021 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 -// package k8s import ( diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod b/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod new file mode 100644 index 0000000000..6a349002a2 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/go.mod @@ -0,0 +1,10 @@ +module github.com/kata-containers/kata-containers/tests/metrics/k8s + +go 1.19 + +replace github.com/kata-containers/kata-containers/tests/metrics/exec => ../exec + +require ( + github.com/kata-containers/kata-containers/tests/metrics/exec v0.0.0-00010101000000-000000000000 // indirect + github.com/pkg/errors v0.9.1 // indirect +) diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum b/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum new file mode 100644 index 0000000000..7c401c3f58 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/go.sum @@ -0,0 +1,2 @@ +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go index 6e849d5371..8e218bd3dd 100644 --- a/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go +++ b/tests/metrics/storage/fio-k8s/pkg/k8s/k8s.go @@ -1,7 +1,6 @@ // Copyright (c) 2021 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 -// package k8s import ( @@ -11,7 +10,7 @@ import ( "github.com/pkg/errors" ) -//logger interface for pkg +// logger interface for pkg var log logger var Debug bool = false