forked from TrueCloudLab/distribution
gofmt -s do code format
Signed-off-by: spacexnice <yaoyao.xyy@alibaba-inc.com>
This commit is contained in:
parent
ca2b78dc0a
commit
22cf89c02b
2 changed files with 5 additions and 6 deletions
|
@ -49,9 +49,9 @@ func NewSimpleChallengeManager() ChallengeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type simpleChallengeManager struct{
|
type simpleChallengeManager struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
Challanges map[string][]Challenge
|
Challanges map[string][]Challenge
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *simpleChallengeManager) GetChallenges(endpoint url.URL) ([]Challenge, error) {
|
func (m *simpleChallengeManager) GetChallenges(endpoint url.URL) ([]Challenge, error) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAuthChallengeParse(t *testing.T) {
|
func TestAuthChallengeParse(t *testing.T) {
|
||||||
|
@ -82,7 +82,6 @@ func testAuthChallengeNormalization(t *testing.T, host string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func testAuthChallengeConcurrent(t *testing.T, host string) {
|
func testAuthChallengeConcurrent(t *testing.T, host string) {
|
||||||
|
|
||||||
scm := NewSimpleChallengeManager()
|
scm := NewSimpleChallengeManager()
|
||||||
|
@ -104,7 +103,7 @@ func testAuthChallengeConcurrent(t *testing.T, host string) {
|
||||||
s.Add(2)
|
s.Add(2)
|
||||||
go func() {
|
go func() {
|
||||||
|
|
||||||
for i:=0 ; i<200; i++ {
|
for i := 0; i < 200; i++ {
|
||||||
err = scm.AddResponse(resp)
|
err = scm.AddResponse(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -115,7 +114,7 @@ func testAuthChallengeConcurrent(t *testing.T, host string) {
|
||||||
go func() {
|
go func() {
|
||||||
lowered := *url
|
lowered := *url
|
||||||
lowered.Host = strings.ToLower(lowered.Host)
|
lowered.Host = strings.ToLower(lowered.Host)
|
||||||
for k := 0; k < 200 ; k++ {
|
for k := 0; k < 200; k++ {
|
||||||
_, err := scm.GetChallenges(lowered)
|
_, err := scm.GetChallenges(lowered)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
Loading…
Reference in a new issue