Skip to content

Commit 0c5bb87

Browse files
TEST: remove MQTT test to see if GH runner space issue
Signed-off-by: Kate Goldenring <[email protected]>
1 parent 765a74e commit 0c5bb87

File tree

7 files changed

+168
-191
lines changed

7 files changed

+168
-191
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ target/
99

1010
.tmp
1111

12-
test/*
12+
test/*
13+
14+
.vscode/*

scripts/deploy-workloads.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ echo ">>> apply workloads"
2626
kubectl apply -f tests/workloads-common
2727

2828
if [ "$1" == "workloads-pushed-using-spin-registry-push" ]; then
29-
update_mqtt_workload_with_broker_cluster_ip "tests/workloads-pushed-using-spin-registry-push"
29+
# update_mqtt_workload_with_broker_cluster_ip "tests/workloads-pushed-using-spin-registry-push"
3030
echo "deploying spin apps pushed to registry using 'spin registry push' command"
3131
kubectl apply -f tests/workloads-pushed-using-spin-registry-push
3232
else
33-
update_mqtt_workload_with_broker_cluster_ip "tests/workloads-pushed-using-docker-build-push"
33+
# update_mqtt_workload_with_broker_cluster_ip "tests/workloads-pushed-using-docker-build-push"
3434
echo "deploying spin apps pushed to registry using 'docker build && k3d image import' command"
3535
kubectl apply -f tests/workloads-pushed-using-docker-build-push
3636
fi

scripts/pod-terminates-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ kubectl delete pod -l app=wasm-spin --timeout 20s
77
kubectl delete pod -l app=spin-keyvalue --timeout 20s
88
kubectl delete pod -l app=spin-outbound-redis --timeout 20s
99
kubectl delete pod -l app=spin-multi-trigger-app --timeout 20s
10-
kubectl delete pod -l app=spin-mqtt-message-logger --timeout 20s
10+
# kubectl delete pod -l app=spin-mqtt-message-logger --timeout 20s
1111

tests/src/integration_test.rs

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -123,82 +123,82 @@ mod test {
123123
Ok(())
124124
}
125125

126-
#[tokio::test]
127-
async fn spin_mqtt_trigger_app_test() -> Result<()> {
128-
use std::time::Duration;
129-
let mqtt_port = 1883;
130-
let message = "MESSAGE";
131-
let iterations = 5;
132-
133-
// Ensure kubectl is in PATH
134-
if !is_kubectl_installed().await? {
135-
anyhow::bail!("kubectl is not installed");
136-
}
137-
138-
// Port forward the emqx mqtt broker
139-
let forward_port = port_forward_emqx(mqtt_port).await?;
140-
141-
// Publish a message to the emqx broker
142-
let mut mqttoptions = rumqttc::MqttOptions::new("123", "127.0.0.1", forward_port);
143-
mqttoptions.set_keep_alive(std::time::Duration::from_secs(1));
144-
145-
let (client, mut eventloop) = rumqttc::AsyncClient::new(mqttoptions, 10);
146-
client
147-
.subscribe("hello", rumqttc::QoS::AtMostOnce)
148-
.await
149-
.unwrap();
150-
151-
// Publish a message several times for redundancy
152-
tokio::task::spawn(async move {
153-
for _i in 0..iterations {
154-
client
155-
.publish(
156-
"hello",
157-
rumqttc::QoS::AtLeastOnce,
158-
false,
159-
message.as_bytes(),
160-
)
161-
.await
162-
.unwrap();
163-
tokio::time::sleep(Duration::from_millis(100)).await;
164-
}
165-
});
166-
tokio::time::sleep(Duration::from_secs(5)).await;
167-
168-
// Poll the event loop to ensure messages are published
169-
for _i in 0..iterations {
170-
eventloop.poll().await?;
171-
}
172-
thread::sleep(time::Duration::from_secs(5));
173-
174-
// Ensure that the message was received and logged by the spin app
175-
let log = get_logs_by_label("app=spin-mqtt-message-logger").await?;
176-
assert!(log.contains(message));
177-
Ok(())
178-
}
179-
180-
#[tokio::test]
181-
async fn spin_static_assets_test() -> Result<()> {
182-
let host_port = 8082;
183-
184-
// curl for static asset
185-
println!(
186-
" >>> curl http://localhost:{}/static-assets/jabberwocky.txt",
187-
host_port
188-
);
189-
let res = retry_get(
190-
&format!(
191-
"http://localhost:{}/static-assets/jabberwocky.txt",
192-
host_port
193-
),
194-
RETRY_TIMES,
195-
INTERVAL_IN_SECS,
196-
)
197-
.await?;
198-
assert!(String::from_utf8_lossy(&res).contains("'Twas brillig, and the slithy toves"));
199-
200-
Ok(())
201-
}
126+
// #[tokio::test]
127+
// async fn spin_mqtt_trigger_app_test() -> Result<()> {
128+
// use std::time::Duration;
129+
// let mqtt_port = 1883;
130+
// let message = "MESSAGE";
131+
// let iterations = 5;
132+
133+
// // Ensure kubectl is in PATH
134+
// if !is_kubectl_installed().await? {
135+
// anyhow::bail!("kubectl is not installed");
136+
// }
137+
138+
// // Port forward the emqx mqtt broker
139+
// let forward_port = port_forward_emqx(mqtt_port).await?;
140+
141+
// // Publish a message to the emqx broker
142+
// let mut mqttoptions = rumqttc::MqttOptions::new("123", "127.0.0.1", forward_port);
143+
// mqttoptions.set_keep_alive(std::time::Duration::from_secs(1));
144+
145+
// let (client, mut eventloop) = rumqttc::AsyncClient::new(mqttoptions, 10);
146+
// client
147+
// .subscribe("hello", rumqttc::QoS::AtMostOnce)
148+
// .await
149+
// .unwrap();
150+
151+
// // Publish a message several times for redundancy
152+
// tokio::task::spawn(async move {
153+
// for _i in 0..iterations {
154+
// client
155+
// .publish(
156+
// "hello",
157+
// rumqttc::QoS::AtLeastOnce,
158+
// false,
159+
// message.as_bytes(),
160+
// )
161+
// .await
162+
// .unwrap();
163+
// tokio::time::sleep(Duration::from_millis(100)).await;
164+
// }
165+
// });
166+
// tokio::time::sleep(Duration::from_secs(5)).await;
167+
168+
// // Poll the event loop to ensure messages are published
169+
// for _i in 0..iterations {
170+
// eventloop.poll().await?;
171+
// }
172+
// thread::sleep(time::Duration::from_secs(5));
173+
174+
// // Ensure that the message was received and logged by the spin app
175+
// let log = get_logs_by_label("app=spin-mqtt-message-logger").await?;
176+
// assert!(log.contains(message));
177+
// Ok(())
178+
// }
179+
180+
// #[tokio::test]
181+
// async fn spin_static_assets_test() -> Result<()> {
182+
// let host_port = 8082;
183+
184+
// // curl for static asset
185+
// println!(
186+
// " >>> curl http://localhost:{}/static-assets/jabberwocky.txt",
187+
// host_port
188+
// );
189+
// let res = retry_get(
190+
// &format!(
191+
// "http://localhost:{}/static-assets/jabberwocky.txt",
192+
// host_port
193+
// ),
194+
// RETRY_TIMES,
195+
// INTERVAL_IN_SECS,
196+
// )
197+
// .await?;
198+
// assert!(String::from_utf8_lossy(&res).contains("'Twas brillig, and the slithy toves"));
199+
200+
// Ok(())
201+
// }
202202

203203
async fn is_kubectl_installed() -> anyhow::Result<bool> {
204204
let output: Result<std::process::Output, std::io::Error> = Command::new("kubectl")

tests/workloads-common/mqtt-broker.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/workloads-pushed-using-docker-build-push/workloads.yaml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -259,46 +259,46 @@ spec:
259259
targetPort: 80
260260
selector:
261261
app: spin-static-assets
262-
---
263-
apiVersion: apps/v1
264-
kind: Deployment
265-
metadata:
266-
name: spin-mqtt-message-logger
267-
spec:
268-
replicas: 1
269-
selector:
270-
matchLabels:
271-
app: spin-mqtt-message-logger
272-
template:
273-
metadata:
274-
labels:
275-
app: spin-mqtt-message-logger
276-
spec:
277-
runtimeClassName: wasmtime-spin
278-
containers:
279-
- name: spin-mqtt-message-logger
280-
image: docker.io/library/spin-mqtt-message-logger:latest
281-
imagePullPolicy: IfNotPresent
282-
command: ["/"]
283-
ports:
284-
- containerPort: 80
285-
env:
286-
- name: SPIN_VARIABLE_MQTT_TOPIC
287-
value: hello
288-
# The MQTT trigger cannot do DNS resolution, so we need to use the IP address of the MQTT broker
289-
# Substitute `EMQX_CLUSTER_IP` with the result of `kubectl get svc emqx -n default -o jsonpath='{.spec.clusterIP}'`
290-
- name: SPIN_VARIABLE_MQTT_BROKER_URI
291-
value: "mqtt://EMQX_CLUSTER_IP:1883"
292-
---
293-
apiVersion: v1
294-
kind: Service
295-
metadata:
296-
name: spin-mqtt-message-logger
297-
spec:
298-
type: LoadBalancer
299-
ports:
300-
- protocol: TCP
301-
port: 80
302-
targetPort: 80
303-
selector:
304-
app: spin-mqtt-message-logger
262+
# ---
263+
# apiVersion: apps/v1
264+
# kind: Deployment
265+
# metadata:
266+
# name: spin-mqtt-message-logger
267+
# spec:
268+
# replicas: 1
269+
# selector:
270+
# matchLabels:
271+
# app: spin-mqtt-message-logger
272+
# template:
273+
# metadata:
274+
# labels:
275+
# app: spin-mqtt-message-logger
276+
# spec:
277+
# runtimeClassName: wasmtime-spin
278+
# containers:
279+
# - name: spin-mqtt-message-logger
280+
# image: docker.io/library/spin-mqtt-message-logger:latest
281+
# imagePullPolicy: IfNotPresent
282+
# command: ["/"]
283+
# ports:
284+
# - containerPort: 80
285+
# env:
286+
# - name: SPIN_VARIABLE_MQTT_TOPIC
287+
# value: hello
288+
# # The MQTT trigger cannot do DNS resolution, so we need to use the IP address of the MQTT broker
289+
# # Substitute `EMQX_CLUSTER_IP` with the result of `kubectl get svc emqx -n default -o jsonpath='{.spec.clusterIP}'`
290+
# - name: SPIN_VARIABLE_MQTT_BROKER_URI
291+
# value: "mqtt://EMQX_CLUSTER_IP:1883"
292+
# ---
293+
# apiVersion: v1
294+
# kind: Service
295+
# metadata:
296+
# name: spin-mqtt-message-logger
297+
# spec:
298+
# type: LoadBalancer
299+
# ports:
300+
# - protocol: TCP
301+
# port: 80
302+
# targetPort: 80
303+
# selector:
304+
# app: spin-mqtt-message-logger

tests/workloads-pushed-using-spin-registry-push/workloads.yaml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -259,46 +259,46 @@ spec:
259259
targetPort: 80
260260
selector:
261261
app: spin-static-assets
262-
---
263-
apiVersion: apps/v1
264-
kind: Deployment
265-
metadata:
266-
name: spin-mqtt-message-logger
267-
spec:
268-
replicas: 1
269-
selector:
270-
matchLabels:
271-
app: spin-mqtt-message-logger
272-
template:
273-
metadata:
274-
labels:
275-
app: spin-mqtt-message-logger
276-
spec:
277-
runtimeClassName: wasmtime-spin
278-
containers:
279-
- name: spin-mqtt-message-logger
280-
image: test-registry:5000/spin-registry-push/spin-mqtt-message-logger:latest
281-
imagePullPolicy: IfNotPresent
282-
command: ["/"]
283-
ports:
284-
- containerPort: 80
285-
env:
286-
- name: SPIN_VARIABLE_MQTT_TOPIC
287-
value: hello
288-
# The MQTT trigger cannot do DNS resolution, so we need to use the IP address of the MQTT broker
289-
# Substitute `EMQX_CLUSTER_IP` with the result of `kubectl get svc emqx -n default -o jsonpath='{.spec.clusterIP}'`
290-
- name: SPIN_VARIABLE_MQTT_BROKER_URI
291-
value: "mqtt://EMQX_CLUSTER_IP:1883"
292-
---
293-
apiVersion: v1
294-
kind: Service
295-
metadata:
296-
name: spin-mqtt-message-logger
297-
spec:
298-
type: LoadBalancer
299-
ports:
300-
- protocol: TCP
301-
port: 80
302-
targetPort: 80
303-
selector:
304-
app: spin-mqtt-message-logger
262+
# ---
263+
# apiVersion: apps/v1
264+
# kind: Deployment
265+
# metadata:
266+
# name: spin-mqtt-message-logger
267+
# spec:
268+
# replicas: 1
269+
# selector:
270+
# matchLabels:
271+
# app: spin-mqtt-message-logger
272+
# template:
273+
# metadata:
274+
# labels:
275+
# app: spin-mqtt-message-logger
276+
# spec:
277+
# runtimeClassName: wasmtime-spin
278+
# containers:
279+
# - name: spin-mqtt-message-logger
280+
# image: test-registry:5000/spin-registry-push/spin-mqtt-message-logger:latest
281+
# imagePullPolicy: IfNotPresent
282+
# command: ["/"]
283+
# ports:
284+
# - containerPort: 80
285+
# env:
286+
# - name: SPIN_VARIABLE_MQTT_TOPIC
287+
# value: hello
288+
# # The MQTT trigger cannot do DNS resolution, so we need to use the IP address of the MQTT broker
289+
# # Substitute `EMQX_CLUSTER_IP` with the result of `kubectl get svc emqx -n default -o jsonpath='{.spec.clusterIP}'`
290+
# - name: SPIN_VARIABLE_MQTT_BROKER_URI
291+
# value: "mqtt://EMQX_CLUSTER_IP:1883"
292+
# ---
293+
# apiVersion: v1
294+
# kind: Service
295+
# metadata:
296+
# name: spin-mqtt-message-logger
297+
# spec:
298+
# type: LoadBalancer
299+
# ports:
300+
# - protocol: TCP
301+
# port: 80
302+
# targetPort: 80
303+
# selector:
304+
# app: spin-mqtt-message-logger

0 commit comments

Comments
 (0)