blob: 157bcc26e06de2923db95097f93d6afa9a6a09f7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import (
"net"
"net/http"
"testing"
)
func TestConfigurationURL(t *testing.T) {
// we try a DNS resolution first. If it fails, it means we're
// likely in the sandbox, and we need to skip this test.
_, err := net.LookupHost("fcuny.net")
if err != nil {
t.Skipf("no network connectivity: %v", err)
}
cfg, err := loadConfig()
if err != nil {
t.Fatal(err)
}
for _, r := range cfg.Repositories {
res, err := http.Get(r.Repo)
if err != nil {
t.Errorf("failed to request %s: %v", r.Repo, err)
}
if res.StatusCode != http.StatusOK {
t.Errorf("HTTP status for %s is: %d - %s", r.Repo, res.StatusCode, res.Status)
}
}
}
|