You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
suse-workstation-team-harvester➜ vm-import-controller : main ✘ :✹✭ ᐅ which qemu-wrapper.sh
/home/mike/.local/bin/qemu-wrapper.sh
It needs to be present and executable.
This seems like we could possibly shift this over to leverage, just building a temporary file, perhaps something like:
// maybe all these could also come from the environment too?// like we could like try to do an os.Getenv("blah") - first, if there's nothing present, empty string or it comes in as something// other than a string, we could default to something else, but then it would allow for having a top down // env based dependency injection on the function// url: "https://raw.githubusercontent.com/harvester/vm-import-controller/main/package/qemu-wrapper.sh"// folder: "/tmp"// filename: qemu-wrapper.shfuncsomeFunc(folderstring, urlstring, filenamestring) (errerror){
file, err:=ioutil.TempFile(folder, filename)
iferr!=nil {
log.Fatal(err)
}
deferos.Remove(file.Name())
// maybe just fetching the file from the repo, or we could have it exist somewhere else, this becomes network dependant tho// probably not the best solutionresp, err:=http.get(url)
iferr!=nil {
returnerr
}
deferresp.Body.Close()
_, err=io.Copy(folder+"/"+filename, resp.Body)
iferr!=nil {
returnerr
}
/// do testing? - tho this becomes nested - but then the defers would clean everything up when we leave the scope of the func
}
And maybe just telling the test to look for the binary there at /tmp/qemu-wrapper.sh instead of on the path?
That would make it more hands off and the integration tests more ephemeral.
Description
https://github.com/harvester/vm-import-controller/blob/main/package/qemu-wrapper.sh
suse-workstation-team-harvester➜ vm-import-controller : main ✘ :✹✭ ᐅ which qemu-wrapper.sh /home/mike/.local/bin/qemu-wrapper.sh
It needs to be present and executable.
This seems like we could possibly shift this over to leverage, just building a temporary file, perhaps something like:
And maybe just telling the test to look for the binary there at
/tmp/qemu-wrapper.sh
instead of on the path?That would make it more hands off and the integration tests more ephemeral.
cc: @ibrokethecloud
The text was updated successfully, but these errors were encountered: