multi: move many t.Fatalf calls to require.NoError

This commit is contained in:
Tommy Volk committed 2022-06-17 04:26:55 +00:00
1 parent 9e6f0ef46b
commit 9a10c80bcb
92 files changed
+1905 -5565

No files matched your search

+4 -12
View File
@@ -23,9 +23,7 @@ func createDummyMacaroon(t *testing.T) *macaroon.Macaroon {
dummyMacaroon, err := macaroon.New(
testRootKey, testID, testLocation, testVersion,
)
if err != nil {
t.Fatalf("Error creating initial macaroon: %v", err)
}
require.NoError(t, err, "Error creating initial macaroon")
return dummyMacaroon
}
@@ -41,9 +39,7 @@ func TestAddConstraints(t *testing.T) {
newMac, err := macaroons.AddConstraints(
initialMac, macaroons.TimeoutConstraint(1),
)
if err != nil {
t.Fatalf("Error adding constraint: %v", err)
}
require.NoError(t, err, "Error adding constraint")
if &newMac == &initialMac {
t.Fatalf("Initial macaroon has been changed, something " +
"went wrong!")
@@ -66,9 +62,7 @@ func TestTimeoutConstraint(t *testing.T) {
// function to.
testMacaroon := createDummyMacaroon(t)
err := constraintFunc(testMacaroon)
if err != nil {
t.Fatalf("Error applying timeout constraint: %v", err)
}
require.NoError(t, err, "Error applying timeout constraint")
// Finally, check that the created caveat has an
// acceptable value.
@@ -92,9 +86,7 @@ func TestIpLockConstraint(t *testing.T) {
// function to.
testMacaroon := createDummyMacaroon(t)
err := constraintFunc(testMacaroon)
if err != nil {
t.Fatalf("Error applying timeout constraint: %v", err)
}
require.NoError(t, err, "Error applying timeout constraint")
// Finally, check that the created caveat has an
// acceptable value.