Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail E2E test if AfterEach/AfterSuite fails #1502

Merged
merged 2 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type Framework struct {
// Guaranteed to be unique in the cluster even when running the same
// test multiple times in parallel.
UniqueName string
stopped bool
SkipNamespaceCreation bool // Whether to skip creating a namespace
Namespace string // Every test has a namespace at least unless creation is skipped
namespacesToDelete map[string]bool // Some tests have more than one.
Expand Down Expand Up @@ -415,6 +416,7 @@ func deleteNamespace(client kubeclientset.Interface, namespaceName string) error

// AfterEach deletes the namespace, after reading its events.
func (f *Framework) AfterEach() {
f.stopped = true
RemoveCleanupAction(f.cleanupHandle)

var nsDeletionErrors []error
Expand All @@ -435,7 +437,7 @@ func (f *Framework) AfterEach() {

// if we had errors deleting, report them now.
if len(nsDeletionErrors) != 0 {
Failf(k8serrors.NewAggregate(nsDeletionErrors).Error())
Errorf(k8serrors.NewAggregate(nsDeletionErrors).Error())
}
}

Expand Down
5 changes: 5 additions & 0 deletions test/e2e/framework/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func (f *Framework) SetGatewayLabelOnNode(ctx context.Context, cluster ClusterIn
PatchString("/metadata/labels/"+strings.ReplaceAll(GatewayLabel, "/", "~1"), strconv.FormatBool(isGateway),
func(pt types.PatchType, payload []byte) error {
_, err := KubeClients[cluster].CoreV1().Nodes().Patch(ctx, nodeName, pt, payload, metav1.PatchOptions{})
if err != nil && f.stopped {
Errorf("Error setting gateway label on node %q: %v", nodeName, err)
err = nil
}

return err
})
}
Loading