Skip to content

Commit

Permalink
Use MarshalIndent on json goldenfiles (#856)
Browse files Browse the repository at this point in the history
For large JSON objects stored as goldenfiles, identifying
changes is difficult when it is one large line due to the
fact that a single character change shows the entire object
as the 1 line diff.

This change makes those tests use MarshalIndent so the lines
are split up and sets the indent to 0 so that if we change the
nesting, the changes don't cascade to the rest of the file
simply due to indentation changes (which dont change the
object once unmarshalled).

Signed-off-by: John Schnake <[email protected]>
  • Loading branch information
johnSchnake authored Aug 23, 2019
1 parent 973e782 commit 451b313
Show file tree
Hide file tree
Showing 15 changed files with 502 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pkg/client/results/processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestPostProcessPlugin(t *testing.T) {
}
if *update {
// Update all the golden files instead of actually testing against them.
itemBytes, err := json.Marshal(item)
itemBytes, err := json.MarshalIndent(item, "", "")
if err != nil {
t.Fatalf("Failed to marshal item: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
{"name":"ds-junit-01","status":"passed","items":[{"name":"global","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"},"items":[{"name":"[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]","status":"passed"},{"name":"[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource","status":"skipped"},{"name":"[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]","status":"skipped"}]}]}]}
{
"name": "ds-junit-01",
"status": "passed",
"items": [
{
"name": "global",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
},
"items": [
{
"name": "[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource",
"status": "skipped"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]",
"status": "skipped"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
{"name":"ds-junit-02","status":"failed","items":[{"name":"global","status":"failed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"},"items":[{"name":"[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]","status":"passed"},{"name":"[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource","status":"skipped"},{"name":"[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]","status":"skipped"}]},{"name":"output2.xml","status":"failed","meta":{"file":"results/global/output2.xml"},"items":[{"name":"[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-apps] Daemon set [Serial] should rollback without unnecessary restarts [Conformance]","status":"failed","details":{"failure":"/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/framework.go:696\nConformance test suite needs a cluster with at least 2 nodes.\nExpected\n \u003cint\u003e: 1\nto be \u003e\n \u003cint\u003e: 1\n/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/apps/daemon_set.go:385","system-out":"[BeforeEach] ..."}},{"name":"[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource","status":"skipped"},{"name":"[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]","status":"skipped"}]}]}]}
{
"name": "ds-junit-02",
"status": "failed",
"items": [
{
"name": "global",
"status": "failed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
},
"items": [
{
"name": "[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource",
"status": "skipped"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]",
"status": "skipped"
}
]
},
{
"name": "output2.xml",
"status": "failed",
"meta": {
"file": "results/global/output2.xml"
},
"items": [
{
"name": "[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-apps] Daemon set [Serial] should rollback without unnecessary restarts [Conformance]",
"status": "failed",
"details": {
"failure": "/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/framework.go:696\nConformance test suite needs a cluster with at least 2 nodes.\nExpected\n \u003cint\u003e: 1\nto be \u003e\n \u003cint\u003e: 1\n/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/apps/daemon_set.go:385",
"system-out": "[BeforeEach] ..."
}
},
{
"name": "[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource",
"status": "skipped"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]",
"status": "skipped"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
{"name":"ds-junit-03","status":"failed","items":[{"name":"global","status":"failed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"},"items":[{"name":"[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]","status":"passed"},{"name":"[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource","status":"skipped"},{"name":"[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]","status":"skipped"}]},{"name":"output2.xml","status":"failed","meta":{"file":"results/global/output2.xml"},"items":[{"name":"[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-apps] Daemon set [Serial] should rollback without unnecessary restarts [Conformance]","status":"failed","details":{"failure":"/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/framework.go:696\nConformance test suite needs a cluster with at least 2 nodes.\nExpected\n \u003cint\u003e: 1\nto be \u003e\n \u003cint\u003e: 1\n/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/apps/daemon_set.go:385","system-out":"[BeforeEach] ..."}},{"name":"[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource","status":"skipped"},{"name":"[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]","status":"skipped"}]}]}]}
{
"name": "ds-junit-03",
"status": "failed",
"items": [
{
"name": "global",
"status": "failed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
},
"items": [
{
"name": "[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource",
"status": "skipped"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]",
"status": "skipped"
}
]
},
{
"name": "output2.xml",
"status": "failed",
"meta": {
"file": "results/global/output2.xml"
},
"items": [
{
"name": "[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-apps] Daemon set [Serial] should rollback without unnecessary restarts [Conformance]",
"status": "failed",
"details": {
"failure": "/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/framework.go:696\nConformance test suite needs a cluster with at least 2 nodes.\nExpected\n \u003cint\u003e: 1\nto be \u003e\n \u003cint\u003e: 1\n/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/apps/daemon_set.go:385",
"system-out": "[BeforeEach] ..."
}
},
{
"name": "[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource",
"status": "skipped"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]",
"status": "skipped"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
{"name":"ds-raw-01","status":"passed","items":[{"name":"global","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"}}]}]}
{
"name": "ds-raw-01",
"status": "passed",
"items": [
{
"name": "global",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
{"name":"ds-raw-02","status":"passed","items":[{"name":"global","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"}},{"name":"output2.xml","status":"passed","meta":{"file":"results/global/output2.xml"}}]}]}
{
"name": "ds-raw-02",
"status": "passed",
"items": [
{
"name": "global",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
}
},
{
"name": "output2.xml",
"status": "passed",
"meta": {
"file": "results/global/output2.xml"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
{"name":"ds-raw-03","status":"passed","items":[{"name":"global","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"}},{"name":"output2.xml","status":"passed","meta":{"file":"results/global/output2.xml"}}]}]}
{
"name": "ds-raw-03",
"status": "passed",
"items": [
{
"name": "global",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
}
},
{
"name": "output2.xml",
"status": "passed",
"meta": {
"file": "results/global/output2.xml"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
{"name":"job-default-01","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"}}]}
{
"name": "job-default-01",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
{"name":"job-default-02","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"}},{"name":"output2.xml","status":"passed","meta":{"file":"results/global/output2.xml"}}]}
{
"name": "job-default-02",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
}
},
{
"name": "output2.xml",
"status": "passed",
"meta": {
"file": "results/global/output2.xml"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
{"name":"job-junit-01","status":"passed","items":[{"name":"output.xml","status":"passed","meta":{"file":"results/global/output.xml"},"items":[{"name":"[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]","status":"passed"},{"name":"[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]","status":"passed"},{"name":"[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource","status":"skipped"},{"name":"[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]","status":"skipped"}]}]}
{
"name": "job-junit-01",
"status": "passed",
"items": [
{
"name": "output.xml",
"status": "passed",
"meta": {
"file": "results/global/output.xml"
},
"items": [
{
"name": "[k8s.io] Pods should be submitted and removed [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-node] ConfigMap should fail to create ConfigMap with empty key [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] Downward API volume should set DefaultMode on files [LinuxOnly] [NodeConformance] [Conformance]",
"status": "passed"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: local][LocalVolumeType: dir-link-bindmounted] [Testpattern: Dynamic PV (default fs)] subPath should support existing directories when readOnly specified in the volumeSource",
"status": "skipped"
},
{
"name": "[sig-storage] In-tree Volumes [Driver: rbd][Feature:Volumes] [Testpattern: Pre-provisioned PV (default fs)] subPath should support restarting containers using file as subpath [Slow]",
"status": "skipped"
}
]
}
]
}
Loading

0 comments on commit 451b313

Please sign in to comment.