image-tests: avoid /var/tmp

`systemd-tmpfiles` will helpfully delete "old"  files in /var/tmp at regular
intervals. The files installed from rpm has the timestamps from when they
were packaged, which causes some to be cleaned up when the timer triggers.

The first timer triggers 15 minutes after boot, so we were sometimes hit
by this when our CI was under load.

Fixes #839 and #862.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-07-17 12:08:31 +01:00
parent 842b665659
commit 79d27ded25

View file

@ -399,7 +399,8 @@ func testImage(t *testing.T, testcase testcaseStruct, imagePath string) {
// runTestcase builds the pipeline specified in the testcase and then it
// tests the result
func runTestcase(t *testing.T, testcase testcaseStruct, store string) {
outputDirectory, err := ioutil.TempDir("/var/tmp", "osbuild-image-tests-*")
_ = os.Mkdir("/var/lib/osbuild-composer-tests", 0755)
outputDirectory, err := ioutil.TempDir("/var/lib/osbuild-composer-tests", "osbuild-image-tests-*")
require.NoError(t, err, "error creating temporary output directory")
defer func() {
@ -437,7 +438,8 @@ func getAllCases() ([]string, error) {
// runTests opens, parses and runs all the specified testcases
func runTests(t *testing.T, cases []string) {
store, err := ioutil.TempDir("/var/tmp", "osbuild-image-tests-*")
_ = os.Mkdir("/var/lib/osbuild-composer-tests", 0755)
store, err := ioutil.TempDir("/var/lib/osbuild-composer-tests", "osbuild-image-tests-*")
require.NoError(t, err, "error creating temporary store")
defer func() {