File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ build_and_run () {
6
+ STDOUT_FILE=$( mktemp)
7
+ STDERR_FILE=$( mktemp)
8
+
9
+ spin build -f $1
10
+ # This is run in the background so we can `curl` it later on
11
+ spin otel up -- -f $1 > $STDOUT_FILE 2> $STDERR_FILE &
12
+ SPIN_PID=$!
13
+ sleep 2
14
+
15
+ # If the process doesn't exist, `spin otel up` failed
16
+ if ! kill -0 $SPIN_PID 2> /dev/null; then
17
+ echo " ### STDOUT ###"
18
+ cat $STDOUT_FILE
19
+ echo
20
+ echo " ### STDERR ###"
21
+ cat $STDERR_FILE
22
+ rm $STDOUT_FILE $STDERR_FILE
23
+ exit 1
24
+ fi
25
+
26
+ curl localhost:3000
27
+ kill $SPIN_PID
28
+ rm $STDOUT_FILE $STDERR_FILE
29
+ }
30
+
31
+ # #######################################
32
+ # Rust Examples #
33
+ # #######################################
34
+
35
+ # spin-basic
36
+ build_and_run " rust/examples/spin-basic/spin.toml"
37
+
38
+ # spin-tracing
39
+ build_and_run " rust/examples/spin-tracing/spin.toml"
You can’t perform that action at this time.
0 commit comments