Skip to content

Commit

Permalink
Delete clusterscoped resource in teardown
Browse files Browse the repository at this point in the history
This will delete the clusterscoped resources we are creating
in event listener e2e tests during teardown

Fix tektoncd#418
  • Loading branch information
piyush-garg authored and tekton-robot committed Feb 6, 2020
1 parent 46c7c2e commit 7ba80a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ func tearDown(t *testing.T, cs *clients, namespace string) {
if err := cs.KubeClient.CoreV1().Namespaces().Delete(namespace, &metav1.DeleteOptions{}); err != nil {
t.Errorf("Failed to delete namespace %s: %s", namespace, err)
}

t.Logf("Deleting Clusterscoped resource")
if err := cs.KubeClient.RbacV1().ClusterRoles().Delete("my-role", &metav1.DeleteOptions{}); err != nil {
t.Errorf("Failed to delete clusterrole my-role: %s", err)
}

if err := cs.KubeClient.RbacV1().ClusterRoleBindings().Delete("my-rolebinding", &metav1.DeleteOptions{}); err != nil {
t.Errorf("Failed to delete clusterrolebinding my-rolebinding: %s", err)
}

if err := cs.TriggersClient.TektonV1alpha1().ClusterTriggerBindings().Delete("my-clustertriggerbinding", &metav1.DeleteOptions{}); err != nil {
t.Errorf("Failed to delete clustertriggerbinding my-clustertriggerbinding: %s", err)
}
}

func header(logf logging.FormatLogger, text string) {
Expand Down

0 comments on commit 7ba80a7

Please sign in to comment.