You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/02/27 17:30:16 UTC

[camel-k] 12/19: fix: split common vs non-common

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 8c69ee7d3c0661596a8d85518632d2f4ba423611
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Feb 23 12:37:39 2023 +0100

    fix: split common vs non-common
---
 .github/actions/e2e-common/action.yml              |  2 +-
 .github/actions/e2e-common/exec-tests.sh           |  1 -
 .../cli => commonwithcustominstall}/dump_test.go   | 37 ++++++++++++++--------
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/.github/actions/e2e-common/action.yml b/.github/actions/e2e-common/action.yml
index b9771b105..f4dcfc303 100644
--- a/.github/actions/e2e-common/action.yml
+++ b/.github/actions/e2e-common/action.yml
@@ -123,7 +123,7 @@ runs:
         -q "${{ env.CAMEL_K_LOG_LEVEL }}" \
         -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \
         -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \
-        -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
+        -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" \
         -z "${{ inputs.with-custom-install }}"
 
   - name: Cleanup
diff --git a/.github/actions/e2e-common/exec-tests.sh b/.github/actions/e2e-common/exec-tests.sh
index 296166607..69fff0375 100755
--- a/.github/actions/e2e-common/exec-tests.sh
+++ b/.github/actions/e2e-common/exec-tests.sh
@@ -137,7 +137,6 @@ fi
 # Then run all integration tests rather than ending on first failure
 set -e
 exit_code=0
-echo "${CUSTOM_INSTALL_TEST}"
 if [ "${CUSTOM_INSTALL_TEST}" == "true" ]; then
   DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-common-with-custom-install || exit_code=1
 else
diff --git a/e2e/common/cli/dump_test.go b/e2e/commonwithcustominstall/dump_test.go
similarity index 52%
rename from e2e/common/cli/dump_test.go
rename to e2e/commonwithcustominstall/dump_test.go
index c37aa3059..70ab6e905 100644
--- a/e2e/common/cli/dump_test.go
+++ b/e2e/commonwithcustominstall/dump_test.go
@@ -20,9 +20,10 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package cli
+package commonwithcustominstall
 
 import (
+	"fmt"
 	"testing"
 
 	. "github.com/onsi/gomega"
@@ -35,18 +36,26 @@ import (
 func TestKamelCLIDump(t *testing.T) {
 	RegisterTestingT(t)
 
-	t.Run("dump non-empty namespace", func(t *testing.T) {
-		Expect(KamelRunWithID(operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
-		Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
-		Eventually(IntegrationLogs(ns, "yaml")).Should(ContainSubstring("Magicstring!"))
-
-		dump := GetOutputString(Kamel("dump", "-n", ns))
-
-		Expect(dump).To(ContainSubstring("Found 1 platforms"))
-		Expect(dump).To(ContainSubstring("Found 1 integrations"))
-		Expect(dump).To(ContainSubstring("name: yaml"))
-		Expect(dump).To(ContainSubstring("Magicstring!"))
+	WithNewTestNamespace(t, func(ns string) {
+		t.Run("dump empty namespace", func(t *testing.T) {
+			dump := GetOutputString(Kamel("dump", "-n", ns))
+
+			Expect(dump).To(ContainSubstring("Found 0 integrations:"))
+			Expect(dump).To(ContainSubstring("Found 0 deployments:"))
+		})
+
+		t.Run("dump non-empty namespace", func(t *testing.T) {
+			operatorID := fmt.Sprintf("camel-k-%s", ns)
+			Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
+			Expect(KamelRunWithID(operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+			Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+			Eventually(IntegrationLogs(ns, "yaml")).Should(ContainSubstring("Magicstring!"))
+
+			dump := GetOutputString(Kamel("dump", "-n", ns))
+			Expect(dump).To(ContainSubstring("Found 1 platforms"))
+			Expect(dump).To(ContainSubstring("Found 1 integrations"))
+			Expect(dump).To(ContainSubstring("name: yaml"))
+			Expect(dump).To(ContainSubstring("Magicstring!"))
+		})
 	})
-
-	Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 }