Make serverconfig tests pass again.

Change-Id: I83077f7573a81b643639c78de1a72169e82b09e9
This commit is contained in:
Brad Fitzpatrick 2012-10-20 12:33:39 -07:00
parent d0faee5726
commit 0645035db7
9 changed files with 11 additions and 15 deletions

View File

@ -122,13 +122,13 @@ func testConfig(name string, t *testing.T) {
}
lowLevelConf, err := serverconfig.GenLowLevelConfig(&serverconfig.Config{Obj: obj})
if err != nil {
t.Fatal(err)
t.Fatalf("test %s: GenLowLevelConfig: %v", name, err)
}
baseName := strings.Replace(filepath.Base(name), ".json", "", 1)
wantFile := strings.Replace(name, ".json", "-want.json", 1)
wantConf, err := configParser().ReadFile(wantFile)
if err != nil {
t.Fatal(err)
t.Fatalf("test %s: ReadFile: %v", name, err)
}
var got, want bytes.Buffer
prettyPrint(&got, lowLevelConf.Obj, 0)
@ -140,10 +140,10 @@ func testConfig(name string, t *testing.T) {
defer os.Remove(tempWant.Name())
diff, err := exec.Command("diff", "-u", tempWant.Name(), tempGot.Name()).Output()
if err != nil {
t.Logf("diff failure: %v", err)
t.Logf("test %s diff failure: %v", name, err)
}
t.Errorf("Configurations differ.\nGot:\n%s\nWant:\n%s\nDiff:\n%s",
&got, &want, diff)
t.Errorf("test %s configurations differ.\nGot:\n%s\nWant:\n%s\nDiff:\n%s",
name, &got, &want, diff)
}
}

View File

@ -1,6 +1,5 @@
{
"listen": "localhost:3179",
"baseURL": "http://localhost:3179",
"auth": "userpass:camlistore:pass3179",
"https": false,
"prefixes": {

View File

@ -1,6 +1,6 @@
{
"listen": "localhost:3179",
"TLS": false,
"https": false,
"auth": "userpass:camlistore:pass3179",
"blobPath": "/tmp/blobs",
"identity": "26F5ABDA",

View File

@ -1,6 +1,5 @@
{
"listen": "1.2.3.4:443",
"baseURL": "https://1.2.3.4:443",
"auth": "userpass:camlistore:pass3179",
"https": true,
"TLSCertFile": "/tls.crt",

View File

@ -1,8 +1,8 @@
{
"listen": "1.2.3.4:443",
"TLS": true,
"TLSCertFile": "/tls.crt",
"TLSKeyFile": "/tls.key",
"https": true,
"HTTPSCertFile": "/tls.crt",
"HTTPSKeyFile": "/tls.key",
"auth": "userpass:camlistore:pass3179",
"blobPath": "/tmp/blobs",
"identity": "26F5ABDA",

View File

@ -1,6 +1,5 @@
{
"listen": "localhost:3179",
"baseURL": "http://localhost:3179",
"auth": "userpass:camlistore:pass3179",
"https": false,
"prefixes": {

View File

@ -1,6 +1,6 @@
{
"listen": "localhost:3179",
"TLS": false,
"https": false,
"auth": "userpass:camlistore:pass3179",
"blobPath": "/tmp/blobs",
"identity": "26F5ABDA",

View File

@ -1,6 +1,5 @@
{
"listen": "localhost:3179",
"baseURL": "http://localhost:3179",
"auth": "userpass:camlistore:pass3179",
"https": false,
"prefixes": {

View File

@ -1,6 +1,6 @@
{
"listen": "localhost:3179",
"TLS": false,
"https": false,
"auth": "userpass:camlistore:pass3179",
"blobPath": "/tmp/blobs",
"identity": "26F5ABDA",