mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
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
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user