Skip to content

Commit

Permalink
e2e: Use fake notifications service as a workaround
Browse files Browse the repository at this point in the history
Right now the upstream notification service exported at https://github.com/redhat-developer/rhdh-plugin-export-backstage-backstage/releases
is not working due to some compatibility issues with upstream RHDH
backstage version.
Till we solve this problem the e2e test will use a fake notifications
pod that would log all the requests to the container log. We can examine
the container logs and make sure the notifications were sent in the
right format, for now.

Signed-off-by: Roy Golan <[email protected]>
  • Loading branch information
rgolangh committed Jul 18, 2024
1 parent 76b0799 commit aa48e32
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/move2kube-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ jobs:
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=180s
- name: Deploy fake notifications service
run: |
source e2e/helper-functions.sh
create-fake-notifications-service
- name: Deploy Move2kube serverless workflow
run: |
kubectl patch configmap/config-features \
Expand Down Expand Up @@ -122,7 +127,7 @@ jobs:
kubectl patch configmap/m2k-props \
--type merge \
-p '{"data": {"application.properties" :"move2kube_url=http://move2kube-instance-svc.default.svc.cluster.local:8080\nquarkus.rest-client.move2kube_yaml.url=http://move2kube-instance-svc.default.svc.cluster.local:8080\nquarkus.rest-client.notifications.url=http://janus-idp-workflows-backstage.default.svc.cluster.local:7007/api/notifications/"}}'
-p '{"data": {"application.properties" :"move2kube_url=http://move2kube-instance-svc.default.svc.cluster.local:8080\nquarkus.rest-client.move2kube_yaml.url=http://move2kube-instance-svc.default.svc.cluster.local:8080\nquarkus.rest-client.notifications.url=http://fake-notifications-service.default.svc.cluster.local:8080/api/notifications/"}}'
kubectl delete pod -l "app=m2k"
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=m2k" --timeout=1m
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/mta-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:
kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=tackle-ui" -n my-konveyor-operator --timeout=120s
# now MTA workflow can execute agains tackle-ui.my-konveyor-operator.svc:8080
- name: Deploy Janus-idp-workflow-helm (janus + sonataflow-opertor)
- name: Deploy Orchestrator-k8s helm chart
run: |
helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart
helm install orchestrator orchestrator/orchestrator-k8s
Expand All @@ -81,6 +82,11 @@ jobs:
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=120s
- name: Deploy fake notifications service
run: |
source e2e/helper-functions.sh
create-fake-notifications-service
- name: Download sonataflow artifacts generated manifests
uses: actions/download-artifact@v4
with:
Expand All @@ -100,7 +106,7 @@ jobs:
- name: Deploy MTA serverless workflow
run: |
# Set the endpoint to the tackle-ui service
yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080/hub"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://janus-idp-workflows-backstage.default.svc.cluster.local:7007/api/notifications/"}] )' manifests/01-sonataflow_mtaanalysis.yaml
yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080/hub"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://fake-notifications-service.default.svc.cluster.local:8080/api/notifications/"}] )' manifests/01-sonataflow_mtaanalysis.yaml
# Disable persistence for e2e tests
yq e '.spec.persistence = {}' -i manifests/01-sonataflow_mtaanalysis.yaml
Expand All @@ -114,11 +120,6 @@ jobs:
cat manifests/01-sonataflow_mtaanalysis.yaml
echo "---"
# Set notification external access token
echo " Set notification external access token"
yq --inplace '.data."NOTIFICATIONS_BEARER_TOKEN" = "ZTJldG9rZW4="' manifests/01-secret_mtaanalysis.yaml # notsecret
cat manifests/01-secret_mtaanalysis.yaml
# deploy the manifests created by the ${{ steps.build-image.outputs.image }} image
kubectl apply -f manifests/
sleep 5
Expand All @@ -128,7 +129,6 @@ jobs:
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=mtaanalysis" --timeout=5m
- uses: actions/checkout@v4
- name: Run e2e script
run: |
e2e/mta.sh
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/mta-v6.x-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
Expand Down Expand Up @@ -81,6 +82,11 @@ jobs:
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=600s
- name: Deploy fake notifications service
run: |
source e2e/helper-functions.sh
create-fake-notifications-service
- name: Download sonataflow artifacts generated manifests
uses: actions/download-artifact@v4
with:
Expand All @@ -100,7 +106,7 @@ jobs:
- name: Deploy MTA serverless workflow
run: |
# Set the endpoint to the tackle-ui service
yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://janus-idp-workflows-backstage.default.svc.cluster.local:7007/api/notifications/"}] )' manifests/01-sonataflow_mta-analysis-v6.yaml
yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://fake-notifications-service.default.svc.cluster.local:8080/api/notifications/"}] )' manifests/01-sonataflow_mta-analysis-v6.yaml
# Disable persistence for e2e tests
yq e '.spec.persistence = {}' -i manifests/01-sonataflow_mta-analysis-v6.yaml
Expand All @@ -123,7 +129,6 @@ jobs:
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=mta-analysis-v6" --timeout=10m
- uses: actions/checkout@v4
- name: Run e2e script
run: |
e2e/mta-v6.x.sh
Expand Down
19 changes: 19 additions & 0 deletions e2e/helper-functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

function create-fake-notifications-service() {
oc run fake-notifications-service --image=docker.io/golang:1.21 --port=8080 -- bash -c 'cat <<EOF > main.go && go run main.go
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
log.Fatal(http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Println(r) })))
}
EOF
'
kubectl wait --for=condition=Ready=true pods fake-notifications-service --timeout=5m
kubectl expose pods/fake-notifications-service
}

0 comments on commit aa48e32

Please sign in to comment.