Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Run credentials tests in parallel #2254

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions registry/credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/base64"
"fmt"
"testing"
"time"

"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -88,19 +87,20 @@ func TestRemoteFactory_ParseHost(t *testing.T) {
error: true,
},
} {
stringCreds := fmt.Sprintf(tmpl, v.host, okCreds)
creds, err := ParseCredentials("test", []byte(stringCreds))
time.Sleep(100 * time.Millisecond)
if (err != nil) != v.error {
t.Fatalf("For test %q, expected error = %v but got %v", v.host, v.error, err != nil)
}
if v.error {
continue
}
actualUser := creds.credsFor(v.imagePrefix).username
assert.Equal(t, user, actualUser, "For test %q, expected %q but got %v", v.host, user, actualUser)
actualPass := creds.credsFor(v.imagePrefix).password
assert.Equal(t, pass, actualPass, "For test %q, expected %q but got %v", v.host, user, actualPass)
t.Run(v.host, func(t *testing.T) {
stringCreds := fmt.Sprintf(tmpl, v.host, okCreds)
creds, err := ParseCredentials("test", []byte(stringCreds))
if (err != nil) != v.error {
t.Fatalf("For test %q, expected error = %v but got %v", v.host, v.error, err != nil)
}
if v.error {
return
}
actualUser := creds.credsFor(v.imagePrefix).username
assert.Equal(t, user, actualUser, "For test %q, expected %q but got %v", v.host, user, actualUser)
actualPass := creds.credsFor(v.imagePrefix).password
assert.Equal(t, pass, actualPass, "For test %q, expected %q but got %v", v.host, user, actualPass)
})
}
}

Expand Down