Skip to content

Commit

Permalink
ci: Speed up e2e tests (argoproj#4436)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Collins <[email protected]>
  • Loading branch information
alexec committed Nov 2, 2020
1 parent 0d13f40 commit 6016ebd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions test/e2e/fixtures/e2e_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,39 @@ func (s *E2ESuite) BeforeTest(string, string) {
}

var foreground = metav1.DeletePropagationForeground
var foregroundDelete = &metav1.DeleteOptions{PropagationPolicy: &foreground}
var background = metav1.DeletePropagationBackground

func (s *E2ESuite) DeleteResources() {
// delete archived workflows from the archive
if s.Persistence.IsEnabled() {
archive := s.Persistence.workflowArchive
parse, err := labels.ParseToRequirements(Label)
s.CheckError(err)
workflows, err := archive.ListWorkflows(Namespace, time.Time{}, time.Time{}, parse, 0, 0)
s.CheckError(err)
for _, w := range workflows {
err := archive.DeleteWorkflow(string(w.UID))
s.CheckError(err)
}
}

hasTestLabel := metav1.ListOptions{LabelSelector: Label}
resources := []schema.GroupVersionResource{
{Group: workflow.Group, Version: workflow.Version, Resource: workflow.CronWorkflowPlural},
{Group: workflow.Group, Version: workflow.Version, Resource: workflow.WorkflowEventBindingPlural},
{Group: workflow.Group, Version: workflow.Version, Resource: workflow.WorkflowPlural},
{Group: workflow.Group, Version: workflow.Version, Resource: workflow.WorkflowTemplatePlural},
{Group: workflow.Group, Version: workflow.Version, Resource: workflow.ClusterWorkflowTemplatePlural},
{Group: workflow.Group, Version: workflow.Version, Resource: workflow.WorkflowEventBindingPlural},
{Version: "v1", Resource: "resourcequotas"},
{Version: "v1", Resource: "configmaps"},
}

for _, r := range resources {
err := s.dynamicFor(r).DeleteCollection(foregroundDelete, hasTestLabel)
err := s.dynamicFor(r).DeleteCollection(&metav1.DeleteOptions{PropagationPolicy: &background}, hasTestLabel)
s.CheckError(err)
}

// delete archived workflows from the archive
if s.Persistence.IsEnabled() {
archive := s.Persistence.workflowArchive
parse, err := labels.ParseToRequirements(Label)
s.CheckError(err)
workflows, err := archive.ListWorkflows(Namespace, time.Time{}, time.Time{}, parse, 0, 0)
s.CheckError(err)
for _, w := range workflows {
err := archive.DeleteWorkflow(string(w.UID))
s.CheckError(err)
}
}

for _, r := range resources {
for {
list, err := s.dynamicFor(r).List(hasTestLabel)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixtures/when.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (w *When) DeleteMemoryQuota() *When {

func (w *When) deleteResourceQuota(name string) *When {
w.t.Helper()
err := w.kubeClient.CoreV1().ResourceQuotas(Namespace).Delete(name, foregroundDelete)
err := w.kubeClient.CoreV1().ResourceQuotas(Namespace).Delete(name, &metav1.DeleteOptions{PropagationPolicy: &foreground})
if err != nil {
w.t.Fatal(err)
}
Expand Down

0 comments on commit 6016ebd

Please sign in to comment.