celestiaorg / knuu

Integration Test Framework
Apache License 2.0
38 stars 31 forks source link

Consider using regular log in the test cleanup function instead of fail now error #428

Open mojtaba-esk opened 3 weeks ago

mojtaba-esk commented 3 weeks ago

Currently if the cleanup function for a test fails, it fails the entire test which is not ideal.

t.Cleanup(func() {
    require.NoError(t, instance.Destroy(context.Background()))
})

it is suggested to avoid that issue, simply use something that does not impact on the test validity like the following:

t.Cleanup(func() {
    err:= instance.Destroy(context.Background())
    if err != nil{
        t.Logf("cleanup failed: %w", err)
    }
})