Skip to content

Commit

Permalink
fix: Fix YAKS tests
Browse files Browse the repository at this point in the history
- Update expected Json returned from OpenAQ API
- Update ActiveMQ Artemis to version v1.0.14 in tests
- Use specific ActiveMQ Artemis broker instance in tests
- Add required activemq-address field removeFromBrokerOnDelete
- Fix user report system endpoint URL
  • Loading branch information
christophd committed Aug 23, 2023
1 parent 68dfdd0 commit 1f3fe8a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 20 deletions.
1 change: 1 addition & 0 deletions infra/messaging/broker/instances/addresses/alarms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ spec:
addressName: alarms
queueName: alarms
routingType: anycast
removeFromBrokerOnDelete: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ spec:
addressName: notifications
queueName: notifications
routingType: anycast
removeFromBrokerOnDelete: true
7 changes: 4 additions & 3 deletions test/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ kafka.bootstrap.server.port=9092
kafka.bootstrap.address=${kafka.bootstrap.server.host}:${kafka.bootstrap.server.port}

# Bridge message broker configuration
messaging.broker.url.amqp=amqp://broker-hdls-svc:5672
messaging.broker.url=tcp://broker-hdls-svc:61616
quarkus.qpid-jms.url=amqp://broker-hdls-svc:5672
messaging.broker.host=artemis-broker-ss-0
messaging.broker.url.amqp=amqp://${messaging.broker.host}:5672
messaging.broker.url=tcp:${messaging.broker.host}//:61616
quarkus.qpid-jms.url=amqp://${messaging.broker.host}:5672

# Auth
users.allowed=user1,user2,user3
7 changes: 6 additions & 1 deletion test/consumers/OpenAQConsumer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ Feature: OpenAQ consumer test
And expect Kafka message with body
"""
{
"locationId": "@assertThat(nullValue())@",
"location": "@assertThat(notNullValue())@",
"parameter": "@assertThat(notNullValue())@",
"date": "@assertThat(notNullValue())@",
"value": "@assertThat(notNullValue())@",
"unit": "@assertThat(notNullValue())@",
"coordinates": "@assertThat(notNullValue())@",
"country": "@assertThat(notNullValue())@",
"city": "@assertThat(notNullValue())@"
"city": "@assertThat(notNullValue())@",
"isMobile": "@assertThat(nullValue())@",
"isAnalysis": "@assertThat(nullValue())@",
"entity": "@assertThat(nullValue())@",
"sensorType": "@assertThat(nullValue())@"
}
"""

Expand Down
1 change: 1 addition & 0 deletions test/infra/activemq-address.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ spec:
addressName: ${activemq.address}
queueName: ${activemq.address}
routingType: anycast
removeFromBrokerOnDelete: true
25 changes: 25 additions & 0 deletions test/infra/amq-broker-instance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: broker.amq.io/v1beta1
kind: ActiveMQArtemis
metadata:
name: artemis-broker
labels:
broker: activemq-artemis
spec:
acceptors:
- name: artemis_acceptor
protocols: 'artemis,core,openwire'
port: 61616
sslEnabled: false
- name: amqp_acceptor
protocols: amqp
port: 5672
sslEnabled: false
deploymentPlan:
size: 1
persistenceEnabled: false
requireLogin: false
messageMigration: false
managementRBACEnabled: true
journalType: nio
jolokiaAgentEnabled: false
image: placeholder
19 changes: 5 additions & 14 deletions test/scripts/install-amq-broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,9 @@

set -e

waitFor() {
for i in {1..30}; do
sleep 5
("$@") && return
echo "$i Waiting for command to finish"
done
exit 1
}

SOURCE=$(dirname "$0")
INFRA="${SOURCE}"/../../infra
ACTIVEMQ_VERSION=v0.19.3
INFRA="${SOURCE}"/../infra
ACTIVEMQ_VERSION=v1.0.14
URL="https://raw.githubusercontent.com/artemiscloud/activemq-artemis-operator/${ACTIVEMQ_VERSION}"

BROKER=$(kubectl get activemqartemis/broker -n ${YAKS_NAMESPACE} || echo "")
Expand All @@ -48,13 +39,13 @@ if [ -z "$BROKER" ]; then
kubectl create -f "${URL}"/deploy/operator.yaml

# wait for operator to start
waitFor kubectl wait pod -l name=activemq-artemis-operator --for condition=Ready --timeout=60s -n ${YAKS_NAMESPACE}
kubectl wait pod -l name=activemq-artemis-operator --for condition=Ready --timeout=300s -n ${YAKS_NAMESPACE}

# Create AMQ broker
kubectl create -f "${INFRA}"/messaging/broker/instances/amq-broker-instance.yaml -n ${YAKS_NAMESPACE}
kubectl create -f "${INFRA}"/amq-broker-instance.yaml -n ${YAKS_NAMESPACE}

# wait for broker to start
waitFor kubectl wait pod -l ActiveMQArtemis=broker --for condition=Ready --timeout=60s -n ${YAKS_NAMESPACE}
kubectl wait pod artemis-broker-ss-0 --for condition=Ready --timeout=300s -n ${YAKS_NAMESPACE}

else
echo "AMQ Broker instance already exists"
Expand Down
4 changes: 3 additions & 1 deletion test/user-report/UserReportCrime.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: User report and gate-keeper component test

Background:
Given URL: http://user-report-system.${YAKS_NAMESPACE}.svc.cluster.local
Given URL: http://user-report-system.${YAKS_NAMESPACE}
Given HTTP request timeout is 60000 ms
Given load variables application-test.properties
Given variables
Expand All @@ -19,12 +19,14 @@ Feature: User report and gate-keeper component test
When load Camel K integration UserReportSystem.java with configuration
| traits | knative-service.min-scale=1 |
Then Camel K integration user-report-system should be running
Then Camel K integration user-report-system should print Listening on

Scenario: Run GateKeeper Camel K integration
Given Camel K integration property file application-test.properties
When load Camel K integration GateKeeper.java with configuration
| traits | knative-service.min-scale=1 |
Given Camel K integration gate-keeper should be running
Then Camel K integration gate-keeper should print Listening on

Scenario: Crime report is send to crime-data topic
Given variable user is "user1"
Expand Down
4 changes: 3 additions & 1 deletion test/user-report/UserReportHealth.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Health user report and gate-keeper component test

Background:
Given URL: http://user-report-system.${YAKS_NAMESPACE}.svc.cluster.local
Given URL: http://user-report-system.${YAKS_NAMESPACE}
Given HTTP request timeout is 60000 ms
Given load variables application-test.properties
Given variables
Expand All @@ -19,12 +19,14 @@ Feature: Health user report and gate-keeper component test
When load Camel K integration UserReportSystem.java with configuration
| traits | knative-service.min-scale=1 |
Then Camel K integration user-report-system should be running
Then Camel K integration user-report-system should print Listening on

Scenario: Run GateKeeper Camel K integration
Given Camel K integration property file application-test.properties
When load Camel K integration GateKeeper.java with configuration
| traits | knative-service.min-scale=1 |
Given Camel K integration gate-keeper should be running
Then Camel K integration gate-keeper should print Listening on

Scenario: Health report is send to health-data topic
Given variable user is "user1"
Expand Down

0 comments on commit 1f3fe8a

Please sign in to comment.