aboutsummaryrefslogtreecommitdiff
path: root/tests/shared_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/shared_test.go')
-rw-r--r--tests/shared_test.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/shared_test.go b/tests/shared_test.go
index 54934ff..d6271a6 100644
--- a/tests/shared_test.go
+++ b/tests/shared_test.go
@@ -19,7 +19,7 @@
package tests
import (
- "crypto/md5"
+ "crypto/md5" //nolint:gosec // Etag uses md5
"crypto/rand"
"encoding/hex"
"math"
@@ -107,7 +107,7 @@ func testWithContainer(t *testing.T, testCode func(c *schwift.Container)) {
////////////////////////////////////////////////////////////////////////////////
func etagOf(buf []byte) string {
- hash := md5.Sum(buf)
+ hash := md5.Sum(buf) //nolint:gosec // Etag uses md5
return hex.EncodeToString(hash[:])
}
@@ -124,7 +124,7 @@ func getRandomName() string {
return hex.EncodeToString(buf[:])
}
-func getRandomSegmentContent(length int) string {
+func getRandomSegmentContent(length int) string { //nolint:unparam
buf := make([]byte, length/2)
_, err := rand.Read(buf)
if err != nil {
@@ -177,17 +177,13 @@ func expectString(t *testing.T, actual, expected string) {
}
}
-func expectError(t *testing.T, actual error, expected string) (ok bool) {
+func expectError(t *testing.T, actual error, expected string) {
t.Helper()
if actual == nil {
t.Errorf("expected error %q, got no error\n", expected)
- return false
- }
- if expected != actual.Error() {
+ } else if expected != actual.Error() {
t.Errorf("expected error %q, got %q instead\n", expected, actual.Error())
- return false
}
- return true
}
func expectSuccess(t *testing.T, actual error) (ok bool) {
@@ -199,7 +195,7 @@ func expectSuccess(t *testing.T, actual error) (ok bool) {
return true
}
-func expectHeaders(t *testing.T, actual map[string]string, expected map[string]string) {
+func expectHeaders(t *testing.T, actual, expected map[string]string) {
t.Helper()
reported := make(map[string]bool)