add v1 tests to hack/test-go; let default value of Container.SecurityContext to be nil

This commit is contained in:
Chao Xu
2015-06-01 21:51:26 -07:00
parent 9740c7c3ad
commit d52cef11a4
11 changed files with 165 additions and 5 deletions

View File

@@ -623,6 +623,23 @@ func runPatchTest(c *client.Client) {
[]byte(`{"metadata":{"labels":{"$patch":"replace"}}}`),
},
},
"v1": {
api.JSONPatchType: {
[]byte(`[{"op":"add","path":"/metadata/labels","value":{"foo":"bar","baz":"qux"}}]`),
[]byte(`[{"op":"remove","path":"/metadata/labels/foo"}]`),
[]byte(`[{"op":"remove","path":"/metadata/labels"}]`),
},
api.MergePatchType: {
[]byte(`{"metadata":{"labels":{"foo":"bar","baz":"qux"}}}`),
[]byte(`{"metadata":{"labels":{"foo":null}}}`),
[]byte(`{"metadata":{"labels":null}}`),
},
api.StrategicMergePatchType: {
[]byte(`{"metadata":{"labels":{"foo":"bar","baz":"qux"}}}`),
[]byte(`{"metadata":{"labels":{"foo":null}}}`),
[]byte(`{"metadata":{"labels":{"$patch":"replace"}}}`),
},
},
}
pb := patchBodies[c.APIVersion()]

View File

@@ -0,0 +1,24 @@
{
"kind": "ReplicationController",
"apiVersion": "v1",
"metadata": {
"name": "nginx-controller",
"labels": {"name": "nginx"}
},
"spec": {
"replicas": 2,
"selector": {"name": "nginx"},
"template": {
"metadata": {
"labels": {"name": "nginx"}
},
"spec": {
"containers": [{
"name": "nginx",
"image": "nginx",
"ports": [{"containerPort": 80}]
}]
}
}
}
}