Commit 1b1866d8 authored by Clayton Coleman's avatar Clayton Coleman

Invalid JSON in examples and tests

parent a8f2cee8
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"name": "kubernetes-serve-hostname", "name": "kubernetes-serve-hostname",
"image": "kubernetes/serve_hostname", "image": "kubernetes/serve_hostname",
"cpu": 1000, "cpu": 1000,
"memory": 1048576, "memory": 1048576
}] }]
} }
}, }
} }
...@@ -73,7 +73,7 @@ var aPod string = ` ...@@ -73,7 +73,7 @@ var aPod string = `
"manifest": { "manifest": {
"version": "v1beta1", "version": "v1beta1",
"id": "a", "id": "a",
"containers": [{ "name": "foo", "image": "bar/foo", }] "containers": [{ "name": "foo", "image": "bar/foo" }]
} }
}%s }%s
} }
...@@ -87,7 +87,7 @@ var aPodInBar string = ` ...@@ -87,7 +87,7 @@ var aPodInBar string = `
"manifest": { "manifest": {
"version": "v1beta1", "version": "v1beta1",
"id": "a", "id": "a",
"containers": [{ "name": "foo", "image": "bar/foo", }] "containers": [{ "name": "foo", "image": "bar/foo" }]
} }
}%s }%s
} }
...@@ -107,12 +107,13 @@ var aRC string = ` ...@@ -107,12 +107,13 @@ var aRC string = `
"id": "a", "id": "a",
"containers": [{ "containers": [{
"name": "foo", "name": "foo",
"image": "bar/foo", "image": "bar/foo"
}] }]
} }
}, },
"labels": {"name": "a"} "labels": {"name": "a"}
}}, }
},
"labels": {"name": "a"}%s "labels": {"name": "a"}%s
} }
` `
...@@ -145,7 +146,7 @@ var aEvent string = ` ...@@ -145,7 +146,7 @@ var aEvent string = `
"kind": "Minion", "kind": "Minion",
"name": "a", "name": "a",
"namespace": "default", "namespace": "default",
"apiVersion": "v1beta1", "apiVersion": "v1beta1"
}%s }%s
} }
` `
...@@ -343,10 +344,11 @@ func TestAuthModeAlwaysAllow(t *testing.T) { ...@@ -343,10 +344,11 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
sub += fmt.Sprintf(",\r\n\"resourceVersion\": %v", resVersion) sub += fmt.Sprintf(",\r\n\"resourceVersion\": %v", resVersion)
} }
namespace := "default" namespace := "default"
sub += fmt.Sprintf(",\r\n\"namespace\": %v", namespace) sub += fmt.Sprintf(",\r\n\"namespace\": %q", namespace)
} }
bodyStr = fmt.Sprintf(r.body, sub) bodyStr = fmt.Sprintf(r.body, sub)
} }
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr)) bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes) req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil { if err != nil {
...@@ -514,10 +516,11 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) { ...@@ -514,10 +516,11 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
sub += fmt.Sprintf(",\r\n\"resourceVersion\": %v", resVersion) sub += fmt.Sprintf(",\r\n\"resourceVersion\": %v", resVersion)
} }
namespace := "default" namespace := "default"
sub += fmt.Sprintf(",\r\n\"namespace\": %v", namespace) sub += fmt.Sprintf(",\r\n\"namespace\": %q", namespace)
} }
bodyStr = fmt.Sprintf(r.body, sub) bodyStr = fmt.Sprintf(r.body, sub)
} }
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr)) bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes) req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil { if err != nil {
...@@ -767,10 +770,11 @@ func TestNamespaceAuthorization(t *testing.T) { ...@@ -767,10 +770,11 @@ func TestNamespaceAuthorization(t *testing.T) {
if len(namespace) == 0 { if len(namespace) == 0 {
namespace = "default" namespace = "default"
} }
sub += fmt.Sprintf(",\r\n\"namespace\": %v", namespace) sub += fmt.Sprintf(",\r\n\"namespace\": %q", namespace)
} }
bodyStr = fmt.Sprintf(r.body, sub) bodyStr = fmt.Sprintf(r.body, sub)
} }
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr)) bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes) req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil { if err != nil {
...@@ -873,6 +877,7 @@ func TestKindAuthorization(t *testing.T) { ...@@ -873,6 +877,7 @@ func TestKindAuthorization(t *testing.T) {
} }
} }
} }
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr)) bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes) req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment