From d135b5b3661a9395c22060f2612d59bb8e8940dc Mon Sep 17 00:00:00 2001 From: Jakub Sliacan Date: Tue, 5 Sep 2023 13:30:58 +0200 Subject: [PATCH] integration: refactor top-level testsuite info and actions --- test/integration/testsuite_test.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/integration/testsuite_test.go b/test/integration/testsuite_test.go index 79654f01ca..dfe951bb9c 100644 --- a/test/integration/testsuite_test.go +++ b/test/integration/testsuite_test.go @@ -43,7 +43,7 @@ func TestTest(t *testing.T) { } reporterConfig.JUnitReport = filepath.Join("out", "integration.xml") - RunSpecs(t, "Test Suite", suiteConfig, reporterConfig) + RunSpecs(t, "Integration", suiteConfig, reporterConfig) } @@ -51,10 +51,21 @@ var _ = BeforeSuite(func() { // set userHome usr, err := user.Current() + Expect(err).NotTo(HaveOccurred()) + + userHome = usr.HomeDir + + // cleanup CRC + Expect(RunCRCExpectSuccess("cleanup")).To(MatchRegexp("Cleanup finished")) + + // remove config file + configFilePath := filepath.Join(userHome, ".crc", "crc.json") + err = os.RemoveAll(configFilePath) if err != nil { - Expect(err).NotTo(HaveOccurred()) + logrus.Infof("could not delete %s.", configFilePath) + logrus.Infof("%v", err) } - userHome = usr.HomeDir + Expect(err).NotTo(HaveOccurred()) // set credPath credPath = filepath.Join(userHome, ".crc", "machines", "crc", "id_rsa") @@ -75,15 +86,15 @@ var _ = BeforeSuite(func() { logrus.Infof("Error: Could not read GINKGO_OPTS.") logrus.Infof("%v", err) - Expect(err).NotTo(HaveOccurred()) } + Expect(err).NotTo(HaveOccurred()) pullSecretPath = os.Getenv("PULL_SECRET_PATH") // this env var should contain location of pull-secret file if err != nil { logrus.Infof("Error: You need to set PULL_SECRET_PATH to find CRC useful.") logrus.Infof("%v", err) - Expect(err).NotTo(HaveOccurred()) } + Expect(err).NotTo(HaveOccurred()) })