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 28d39e3fdadd7195df19675d68aa4fa062f4a1ca
Author: phantomjinx <[email protected]>
AuthorDate: Fri Jan 14 13:18:32 2022 +0000

    Adds action for reporting the number of tests reported as problematic
    
    * Useful for when running scheduled night-time test suites and ignoring
      problematic tests
    
    * Action that scans the requisite e2e directory to report those tests still
      marked with the PROBLEMATIC flag.
---
 .github/actions/e2e-builder/action.yml             | 17 +++++
 .github/actions/e2e-knative-yaks/action.yml        |  6 ++
 .github/actions/e2e-knative/action.yml             | 17 +++++
 .github/actions/e2e-kubernetes/action.yml          |  6 ++
 .github/actions/e2e-local/action.yml               |  6 ++
 .github/actions/e2e-upgrade/action.yml             |  6 ++
 .../action.yml                                     | 36 ++++------
 .../kamel-report-problematic/report-problematic.sh | 84 ++++++++++++++++++++++
 8 files changed, 156 insertions(+), 22 deletions(-)

diff --git a/.github/actions/e2e-builder/action.yml 
b/.github/actions/e2e-builder/action.yml
index d46cc71..c08d045 100644
--- a/.github/actions/e2e-builder/action.yml
+++ b/.github/actions/e2e-builder/action.yml
@@ -63,6 +63,23 @@ runs:
     with:
       kube-admin-user-ctx: ${{ 
steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
 
+  - id: preflight-test
+    name: Preflight Check Test
+    uses: ./.github/actions/kamel-preflight-test
+    with:
+      build-catalog-source: ${{ 
steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+      image-namespace: ${{ 
steps.config-cluster.outputs.cluster-image-namespace }}
+      image-registry-host: ${{ 
steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+      image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name 
}}
+      image-registry-insecure: 
${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+      image-version: ${{ 
steps.build-kamel.outputs.build-binary-local-image-version }}
+
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: builder
+
   - id: run-it
     name: Run IT
     shell: bash
diff --git a/.github/actions/e2e-knative-yaks/action.yml 
b/.github/actions/e2e-knative-yaks/action.yml
index 541cd7c..2659747 100644
--- a/.github/actions/e2e-knative-yaks/action.yml
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -77,6 +77,12 @@ runs:
       image-registry-insecure: 
${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
       image-version: ${{ 
steps.build-kamel.outputs.build-binary-local-image-version }}
 
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: yaks/common
+
   - id: run-it
     name: Run IT
     shell: bash
diff --git a/.github/actions/e2e-knative/action.yml 
b/.github/actions/e2e-knative/action.yml
index 54f35f0..4689d82 100644
--- a/.github/actions/e2e-knative/action.yml
+++ b/.github/actions/e2e-knative/action.yml
@@ -63,6 +63,23 @@ runs:
     with:
       kube-admin-user-ctx: ${{ 
steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
 
+  - id: preflight-test
+    name: Preflight Check Test
+    uses: ./.github/actions/kamel-preflight-test
+    with:
+      build-catalog-source: ${{ 
steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+      image-namespace: ${{ 
steps.config-cluster.outputs.cluster-image-namespace }}
+      image-registry-host: ${{ 
steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+      image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name 
}}
+      image-registry-insecure: 
${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+      image-version: ${{ 
steps.build-kamel.outputs.build-binary-local-image-version }}
+
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: knative
+
   - id: run-it
     name: Run IT
     shell: bash
diff --git a/.github/actions/e2e-kubernetes/action.yml 
b/.github/actions/e2e-kubernetes/action.yml
index ad5f6f5..4b60301 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -71,6 +71,12 @@ runs:
       image-registry-insecure: 
${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
       image-version: ${{ 
steps.build-kamel.outputs.build-binary-local-image-version }}
 
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: common
+
   - id: run-it
     name: Run IT
     shell: bash
diff --git a/.github/actions/e2e-local/action.yml 
b/.github/actions/e2e-local/action.yml
index 47a9d27..a2dcccc 100644
--- a/.github/actions/e2e-local/action.yml
+++ b/.github/actions/e2e-local/action.yml
@@ -32,6 +32,12 @@ runs:
     with:
       make-rules: 'build-kamel'
 
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: local
+
   - id: run-it
     name: Run IT
     shell: bash
diff --git a/.github/actions/e2e-upgrade/action.yml 
b/.github/actions/e2e-upgrade/action.yml
index 7b3b2bf..93f4495 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -81,6 +81,12 @@ runs:
       # Can be empty and so catalog source will not be created
       catalog-source-namespace: ${{ 
steps.config-cluster.outputs.cluster-catalog-source-namespace }}
 
+  - id: report-problematic
+    name: List Tests Marked As Problematic
+    uses: ./.github/actions/kamel-report-problematic
+    with:
+      test-suite: upgrade
+
   - name: Run IT
     shell: bash
     run: |
diff --git a/.github/actions/e2e-local/action.yml 
b/.github/actions/kamel-report-problematic/action.yml
similarity index 65%
copy from .github/actions/e2e-local/action.yml
copy to .github/actions/kamel-report-problematic/action.yml
index 47a9d27..c981858 100644
--- a/.github/actions/e2e-local/action.yml
+++ b/.github/actions/kamel-report-problematic/action.yml
@@ -15,29 +15,21 @@
 # limitations under the License.
 # ---------------------------------------------------------------------------
 
-name: e2e-local
-description: 'End-to-End tests for local use-cases'
+name: kamel-report-problematic
+description: 'Reports the number of tests labelled as problematic in test 
suite'
+
+inputs:
+  test-suite:
+    description: "The test suite to be analysed"
+    required: true
 
 runs:
   using: "composite"
-
   steps:
-  - id: prepare-env
-    name: Prepare Test Environment
-    uses: ./.github/actions/kamel-prepare-env
-
-  - id: build-kamel
-    name: Build Kamel
-    uses: ./.github/actions/kamel-build
-    with:
-      make-rules: 'build-kamel'
-
-  - id: run-it
-    name: Run IT
-    shell: bash
-    run: |
-      # Configure staging repos
-      export KAMEL_LOCAL_RUN_MAVEN_REPOSITORIES=$(make get-staging-repo)
-
-      # Then run integration tests
-      make test-local
+    - id: report-problematic
+      name: Report Tests Marked As Problematic
+      shell: bash
+      if: ${{ always() }}
+      run: |
+        ./.github/actions/kamel-report-problematic/report-problematic.sh \
+          -t "${{ inputs.test-suite }}"
diff --git a/.github/actions/kamel-report-problematic/report-problematic.sh 
b/.github/actions/kamel-report-problematic/report-problematic.sh
new file mode 100755
index 0000000..a745c38
--- /dev/null
+++ b/.github/actions/kamel-report-problematic/report-problematic.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Find all test that are labelled as problematic
+#
+####
+
+set -e
+
+while getopts ":t:" opt; do
+  case "${opt}" in
+    t)
+      TEST_SUITE=${OPTARG}
+      ;;
+    :)
+      echo "ERROR: Option -$OPTARG requires an argument"
+      exit 1
+      ;;
+    \?)
+      echo "ERROR: Invalid option -$OPTARG"
+      exit 1
+      ;;
+  esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${TEST_SUITE}" ]; then
+  echo "Error: ${0} -t <test-suite>"
+  exit 1
+fi
+
+TEST_DIR="./e2e/${TEST_SUITE}"
+
+if [ ! -d "${TEST_DIR}" ]; then
+  echo "No e2e directory available ... exiting"
+  exit 0
+fi
+
+PROBLEMATIC=()
+while IFS= read -r -d '' f
+do
+
+  func=""
+  while IFS= read -r line
+  do
+    if [[ "${line}" =~ ^" * " ]]; then
+      continue
+    elif [[ "${line}" =~ ^func* ]]; then
+      func=$(echo "${line}" | sed -n "s/func \([a-zA-Z0-9]\+\).*/\1/p")
+    elif [[ "${line}" =~ CAMEL_K_TEST_SKIP_PROBLEMATIC ]]; then
+      PROBLEMATIC[${#PROBLEMATIC[*]}]="${f}::${func}"
+    fi
+  done < ${f}
+
+done < <(find "${TEST_DIR}" -name "*.go" -print0)
+
+if [ ${#PROBLEMATIC[*]} -gt 0 ]; then
+  echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ==="
+  for prob in "${PROBLEMATIC[@]}"
+  do
+    echo "  ${prob}"
+  done
+  echo "==="
+else
+  echo "=== No Tests marked as Problematic ==="
+fi

Reply via email to