-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup-test.sh
executable file
·60 lines (49 loc) · 1.33 KB
/
setup-test.sh
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
#!/bin/bash
dotenv() {
set -a
[ -f .env.test ] && . .env.test
set +a
}
dotenv
echo "Setup test"
tempFolder=".temp"
rm -rf $tempFolder
mkdir -p $tempFolder
seawFolder="$tempFolder/seaw"
mkdir -p "$seawFolder/distapp"
weed server -dir="$seawFolder" -s3 -s3.port=8333 -volume.preStopSeconds=0 -s3.allowedOrigins="*" -master.raftHashicorp &
for i in {1..10}; do
curl -s -IL 127.0.0.1:8333
if [ $? -eq 0 ]; then
break
fi
sleep 1
done
mkdir -p "$tempFolder/sqld"
pushd "$tempFolder/sqld"
sqld --http-listen-addr "127.0.0.1:8889" --http-auth "basic:c3FsZDppOHJ3ZXlzNzBkN2Zh" &
for i in {1..10}; do
curl -s -IL 127.0.0.1:8889
if [ $? -eq 0 ]; then
break
fi
sleep 1
done
popd
test_temp_folder="tests/.temp"
mkdir -p $test_temp_folder
# Extract tests_artifacts
echo "Extracting tests_artifacts"
function extract_test_artifacts() {
zip_file="$test_temp_folder/tests_artifacts.zip"
if [ -f "$zip_file" ]; then
echo "File $zip_file already exists. Skipping download."
else
curl -L -o $zip_file https://github.com/yunusefendi52/distapp_artifactory/releases/download/v1/tests_artifacts.zip
fi
unzip -o $zip_file -d "tests"
}
extract_test_artifacts
echo "Finish setup test"
bun run build --preset=bun
IS_RUNNING_TEST=1 HOST=localhost bun run .output/server/index.mjs