mirror of
https://github.com/genuinetools/reg.git
synced 2024-05-10 00:38:31 -04:00
e29a4fdc2e
* change accepts header * change accepts header * skip gcr ping check * update go.sum * fix lint errors * fix lint errors * update go.mod
32 lines
631 B
Go
32 lines
631 B
Go
package registry
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestPingable(t *testing.T) {
|
|
testcases := map[string]struct {
|
|
registry Registry
|
|
expect bool
|
|
}{
|
|
"Docker": {
|
|
registry: Registry{URL: "https://registry-1.docker.io"},
|
|
expect: true,
|
|
},
|
|
"GCR_global": {
|
|
registry: Registry{URL: "https://gcr.io"},
|
|
expect: false,
|
|
},
|
|
"GCR_asia": {
|
|
registry: Registry{URL: "https://asia.gcr.io"},
|
|
expect: false,
|
|
},
|
|
}
|
|
for label, testcase := range testcases {
|
|
actual := testcase.registry.Pingable()
|
|
if testcase.expect != actual {
|
|
t.Fatalf("%s: expected (%v), got (%v)", label, testcase.expect, actual)
|
|
}
|
|
}
|
|
}
|