From 79d27ded255b877d5e573f156c8705c557e3dd29 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Fri, 17 Jul 2020 12:08:31 +0100 Subject: [PATCH] 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 --- cmd/osbuild-image-tests/main_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/osbuild-image-tests/main_test.go b/cmd/osbuild-image-tests/main_test.go index a9c49a78b..fb1fbc3ee 100644 --- a/cmd/osbuild-image-tests/main_test.go +++ b/cmd/osbuild-image-tests/main_test.go @@ -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() {