Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e test for broadcast subscription type of resource status update #137

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,31 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup kind
uses: engineerd/[email protected]
- name: install ginkgo
run: go install github.com/onsi/ginkgo/v2/[email protected]
- name: Test E2E
run: |
make e2e-test
env:
container_tool: docker
e2e-broadcast-subscription:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
version: v0.17.0
go-version: ${{ env.GO_VERSION }}
# - name: Setup kind
# uses: engineerd/[email protected]
# with:
# version: v0.17.0
- name: install ginkgo
run: go install github.com/onsi/ginkgo/v2/[email protected]
- name: Test E2E
run: |
make e2e-test
env:
container_tool: docker
ENABLE_BROADCAST_SUBSCRIPTION: true
25 changes: 22 additions & 3 deletions test/e2e/setup/e2e_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,26 @@ kubectl create secret generic maestro-mqtt-certs -n $namespace --from-file=ca.cr
kubectl patch deploy/maestro-mqtt -n $namespace --type='json' -p='[{"op":"add","path":"/spec/template/spec/volumes/-","value":{"name":"mosquitto-certs","secret":{"secretName":"maestro-mqtt-certs"}}},{"op":"add","path":"/spec/template/spec/containers/0/volumeMounts/-","value":{"name":"mosquitto-certs","mountPath":"/mosquitto/certs"}}]'
kubectl wait deploy/maestro-mqtt -n $namespace --for condition=Available=True --timeout=200s

# apply the maestro-mqtt secret
cat << EOF | kubectl -n $namespace apply -f -
maestroServerPatch='[{"op":"add","path":"/spec/template/spec/volumes/-","value":{"name":"mqtt-certs","secret":{"secretName":"maestro-server-certs"}}},{"op":"add","path":"/spec/template/spec/containers/0/volumeMounts/-","value":{"name":"mqtt-certs","mountPath":"/secrets/mqtt-certs"}},{"op":"replace","path":"/spec/template/spec/containers/0/livenessProbe/initialDelaySeconds","value":1},{"op":"replace","path":"/spec/template/spec/containers/0/readinessProbe/initialDelaySeconds","value":1}]'
if [ -n "${ENABLE_BROADCAST_SUBSCRIPTION}" ] && [ "${ENABLE_BROADCAST_SUBSCRIPTION}" = "true" ]; then
maestroServerPatch='[{"op":"add","path":"/spec/template/spec/containers/0/command/-","value":"--subscription-type=broadcast"},{"op":"add","path":"/spec/template/spec/volumes/-","value":{"name":"mqtt-certs","secret":{"secretName":"maestro-server-certs"}}},{"op":"add","path":"/spec/template/spec/containers/0/volumeMounts/-","value":{"name":"mqtt-certs","mountPath":"/secrets/mqtt-certs"}},{"op":"replace","path":"/spec/template/spec/containers/0/livenessProbe/initialDelaySeconds","value":1},{"op":"replace","path":"/spec/template/spec/containers/0/readinessProbe/initialDelaySeconds","value":1}]'
cat << EOF | kubectl -n $namespace apply -f -
apiVersion: v1
kind: Secret
metadata:
name: maestro-mqtt
stringData:
config.yaml: |
brokerHost: maestro-mqtt-server.maestro:1883
caFile: /secrets/mqtt-certs/ca.crt
clientCertFile: /secrets/mqtt-certs/client.crt
clientKeyFile: /secrets/mqtt-certs/client.key
topics:
sourceEvents: sources/maestro/consumers/+/sourceevents
agentEvents: sources/maestro/consumers/+/agentevents
EOF
else
cat << EOF | kubectl -n $namespace apply -f -
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -168,10 +186,11 @@ stringData:
sourceEvents: sources/maestro/consumers/+/sourceevents
agentEvents: \$share/statussubscribers/sources/maestro/consumers/+/agentevents
EOF
fi

# create secret containing the client certs to mqtt broker and patch the maestro deployment
kubectl create secret generic maestro-server-certs -n $namespace --from-file=ca.crt=${certDir}/ca.crt --from-file=client.crt=${certDir}/server-client.crt --from-file=client.key=${certDir}/server-client.key
kubectl patch deploy/maestro -n $namespace --type='json' -p='[{"op": "add","path":"/spec/template/spec/volumes/-","value":{"name":"mqtt-certs","secret":{"secretName":"maestro-server-certs"}}},{"op":"add","path":"/spec/template/spec/containers/0/volumeMounts/-","value":{"name":"mqtt-certs","mountPath":"/secrets/mqtt-certs"}},{"op":"replace","path":"/spec/template/spec/containers/0/livenessProbe/initialDelaySeconds","value":1},{"op":"replace","path":"/spec/template/spec/containers/0/readinessProbe/initialDelaySeconds","value":1}]'
kubectl patch deploy/maestro -n $namespace --type='json' -p=${maestroServerPatch}
kubectl wait deploy/maestro -n $namespace --for condition=Available=True --timeout=200s

# 6. create a consumer
Expand Down