Fix up test cases

Change-Id: Ib9245f78dbfb88f1f37a26ca64bf80d3f78d7497
pull/58/head
Davanum Srinivas 2018-10-10 10:15:15 -04:00
parent 6364af128b
commit 65da81f42e
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
57 changed files with 80 additions and 76 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: sorted-pod1
creationTimestamp: 2018-08-30T14:10:58Z
creationTimestamp: "2018-08-30T14:10:58Z"
labels:
name: sorted-pod3-label
spec:

View File

@ -2,7 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: sorted-pod2
creationTimestamp: 2018-08-30T14:10:55Z
creationTimestamp: "2018-08-30T14:10:55Z"
labels:
name: sorted-pod2-label
spec:

View File

@ -2,7 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: sorted-pod3
creationTimestamp: 2018-08-30T14:10:53Z
creationTimestamp: "2018-08-30T14:10:53Z"
labels:
name: sorted-pod1-label
spec:

View File

@ -1,7 +1,7 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
# The edited file had a syntax error: error converting YAML to JSON: yaml: line 12: could not find expected ':'
# The edited file had a syntax error: error converting YAML to JSON: yaml: line 13: could not find expected ':'
#
kind: Service
metadata:

View File

@ -1,7 +1,7 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 12: could not find expected ':'
# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 13: could not find expected ':'
#
kind: Service
metadata:

View File

@ -5,7 +5,7 @@ apiVersion: v1
kind: Service
metadata:
annotations: {}
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -5,7 +5,7 @@ apiVersion: v1
kind: Service
metadata:
annotations: {}
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:47Z
creationTimestamp: "2017-02-03T06:44:47Z"
labels:
app: svc1modified
name: svc1

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:47Z
creationTimestamp: "2017-02-03T06:44:47Z"
labels:
app: svc1
name: svc1

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:43Z
creationTimestamp: "2017-02-03T06:44:43Z"
labels:
app: svc2modified
name: svc2

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:43Z
creationTimestamp: "2017-02-03T06:44:43Z"
labels:
app: svc2
name: svc2

View File

@ -3,7 +3,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:47Z
creationTimestamp: "2017-02-03T06:44:47Z"
labels:
app: svc1
name: svc1
@ -27,7 +27,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:43Z
creationTimestamp: "2017-02-03T06:44:43Z"
labels:
app: svc2
name: svc2

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -9,7 +9,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -9,7 +9,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -8,7 +8,7 @@ metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
creationTimestamp: "2017-02-27T19:40:53Z"
labels:
app: svc1
new-label: new-value

View File

@ -8,7 +8,7 @@ metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
creationTimestamp: "2017-02-27T19:40:53Z"
labels:
app: svc1
name: svc1

View File

@ -8,7 +8,7 @@ data:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1-modified
namespace: edit-test
resourceVersion: "2071"

View File

@ -8,7 +8,7 @@ data:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "2071"

View File

@ -7,7 +7,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
name: svc1
@ -32,7 +32,7 @@ items:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1903"

View File

@ -10,7 +10,7 @@ items:
foo: changed-value
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1903"
@ -19,7 +19,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
name: svc1

View File

@ -11,7 +11,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
newvalue: modified
@ -37,7 +37,7 @@ items:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1903"

View File

@ -11,7 +11,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
name: svc1
@ -36,7 +36,7 @@ items:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1903"

View File

@ -10,7 +10,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
newvalue: modified
@ -36,7 +36,7 @@ items:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1903"

View File

@ -10,7 +10,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
newvalue: modified
@ -36,7 +36,7 @@ items:
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1903"

View File

@ -15,7 +15,7 @@ items:
metadata:
annotations:
kubernetes.io/change-cause: original creating command a
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1414"
@ -26,7 +26,7 @@ items:
metadata:
annotations:
kubernetes.io/change-cause: original creating command b
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
new-label: foo

View File

@ -14,7 +14,7 @@ items:
metadata:
annotations:
kubernetes.io/change-cause: original creating command a
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1414"
@ -25,7 +25,7 @@ items:
metadata:
annotations:
kubernetes.io/change-cause: original creating command b
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
new-label: foo

View File

@ -13,7 +13,7 @@ items:
new-data3: newivalue
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1414"
@ -22,7 +22,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
new-label: foo

View File

@ -12,7 +12,7 @@ items:
new-data2: new-value
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
creationTimestamp: "2017-02-03T06:12:07Z"
name: cm1
namespace: edit-test
resourceVersion: "1414"
@ -21,7 +21,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
creationTimestamp: "2017-02-03T06:11:32Z"
labels:
app: svc1
new-label: foo

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T05:59:00Z
creationTimestamp: "2017-02-03T05:59:00Z"
name: mymap
namespace: default
resourceVersion: "149"

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T05:59:00Z
creationTimestamp: "2017-02-03T05:59:00Z"
name: mymap
namespace: default
resourceVersion: "149"

View File

@ -8,7 +8,7 @@ metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
creationTimestamp: "2017-02-27T19:40:53Z"
labels:
app: svc1
new-label: new-value

View File

@ -8,7 +8,7 @@ metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
creationTimestamp: "2017-02-27T19:40:53Z"
labels:
app: svc1
name: svc1

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -9,7 +9,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -9,7 +9,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -7,7 +7,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes
@ -31,7 +31,7 @@ items:
- apiVersion: company.com/v1
kind: Bar
metadata:
creationTimestamp: 2017-02-13T00:47:26Z
creationTimestamp: "2017-02-13T00:47:26Z"
name: test
namespace: default
resourceVersion: "16954"
@ -52,7 +52,7 @@ items:
b: false
kind: Bar
metadata:
creationTimestamp: 2017-02-13T00:50:10Z
creationTimestamp: "2017-02-13T00:50:10Z"
name: test2
namespace: default
resourceVersion: "16955"

