Skip to content

Commit

Permalink
fix: use differente baseline for different mode
Browse files Browse the repository at this point in the history
Signed-off-by: Yadong Ding <ding_yadong@foxmail.com>
  • Loading branch information
Desiki-high committed Nov 19, 2023
1 parent 7072794 commit 006436b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion smoke/tests/performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (p *PerformanceTestSuite) TestPerformance(t *testing.T) {

// run Contaienr
p.testContainerName = uuid.NewString()
tool.RunContainer(p.t, p.testImage, p.testContainerName)
tool.RunContainer(p.t, p.testImage, p.testContainerName, mode)
clearContainer(p.t, p.testImage, p.testContainerName)
}

Expand Down
24 changes: 16 additions & 8 deletions smoke/tests/tool/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,23 @@ type ContainerMetrics struct {

type RunArgs struct {
WaitURL string
BaselineReadCount uint64
BaselineReadAmount uint64
BaselineReadCount map[string]uint64
BaselineReadAmount map[string]uint64
}

var URL_WAIT = map[string]RunArgs{
"wordpress": {
WaitURL: "http://localhost:80",
BaselineReadCount: 131,
BaselineReadAmount: 77580818,
WaitURL: "http://localhost:80",
BaselineReadCount: map[string]uint64{
"nydus_v5": 328,
"nydus_v6": 131,
"zran": 186,
},
BaselineReadAmount: map[string]uint64{
"nydus_v5": 54307819,
"nydus_v6": 77580818,
"zran": 79836339,
},
},
}

Expand Down Expand Up @@ -71,7 +79,7 @@ func runUrlWaitContainer(t *testing.T, image string, containerName string, runAr

// RunContainer and get metrics from api socket.
// Test will fail if performance below baseline.
func RunContainer(t *testing.T, image string, containerName string) {
func RunContainer(t *testing.T, image string, containerName string, mode string) {
args, ok := URL_WAIT[ImageRepo(t, image)]
if ok {
runUrlWaitContainer(t, image, containerName, args)
Expand All @@ -80,8 +88,8 @@ func RunContainer(t *testing.T, image string, containerName string) {
if err != nil {
t.Logf(err.Error())
}
if containerMetrics.ReadAmountTotal > uint64(float64(args.BaselineReadAmount)*1.05) ||
containerMetrics.ReadCount > uint64(float64(args.BaselineReadCount)*1.05) {
if containerMetrics.ReadAmountTotal > uint64(float64(args.BaselineReadAmount[mode])*1.05) ||
containerMetrics.ReadCount > uint64(float64(args.BaselineReadCount[mode])*1.05) {
t.Fatalf(fmt.Sprintf("Performance reduction with ReadAmount %d and ReadCount %d", containerMetrics.ReadAmountTotal, containerMetrics.ReadCount))
}
t.Logf(fmt.Sprintf("Performance Test: ReadAmount %d and ReadCount %d", containerMetrics.ReadAmountTotal, containerMetrics.ReadCount))
Expand Down

0 comments on commit 006436b

Please sign in to comment.