Skip to content

use jsonchecker.JsonTestExpect() for negative tests #4297

@kkourt

Description

@kkourt

In some cases, we want to test for the absence of certain events.

Some tests use something like the following to do this:

err := jsonchecker.JsonTestCheck(t, checker)
require.Error(t, err)

The problem with above is that JsonTestCheck does some tricks to keep the event log if there is a failure, so it needs to understand what a failure is. Hence, using jsonchecker.JsonTestExpect with expectCheckerFailure=true is a better approach. We should fix this in the existing tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions