Skip to content

Commit

Permalink
Invalid JSON in examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Mar 20, 2015
1 parent a8f2cee commit 1b1866d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
4 changes: 2 additions & 2 deletions examples/limitrange/valid-pod.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"name": "kubernetes-serve-hostname",
"image": "kubernetes/serve_hostname",
"cpu": 1000,
"memory": 1048576,
"memory": 1048576
}]
}
},
}
}
39 changes: 22 additions & 17 deletions test/integration/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var aPod string = `
"manifest": {
"version": "v1beta1",
"id": "a",
"containers": [{ "name": "foo", "image": "bar/foo", }]
"containers": [{ "name": "foo", "image": "bar/foo" }]
}
}%s
}
Expand All @@ -87,7 +87,7 @@ var aPodInBar string = `
"manifest": {
"version": "v1beta1",
"id": "a",
"containers": [{ "name": "foo", "image": "bar/foo", }]
"containers": [{ "name": "foo", "image": "bar/foo" }]
}
}%s
}
Expand All @@ -102,17 +102,18 @@ var aRC string = `
"replicaSelector": {"name": "a"},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "a",
"containers": [{
"name": "foo",
"image": "bar/foo",
}]
}
},
"labels": {"name": "a"}
}},
"manifest": {
"version": "v1beta1",
"id": "a",
"containers": [{
"name": "foo",
"image": "bar/foo"
}]
}
},
"labels": {"name": "a"}
}
},
"labels": {"name": "a"}%s
}
`
Expand Down Expand Up @@ -145,7 +146,7 @@ var aEvent string = `
"kind": "Minion",
"name": "a",
"namespace": "default",
"apiVersion": "v1beta1",
"apiVersion": "v1beta1"
}%s
}
`
Expand Down Expand Up @@ -343,10 +344,11 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
sub += fmt.Sprintf(",\r\n\"resourceVersion\": %v", resVersion)
}
namespace := "default"
sub += fmt.Sprintf(",\r\n\"namespace\": %v", namespace)
sub += fmt.Sprintf(",\r\n\"namespace\": %q", namespace)
}
bodyStr = fmt.Sprintf(r.body, sub)
}
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil {
Expand Down Expand Up @@ -514,10 +516,11 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
sub += fmt.Sprintf(",\r\n\"resourceVersion\": %v", resVersion)
}
namespace := "default"
sub += fmt.Sprintf(",\r\n\"namespace\": %v", namespace)
sub += fmt.Sprintf(",\r\n\"namespace\": %q", namespace)
}
bodyStr = fmt.Sprintf(r.body, sub)
}
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil {
Expand Down Expand Up @@ -767,10 +770,11 @@ func TestNamespaceAuthorization(t *testing.T) {
if len(namespace) == 0 {
namespace = "default"
}
sub += fmt.Sprintf(",\r\n\"namespace\": %v", namespace)
sub += fmt.Sprintf(",\r\n\"namespace\": %q", namespace)
}
bodyStr = fmt.Sprintf(r.body, sub)
}
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil {
Expand Down Expand Up @@ -873,6 +877,7 @@ func TestKindAuthorization(t *testing.T) {
}
}
}
r.body = bodyStr
bodyBytes := bytes.NewReader([]byte(bodyStr))
req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes)
if err != nil {
Expand Down

0 comments on commit 1b1866d

Please sign in to comment.