This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit a3598245fa2dcc18f79c5e258132cc496d3e4baf Author: phantomjinx <[email protected]> AuthorDate: Fri Nov 5 12:52:59 2021 +0000 When tests fail and project is dumped, clear up afterwards --- e2e/support/test_support.go | 17 ++++++++++++++++- e2e/upgrade/olm_upgrade_test.go | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index 9bcf41e..8e045df 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -1686,6 +1686,12 @@ func InvokeUserTestCode(t *testing.T, ns string, doRun func(string)) { if err := util.Dump(TestContext, TestClient(), ns, t); err != nil { t.Logf("Error while dumping namespace %s: %v\n", ns, err) } + + // + // Ensure everything is removed after dumping + // in order to ensure a clean cluster + // + uninstallKamelInternal(t, "--all", "--olm=false") } }() @@ -1824,7 +1830,7 @@ func NewTestNamespace(injectKnativeBroker bool) ctrl.Object { return obj } -func UninstallKamel(t *testing.T, args ...string) { +func uninstallKamelInternal(t *testing.T, args ...string) { uargs := []string{"uninstall"} uargs = append(uargs, args...) if err := Kamel(uargs...).Execute(); err != nil { @@ -1832,6 +1838,15 @@ func UninstallKamel(t *testing.T, args ...string) { } } +func UninstallKamel(t *testing.T, args ...string) { + if t.Failed() { + // then dump needs to execute first + return + } + + uninstallKamelInternal(t, args...) +} + func GetOutputString(command *cobra.Command) string { var buf bytes.Buffer diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go index 981aae3..f454d37 100644 --- a/e2e/upgrade/olm_upgrade_test.go +++ b/e2e/upgrade/olm_upgrade_test.go @@ -101,7 +101,7 @@ func TestOLMAutomaticUpgrade(t *testing.T) { prevCSVVersion = clusterServiceVersion(noAdditionalConditions, ns)().Spec.Version prevIPVersionPrefix = fmt.Sprintf("%d.%d", prevCSVVersion.Version.Major, prevCSVVersion.Version.Minor) - t.Logf("Upgrading from Previous CSV Version: %s", prevCSVVersion.Version.String()) + t.Logf("Using Previous CSV Version: %s", prevCSVVersion.Version.String()) // Check the operator pod is running Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
