Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

prevent the "Expect(err).NotTo(HaveOccurred())" and "ExpectNoError(err)" anti-pattern in e2e tests #109600

Copy link
Copy link
Open
@pohly

Description

@pohly
Issue body actions

What would you like to be added?

This was previously tracked in #34059 (created in 2016, closed in 2020 after several tests were enhanced).

I'm starting to wonder whether the problem is getting worse again because we still don't catch new tests that use this anti-pattern (for example, #107763).

Is it time to start another spring clean which removes occurrences of this anti-pattern? Or perhaps add some mechanism that prevents it in new code?

/sig testing
/area e2e-test-framework

Why is this needed?

I'm getting tired of seeing failures where the only output is

Expected error:
    <*errors.errorString | 0xc820412c10>: {
        s: "timed out waiting for the condition",
    }
    timed out waiting for the condition
not to have occurred

This is the result of

Expect(err).NotTo(HaveOccurred())

or more recently

ExpectNoError(err)

An explanation string would help, but even better solutions would be possible (#106575).

Metadata

Metadata

Assignees

Labels

area/e2e-test-frameworkIssues or PRs related to refactoring the kubernetes e2e test frameworkIssues or PRs related to refactoring the kubernetes e2e test frameworkkind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.sig/testingCategorizes an issue or PR as relevant to SIG Testing.Categorizes an issue or PR as relevant to SIG Testing.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.