aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYiqiao Pu <ypu@redhat.com>2018-05-29 17:29:20 +0800
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-04 18:14:33 +0000
commitc69f80c86c35b508ae21a7653e3e926e7c164e81 (patch)
tree78cb194516d61b4579bc268780ac92fcba9caefb /test
parent37751ea5b5e71e84119e256136b8bf90aa9ae22f (diff)
downloadpodman-c69f80c86c35b508ae21a7653e3e926e7c164e81.tar.gz
podman-c69f80c86c35b508ae21a7653e3e926e7c164e81.tar.bz2
podman-c69f80c86c35b508ae21a7653e3e926e7c164e81.zip
Add a function for e2e test to write json file
This function is used to write json format configure files. Signed-off-by: Yiqiao Pu <ypu@redhat.com> Closes: #837 Approved by: rhatdan
Diffstat (limited to 'test')
-rw-r--r--test/e2e/libpod_suite_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 0c3dd2eea..796bf2199 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -629,6 +629,14 @@ func IsCommandAvailable(command string) bool {
return true
}
+// WriteJsonFile write json format data to a json file
+func WriteJsonFile(data []byte, filePath string) error {
+ var jsonData map[string]interface{}
+ json.Unmarshal(data, &jsonData)
+ formatJson, _ := json.MarshalIndent(jsonData, "", " ")
+ return ioutil.WriteFile(filePath, formatJson, 0644)
+}
+
func getTestContext() context.Context {
return context.Background()
}