diff options
| author | Stefan Majewsky <stefan.majewsky@sap.com> | 2022-10-28 16:06:40 +0200 |
|---|---|---|
| committer | Stefan Majewsky <stefan.majewsky@sap.com> | 2022-10-28 16:06:40 +0200 |
| commit | 90dd519a948d06738479c04d331f28dfab99315c (patch) | |
| tree | d4a9914cb73be3dbe9438b012a08408d79bdb7c9 /tests/shared_test.go | |
| parent | fd6e57b6239655722884a49a86be0f051cc32bde (diff) | |
| parent | 5cf9b60d2ded95d29827389a1a5901f1068d4337 (diff) | |
| download | go-schwift-90dd519a948d06738479c04d331f28dfab99315c.tar.gz | |
Merge remote-tracking branch 'SuperSandro2000:sha2'
Diffstat (limited to 'tests/shared_test.go')
| -rw-r--r-- | tests/shared_test.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/tests/shared_test.go b/tests/shared_test.go index 36404bd..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" @@ -30,6 +30,7 @@ import ( "github.com/gophercloud/gophercloud/openstack" "github.com/gophercloud/gophercloud/openstack/objectstorage/v1/swauth" "github.com/gophercloud/utils/openstack/clientconfig" + "github.com/majewsky/schwift" "github.com/majewsky/schwift/gopherschwift" ) @@ -106,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[:]) } @@ -123,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 { @@ -176,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) { @@ -198,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) |
