From 5757376c18ae27a9a324054ed58872263d326d81 Mon Sep 17 00:00:00 2001 From: Nashwan Azhari Date: Tue, 26 Apr 2022 15:52:06 +0300 Subject: [PATCH] Skip benchmarks if associated resource number is not set. Signed-off-by: Nashwan Azhari --- pkg/benchmark/container.go | 4 ++-- pkg/benchmark/image.go | 8 ++++---- pkg/benchmark/pod.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/benchmark/container.go b/pkg/benchmark/container.go index 05d165273c..781d685bce 100644 --- a/pkg/benchmark/container.go +++ b/pkg/benchmark/container.go @@ -55,8 +55,8 @@ var _ = framework.KubeDescribe("Container", func() { N: framework.TestContext.BenchmarkingParams.ContainersNumber, NumParallel: framework.TestContext.BenchmarkingParams.ContainersNumberParallel, } - if samplingConfig.N < 1 { - samplingConfig.N = 1 + if samplingConfig.N <= 0 { + Skip("skipping container lifecycle benchmarks since container number option was not set") } if samplingConfig.NumParallel < 1 { samplingConfig.NumParallel = 1 diff --git a/pkg/benchmark/image.go b/pkg/benchmark/image.go index 43f07b7e65..b9712fd0dc 100644 --- a/pkg/benchmark/image.go +++ b/pkg/benchmark/image.go @@ -94,8 +94,8 @@ var _ = framework.KubeDescribe("Image", func() { N: framework.TestContext.BenchmarkingParams.ImagesNumber, NumParallel: framework.TestContext.BenchmarkingParams.ImagesNumberParallel, } - if samplingConfig.N < 1 { - samplingConfig.N = 1 + if samplingConfig.N <= 0 { + Skip("skipping image lifecycle benchmarks since image number option was not set") } if samplingConfig.NumParallel < 1 { samplingConfig.NumParallel = 1 @@ -187,8 +187,8 @@ var _ = framework.KubeDescribe("Image", func() { N: framework.TestContext.BenchmarkingParams.ImagesNumber, NumParallel: framework.TestContext.BenchmarkingParams.ImagesNumberParallel, } - if samplingConfig.N < 1 { - samplingConfig.N = 1 + if samplingConfig.N <= 0 { + Skip("skipping image listing benchmarks since image listing number option was not set") } if samplingConfig.NumParallel < 1 { samplingConfig.NumParallel = 1 diff --git a/pkg/benchmark/pod.go b/pkg/benchmark/pod.go index 65337d1de3..115b57306b 100644 --- a/pkg/benchmark/pod.go +++ b/pkg/benchmark/pod.go @@ -54,8 +54,8 @@ var _ = framework.KubeDescribe("PodSandbox", func() { N: framework.TestContext.BenchmarkingParams.PodsNumber, NumParallel: framework.TestContext.BenchmarkingParams.PodsNumberParallel, } - if samplingConfig.N < 1 { - samplingConfig.N = 1 + if samplingConfig.N <= 0 { + Skip("skipping pod lifecycle benchmarks since pod number option was not set") } if samplingConfig.NumParallel < 1 { samplingConfig.NumParallel = 1