registry/handlers: use consistent names for test-tables
Also marked assertBlobUploadStateEquals as t.Helper() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
f4acd98865
commit
85028a801b
1 changed files with 7 additions and 6 deletions
|
@ -45,8 +45,8 @@ var secrets = []string{
|
||||||
func TestLayerUploadTokens(t *testing.T) {
|
func TestLayerUploadTokens(t *testing.T) {
|
||||||
secret := hmacKey("supersecret")
|
secret := hmacKey("supersecret")
|
||||||
|
|
||||||
for _, testcase := range blobUploadStates {
|
for _, tc := range blobUploadStates {
|
||||||
token, err := secret.packUploadState(testcase)
|
token, err := secret.packUploadState(tc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ func TestLayerUploadTokens(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertBlobUploadStateEquals(t, testcase, lus)
|
assertBlobUploadStateEquals(t, tc, lus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ func TestHMACValidation(t *testing.T) {
|
||||||
secret2 := hmacKey(secret)
|
secret2 := hmacKey(secret)
|
||||||
badSecret := hmacKey("DifferentSecret")
|
badSecret := hmacKey("DifferentSecret")
|
||||||
|
|
||||||
for _, testcase := range blobUploadStates {
|
for _, tc := range blobUploadStates {
|
||||||
token, err := secret1.packUploadState(testcase)
|
token, err := secret1.packUploadState(tc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func TestHMACValidation(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertBlobUploadStateEquals(t, testcase, lus)
|
assertBlobUploadStateEquals(t, tc, lus)
|
||||||
|
|
||||||
_, err = badSecret.unpackUploadState(token)
|
_, err = badSecret.unpackUploadState(token)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -105,6 +105,7 @@ func TestHMACValidation(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertBlobUploadStateEquals(t *testing.T, expected blobUploadState, received blobUploadState) {
|
func assertBlobUploadStateEquals(t *testing.T, expected blobUploadState, received blobUploadState) {
|
||||||
|
t.Helper()
|
||||||
if expected.Name != received.Name {
|
if expected.Name != received.Name {
|
||||||
t.Fatalf("Expected Name=%q, Received Name=%q", expected.Name, received.Name)
|
t.Fatalf("Expected Name=%q, Received Name=%q", expected.Name, received.Name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue