diff --git a/test/e2e/workflow_archive_test.go b/test/e2e/workflow_archive_test.go index ce00e5ccf064..5a0006aa5e3b 100644 --- a/test/e2e/workflow_archive_test.go +++ b/test/e2e/workflow_archive_test.go @@ -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) { @@ -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{ @@ -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{})