Skip to content

Don't panic and fail test early #156

@urso

Description

@urso

The tests in go-ucfg use the .../testify/assert package for validation, but sometimes also for checking on intermediate errors. The assert package only logs an error to *testing.T, but continues the test run. If there is a dependency on an operation to succeed (e.g. calling NewFrom), then the test should fail immediately pointing out the failing line in code. This can be achieved by using t.Fatal(f), use .../testify/require instead of assert, or use constructors that can panic like MustNewFrom instead of NewFrom.

By not failing and returning the test early, there might be a chance that validation/operations will panic. In this case the errors/logs stored in *testing.T will not be written to console, and the actual failure can't be inspected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions