forked from getsentry/self-hosted
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-sdk-assets-test.sh
executable file
·38 lines (29 loc) · 1.15 KB
/
js-sdk-assets-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
#!/usr/bin/env bash
source _unit-test/_test_setup.sh
source install/dc-detect-version.sh
$dcb --force-rm web
$dc pull nginx
export SETUP_JS_SDK_ASSETS=1
source install/setup-js-sdk-assets.sh
sdk_files=$($dcr --no-deps -v "sentry-nginx-www:/var/www" nginx ls -lah /var/www/js-sdk/)
sdk_tree=$($dcr --no-deps -v "sentry-nginx-www:/var/www" nginx tree /var/www/js-sdk/ | tail -n 1)
non_empty_file_count=$($dcr --no-deps -v "sentry-nginx-www:/var/www" nginx find /var/www/js-sdk/ -type f -size +1k | wc -l)
# `sdk_files` should contains 5 lines, '4.*', '5.*', '6.*', `7.*` and `8.*`
echo $sdk_files
total_directories=$(echo "$sdk_files" | grep -c '[45678]\.[0-9]*\.[0-9]*$')
echo $total_directories
test "5" == "$total_directories"
echo "Pass"
# `sdk_tree` should output "5 directories, 17 files"
echo "$sdk_tree"
test "5 directories, 17 files" == "$(echo "$sdk_tree")"
echo "Pass"
# Files should all be >1k (ensure they are not empty)
echo "Testing file sizes"
test "17" == "$non_empty_file_count"
echo "Pass"
# Files should be owned by the nginx user
echo "Testing file ownership"
test $($sdk_files | awk '$3=="nginx" { print $0 }' | wc -l) == "5"
echo "Pass"
report_success