Skip to content

Commit

Permalink
test: add benchmark for listworkflows with label selector
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Malone <[email protected]>
  • Loading branch information
MasonM committed Oct 16, 2024
1 parent 5711f07 commit 8421a79
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/e2e/workflow_archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

sutils "github.com/argoproj/argo-workflows/v3/server/utils"
"github.com/argoproj/argo-workflows/v3/test/e2e/fixtures"
"k8s.io/apimachinery/pkg/labels"
)

func BenchmarkWorkflowArchive(b *testing.B) {
Expand All @@ -16,6 +17,9 @@ func BenchmarkWorkflowArchive(b *testing.B) {
suite.SetupSuite()
b.ResetTimer()

// Uncomment the following line to log queries to stdout
//db.LC().SetLevel(db.LogLevelDebug)

b.Run("ListWorkflows", func(b *testing.B) {
for range b.N {
wfs, err := suite.Persistence.WorkflowArchive.ListWorkflows(sutils.ListOptions{
Expand All @@ -28,6 +32,23 @@ func BenchmarkWorkflowArchive(b *testing.B) {
}
})

b.Run("ListWorkflows with label selector", func(b *testing.B) {
requirements, err := labels.ParseToRequirements("workflows.argoproj.io/phase=Succeeded")
if err != nil {
b.Fatal(err)
}
for range b.N {
wfs, err := suite.Persistence.WorkflowArchive.ListWorkflows(sutils.ListOptions{
Limit: 100,
LabelRequirements: requirements,
})
if err != nil {
b.Fatal(err)
}
b.Logf("Found %d workflows", wfs.Len())
}
})

b.Run("CountWorkflows", func(b *testing.B) {
for range b.N {
wfCount, err := suite.Persistence.WorkflowArchive.CountWorkflows(sutils.ListOptions{})
Expand Down

0 comments on commit 8421a79

Please sign in to comment.