-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_all_versions.sh
More file actions
executable file
·125 lines (105 loc) · 3.38 KB
/
Copy pathtest_all_versions.sh
File metadata and controls
executable file
·125 lines (105 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# List of Gotenberg versions to test
VERSIONS=(
"8.23.2" # baseline
"8.24.0"
"8.25.0"
"8.26.0"
"8.27.0"
"8.28.0"
"8.29.0"
"8.29.1"
"8.30.0"
"8.30.1"
"8.31.0"
"8.32.0"
"8.33.0"
"8.34.0"
)
echo "=== Gotenberg Client Version Test Suite ==="
# Clean up any existing gotenberg container
docker rm -f gotenberg &>/dev/null
for VERSION in "${VERSIONS[@]}"; do
echo ""
echo "--------------------------------------------------"
echo "Testing Gotenberg version: $VERSION"
echo "--------------------------------------------------"
# Run the docker container
docker run -d --name gotenberg -p 3000:3000 gotenberg/gotenberg:$VERSION &>/dev/null
if [ $? -ne 0 ]; then
echo "Failed to start Docker container for version $VERSION"
continue
fi
# Wait for the service to be healthy (up to 15 seconds)
HEALTHY=false
for i in {1..15}; do
if curl -s http://localhost:3000/health | grep -q '"status":"up"'; then
HEALTHY=true
break
fi
sleep 1
done
if [ "$HEALTHY" = false ]; then
echo "Gotenberg service is not healthy or did not start in time."
docker logs gotenberg
docker rm -f gotenberg &>/dev/null
continue
fi
echo "Gotenberg service is up and running."
# Clean up old output files
rm -f out.pdf converturl-chromium.pdf output.pdf merged.pdf
# Run examples and track success
FAILED=0
echo "Running examples/cmd/health..."
go run examples/cmd/health/main.go > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo " [FAIL] health example"
FAILED=$((FAILED + 1))
else
echo " [OK] health example"
fi
echo "Running examples/cmd/chromium/helloworld..."
go run examples/cmd/chromium/helloworld/main.go > /dev/null 2>&1
if [ $? -ne 0 ] || [ ! -f out.pdf ]; then
echo " [FAIL] helloworld example"
FAILED=$((FAILED + 1))
else
echo " [OK] helloworld example"
fi
echo "Running examples/cmd/chromium/converturl..."
go run examples/cmd/chromium/converturl/main.go > /dev/null 2>&1
if [ $? -ne 0 ] || [ ! -f converturl-chromium.pdf ]; then
echo " [FAIL] converturl example"
FAILED=$((FAILED + 1))
else
echo " [OK] converturl example"
fi
echo "Running examples/cmd/libreoffice/convert..."
go run examples/cmd/libreoffice/convert/main.go > /dev/null 2>&1
if [ $? -ne 0 ] || [ ! -f output.pdf ]; then
echo " [FAIL] libreoffice convert example"
FAILED=$((FAILED + 1))
else
echo " [OK] libreoffice convert example"
fi
echo "Running examples/cmd/pdfengines/merge..."
go run examples/cmd/pdfengines/merge/main.go > /dev/null 2>&1
if [ $? -ne 0 ] || [ ! -f merged.pdf ]; then
echo " [FAIL] pdfengines merge example"
FAILED=$((FAILED + 1))
else
echo " [OK] pdfengines merge example"
fi
# Clean up output files
rm -f out.pdf converturl-chromium.pdf output.pdf merged.pdf
# Report results for this version
if [ $FAILED -eq 0 ]; then
echo "RESULT: Version $VERSION passed all tests successfully!"
else
echo "RESULT: Version $VERSION FAILED $FAILED tests."
fi
# Stop and remove container
docker rm -f gotenberg &>/dev/null
done
echo ""
echo "=== Test Suite Completed ==="