Skip to content

Commit

Permalink
Merge pull request #2514 from shiftstack/objectstorage_test_expected
Browse files Browse the repository at this point in the history
objectstorage testing: Fix order of assertions
  • Loading branch information
mandre committed Nov 24, 2022
2 parents 4cc91e5 + b0961d4 commit 1112837
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestListContainerInfo(t *testing.T) {
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
th.CheckEquals(t, 1, count)
}

func TestListAllContainerInfo(t *testing.T) {
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestListContainerNames(t *testing.T) {
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
th.CheckEquals(t, 1, count)
}

func TestListAllContainerNames(t *testing.T) {
Expand Down
18 changes: 9 additions & 9 deletions openstack/objectstorage/v1/objects/testing/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestDownloadWithLastModified(t *testing.T) {
response2 := objects.Download(fake.ServiceClient(), "testContainer", "testObject", options2)
content, err2 := response2.ExtractContent()
th.AssertNoErr(t, err2)
th.AssertEquals(t, len(content), 0)
th.AssertEquals(t, 0, len(content))
}

func TestListObjectInfo(t *testing.T) {
Expand All @@ -95,7 +95,7 @@ func TestListObjectInfo(t *testing.T) {
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
th.CheckEquals(t, 1, count)
}

func TestListObjectSubdir(t *testing.T) {
Expand All @@ -115,7 +115,7 @@ func TestListObjectSubdir(t *testing.T) {
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
th.CheckEquals(t, 1, count)
}

func TestListObjectNames(t *testing.T) {
Expand All @@ -139,7 +139,7 @@ func TestListObjectNames(t *testing.T) {
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
th.CheckEquals(t, 1, count)

// Check with delimiter.
count = 0
Expand All @@ -157,7 +157,7 @@ func TestListObjectNames(t *testing.T) {
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
th.CheckEquals(t, 1, count)
}

func TestListZeroObjectNames204(t *testing.T) {
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestGetObject(t *testing.T) {
}
actualHeaders, err := objects.Get(fake.ServiceClient(), "testContainer", "testObject", getOpts).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, actualHeaders.StaticLargeObject, true)
th.AssertEquals(t, true, actualHeaders.StaticLargeObject)
}

func TestETag(t *testing.T) {
Expand All @@ -326,7 +326,7 @@ func TestETag(t *testing.T) {
_, headers, _, err := createOpts.ToObjectCreateParams()
th.AssertNoErr(t, err)
_, ok := headers["ETag"]
th.AssertEquals(t, ok, false)
th.AssertEquals(t, false, ok)

hash := md5.New()
io.WriteString(hash, content)
Expand All @@ -339,7 +339,7 @@ func TestETag(t *testing.T) {

_, headers, _, err = createOpts.ToObjectCreateParams()
th.AssertNoErr(t, err)
th.AssertEquals(t, headers["ETag"], localChecksum)
th.AssertEquals(t, localChecksum, headers["ETag"])
}

func TestObjectCreateParamsWithoutSeek(t *testing.T) {
Expand All @@ -352,7 +352,7 @@ func TestObjectCreateParamsWithoutSeek(t *testing.T) {
th.AssertNoErr(t, err)

_, ok := reader.(io.ReadSeeker)
th.AssertEquals(t, ok, true)
th.AssertEquals(t, true, ok)

c, err := ioutil.ReadAll(reader)
th.AssertNoErr(t, err)
Expand Down
2 changes: 1 addition & 1 deletion openstack/objectstorage/v1/swauth/testing/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAuth(t *testing.T) {

swiftClient, err := swauth.NewObjectStorageV1(providerClient, authOpts)
th.AssertNoErr(t, err)
th.AssertEquals(t, swiftClient.TokenID, AuthResult.Token)
th.AssertEquals(t, AuthResult.Token, swiftClient.TokenID)
}

func TestBadAuth(t *testing.T) {
Expand Down

0 comments on commit 1112837

Please sign in to comment.