3030 REGISTRY : ${{ inputs.registry }}
3131
3232jobs :
33- e2e-test :
33+ e2e-test-policy-export :
3434 timeout-minutes : 5
3535 strategy :
3636 matrix :
@@ -72,15 +72,85 @@ jobs:
7272 sleep 10 ;
7373 fi
7474 done
75-
75+
7676 echo Outputting all logs
7777 echo _SNIFFER LOGS_
7878 kubectl logs -n otterize-system -l app=otterize-network-sniffer --tail=-1
7979 echo _MAPPER LOGS_
8080 kubectl logs -n otterize-system -l app=otterize-network-mapper --tail=-1
81-
81+
8282 echo "export intents and compare to expected file"
8383 otterize network-mapper export --telemetry-enabled=false -n otterize-tutorial-mapper --format=json | jq 'sort_by(.metadata.namespace + .metadata.name)' > /tmp/intents.json
8484 diff .github/workflows/tests-expected-results/simple-tutorial-intents.json /tmp/intents.json
8585 echo "expected" && cat .github/workflows/tests-expected-results/simple-tutorial-intents.json
8686 echo "actual" && cat /tmp/intents.json
87+
88+ e2e-test-kafka :
89+ timeout-minutes : 8
90+ runs-on : ubuntu-latest
91+ steps :
92+ - name : Test setup
93+ uses : ./.github/workflows/e2e-test-setpup-action.yaml
94+ with :
95+ mapper-tag : ${{ inputs.mapper-tag }}
96+ sniffer-tag : ${{ inputs.sniffer-tag }}
97+ mapper-image : ${{ inputs.mapper-image }}
98+ sniffer-image : ${{ inputs.sniffer-image }}
99+ registry : ${{ inputs.registry }}
100+ install-extra-flags : " --set kafkawatcher.enable=true --set kafkawatcher.kafkaServers={\" kafka-0.kafka\" } "
101+
102+ - name : Deploy Kafka
103+ run : |-
104+ helm repo add otterize https://helm.otterize.com
105+ helm repo update
106+ helm install --create-namespace -n kafka -f https://docs.otterize.com/code-examples/kafka-mapping/helm/values.yaml kafka otterize/kafka --version 21.4.4
107+
108+ - name : Deploy Kafka Tutorial services
109+ run : |-
110+ kubectl apply -n otterize-tutorial-kafka-mapping -f https://docs.otterize.com/code-examples/kafka-mapping/all.yaml
111+
112+ - name : Wait for Kafka & Tutorial services
113+ run : |-
114+ kubectl wait pods -n kafka -l app.kubernetes.io/component=kafka --for condition=Ready --timeout=90s
115+ kubectl wait pods -n kafka -l app.kubernetes.io/component=zookeeper --for condition=Ready --timeout=90s
116+ kubectl wait pods -n otterize-system -l app=otterize-kafka-watcher --for condition=Ready --timeout=90s
117+ kubectl wait pods -n otterize-tutorial-kafka-mapping -l app=client --for condition=Ready --timeout=90s
118+ kubectl wait pods -n otterize-tutorial-kafka-mapping -l app=client-2 --for condition=Ready --timeout=90s
119+
120+ - name : Test Policy Export
121+ run : |-
122+ # wait for 2 intents to be discovered with timeout of 30 seconds.
123+ # sleeps 10 because this is the report interval from the watcher to the mapper
124+ for i in {1..5}
125+ do
126+ OUTPUT_JSON=`otterize network-mapper export --telemetry-enabled=false -n otterize-tutorial-kafka-mapping --format=json`
127+ if [ `echo "$OUTPUT_JSON" | jq ". | length"` != 2 ] || [ `echo "$OUTPUT_JSON" | jq '[.[] | select(.spec.targets[] | has("kafka"))] | length'` != 2 ] ; then
128+ echo "wait for discovered intents";
129+ echo _SNIFFER LOGS_
130+ kubectl logs --since=15s -n otterize-system -l app=otterize-network-sniffer
131+ echo _MAPPER LOGS_
132+ kubectl logs --since=15s -n otterize-system -l app=otterize-network-mapper
133+ sleep 10 ;
134+ fi
135+ done
136+
137+ echo Outputting all logs
138+ echo _SNIFFER LOGS_
139+ kubectl logs -n otterize-system -l app=otterize-network-sniffer --tail=-1
140+ echo _MAPPER LOGS_
141+ kubectl logs -n otterize-system -l app=otterize-network-mapper --tail=-1
142+
143+ echo "export intents and compare to expected file"
144+ otterize network-mapper export --telemetry-enabled=false -n otterize-tutorial-kafka-mapping --format=json | jq 'sort_by(.metadata.namespace + .metadata.name)' > /tmp/intents.json
145+ diff .github/workflows/tests-expected-results/kafka-tutorial-intents.json /tmp/intents.json
146+ echo "expected" && cat .github/workflows/tests-expected-results/kafka-tutorial-intents.json
147+ echo "actual" && cat /tmp/intents.json
148+
149+ e2e-test :
150+ needs :
151+ - e2e-test-policy-export
152+ - e2e-test-kafka
153+ runs-on : ubuntu-latest
154+ steps :
155+ - run : |-
156+ echo Success! This step is only here to depend on the tests.
0 commit comments