Skip to content

[RFR] Adapt custom rules test #1929

[RFR] Adapt custom rules test

[RFR] Adapt custom rules test #1929

Workflow file for this run

name: Pull request test
on: [pull_request]
jobs:
k8s-tests:
name: Collect test cases
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.event.outputs.tests }}
steps:
- name: Checkout to pull request branch
uses: actions/checkout@v2
- id: file_changes
uses: jitterbit/get-changed-files@v1
continue-on-error: true
with:
format: 'json'
# Create event to generate ouput of comma separated test files only
- id: event
run: |
test_files=`python3 -c 'print(",".join([file for file in ${{ steps.file_changes.outputs.all }} if ".test.ts" in file]))'`
echo "::set-output name=tests::$test_files"
k8s:
name: Run collected tests
needs: k8s-tests
if: ${{ needs.k8s-tests.outputs.tests }}
runs-on: ubuntu-latest
steps:
- name: Checkout tackle
uses: actions/checkout@v2
with:
repository: konveyor/tackle
path: tackle
- name: start minikube
id: minikube
with:
minikube-version: 1.24.0
driver: docker
kubernetes-version: v1.23.3
uses: medyagh/setup-minikube@master
- name: Kubectl enable addons ingress
run: minikube addons enable ingress
- name: Kubectl enable addons registry
run: minikube addons enable registry
- name: Validate Minikube
run: minikube status | grep Running
- name: Validate enabled addon in arg
run: minikube addons list -o json | jq '.registry.Status' | grep enabled
- name: Validate Cluster
run: kubectl get nodes
- name: Kubectl enable addons
run: minikube addons enable dashboard
- name: Kubectl enable olm
run: minikube addons enable olm
- name: Deploy CRD
run: kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml
- name: Deploy OLM
run: kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml
- name: Deploy k8s
run: kubectl apply -f https://raw.githubusercontent.com/konveyor/tackle2-operator/main/tackle-k8s.yaml
- name: Sleep
run: sleep 150s
shell: bash
- name: Create CRD
run: kubectl apply -f https://raw.githubusercontent.com/konveyor/tackle-ui-tests/main/.github/install_tackle2_crd.yml
- name: Wait for pods to be ready.
run: sleep 150s
shell: bash
- name: Check pod status
run: kubectl get pods -n konveyor-tackle
- name: Verify hub
run: kubectl wait deployment/tackle-hub --for condition=available --timeout=-1s -n konveyor-tackle
- name: Verify keycloack-controls
run: kubectl wait deployment/tackle-keycloak-postgresql --for condition=available --timeout=-1s -n konveyor-tackle
- name: Verify tackle-keycloack-sso
run: kubectl wait deployment/tackle-keycloak-sso --for condition=available --timeout=-1s -n konveyor-tackle
- name: Verify tackle-operator
run: kubectl wait deployment/tackle-operator --for condition=available --timeout=-1s -n konveyor-tackle
- name: Verify pathfinder
run: kubectl wait deployment/tackle-pathfinder --for condition=available --timeout=-1s -n konveyor-tackle
- name: Verify tackle-pathfinder-postgresql
run: kubectl wait deployment/tackle-pathfinder-postgresql --for condition=available --timeout=-1s -n konveyor-tackle
- name: Verify tackle-ui
run: kubectl wait deployment/tackle-ui --for condition=available --timeout=-1s -n konveyor-tackle
- name: Wait for Ingress
shell: bash
run: |
bash -c 'external_ip="";
echo $external_ip;
while [[ -z $external_ip ]]
do
echo "Waiting for end point..."
external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] &&
echo $external_ip;
sleep 10;
done
echo "End point ready:" &&
echo $external_ip;
export endpoint=$(minikube ip);
echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV
export keycloakAdminPassword=$(oc get secret tackle-keycloak-sso -nkonveyor-tackle -o json|grep password|cut -d "\"" -f 4 |base64 -d; echo);
echo "CYPRESS_keycloakAdminPassword=$keycloakAdminPassword" >>$GITHUB_ENV'
- name: Checkout to pull request branch
uses: actions/checkout@v2
# Install NPM dependencies
- name: Install NPM
run: npm install .
- name: Run cypress login test
run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="Passw0rd!",tackleUrl=${{ env.CYPRESS_tackleUrl }}
- name: Run cypress test cases
run: npx cypress run --spec ${{ needs.k8s-tests.outputs.tests }} --env user="admin",pass="Dog8code",tackleUrl=${{ env.CYPRESS_tackleUrl }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: minikube-tests-screenshots
path: cypress/screenshots