View File

@ -7,7 +7,7 @@ items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes
@ -30,7 +30,7 @@ items:
- apiVersion: company.com/v1
kind: Bar
metadata:
creationTimestamp: 2017-02-13T00:47:26Z
creationTimestamp: "2017-02-13T00:47:26Z"
name: test
namespace: default
resourceVersion: "16954"
@ -49,7 +49,7 @@ items:
b: false
kind: Bar
metadata:
creationTimestamp: 2017-02-13T00:50:10Z
creationTimestamp: "2017-02-13T00:50:10Z"
name: test2
namespace: default
resourceVersion: "16955"

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
new-label: new-value

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
creationTimestamp: "2017-02-01T21:14:09Z"
labels:
app: svc1
name: svc1

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -7,7 +7,7 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -2,12 +2,12 @@
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 17: could not find expected ':'
# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 18: could not find expected ':'
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-12T20:11:19Z
creationTimestamp: "2017-02-12T20:11:19Z"
labels:
component: apiserver
provider: kubernetes

View File

@ -5,7 +5,7 @@
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
creationTimestamp: 2017-02-13T02:04:04Z
creationTimestamp: "2017-02-13T02:04:04Z"
labels:
label1: value1
label2: value2

View File

@ -5,7 +5,7 @@
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
creationTimestamp: 2017-02-13T02:04:04Z
creationTimestamp: "2017-02-13T02:04:04Z"
labels:
label1: value1
name: foo

View File

@ -8,7 +8,7 @@ extraField:
addedData: "foo"
kind: StorageClass
metadata:
creationTimestamp: 2017-02-13T02:04:04Z
creationTimestamp: "2017-02-13T02:04:04Z"
labels:
label1: value1
label2: value2

View File

@ -7,7 +7,7 @@ extraField:
otherData: true
kind: StorageClass
metadata:
creationTimestamp: 2017-02-13T02:04:04Z
creationTimestamp: "2017-02-13T02:04:04Z"
labels:
label1: value1
name: foo

View File

@ -8,7 +8,7 @@ metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
creationTimestamp: "2017-02-27T19:40:53Z"
labels:
app: svc1
new-label: new-value

View File

@ -8,7 +8,7 @@ metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
creationTimestamp: "2017-02-27T19:40:53Z"
labels:
app: svc1
name: svc1

View File

@ -257,8 +257,12 @@ func testPrinter(t *testing.T, printer printers.ResourcePrinter, unmarshalFunc f
}
}
func yamlUnmarshal(data []byte, v interface{}) error {
return yaml.Unmarshal(data, v)
}
func TestYAMLPrinter(t *testing.T) {
testPrinter(t, genericprinters.NewTypeSetter(legacyscheme.Scheme).ToPrinter(&genericprinters.YAMLPrinter{}), yaml.Unmarshal)
testPrinter(t, genericprinters.NewTypeSetter(legacyscheme.Scheme).ToPrinter(&genericprinters.YAMLPrinter{}), yamlUnmarshal)
}
func TestJSONPrinter(t *testing.T) {

View File

@ -35,8 +35,8 @@ func TestMicroTimeMarshalYAML(t *testing.T) {
result string
}{
{MicroTime{}, "t: null\n"},
{DateMicro(1998, time.May, 5, 1, 5, 5, 50, time.FixedZone("test", -4*60*60)), "t: 1998-05-05T05:05:05.000000Z\n"},
{DateMicro(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "t: 1998-05-05T05:05:05.000000Z\n"},
{DateMicro(1998, time.May, 5, 1, 5, 5, 50, time.FixedZone("test", -4*60*60)), "t: \"1998-05-05T05:05:05.000000Z\"\n"},
{DateMicro(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "t: \"1998-05-05T05:05:05.000000Z\"\n"},
}
for _, c := range cases {

View File

@ -35,8 +35,8 @@ func TestTimeMarshalYAML(t *testing.T) {
result string
}{
{Time{}, "t: null\n"},
{Date(1998, time.May, 5, 1, 5, 5, 50, time.FixedZone("test", -4*60*60)), "t: 1998-05-05T05:05:05Z\n"},
{Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "t: 1998-05-05T05:05:05Z\n"},
{Date(1998, time.May, 5, 1, 5, 5, 50, time.FixedZone("test", -4*60*60)), "t: \"1998-05-05T05:05:05Z\"\n"},
{Date(1998, time.May, 5, 5, 5, 5, 0, time.UTC), "t: \"1998-05-05T05:05:05Z\"\n"},
}
for _, c := range cases {

View File

@ -197,8 +197,8 @@ stuff: 1
t.Fatal("expected error with yaml: violate, got no error")
}
fmt.Printf("err: %s\n", err.Error())
if !strings.Contains(err.Error(), "yaml: line 2:") {
t.Fatalf("expected %q to have 'yaml: line 2:' found a tab character", err.Error())
if !strings.Contains(err.Error(), "yaml: line 3:") {
t.Fatalf("expected %q to have 'yaml: line 3:' found a tab character", err.Error())
}
}

View File

@ -4,7 +4,7 @@ metadata:
annotations:
deployment.kubernetes.io/revision: "1"
kubectl.kubernetes.io/last-applied-configuration: '{"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"nginx-deployment","creationTimestamp":null},"spec":{"template":{"metadata":{"creationTimestamp":null,"labels":{"name":"nginx"}},"spec":{"containers":[{"name":"nginx","image":"nginx","resources":{}}]}},"strategy":{}},"status":{}}'
creationTimestamp: 2016-10-24T22:15:06Z
creationTimestamp: "2016-10-24T22:15:06Z"
generation: 6
labels:
name: nginx