Skip to content

Commit 13f9640

Browse files
committed
add init
1 parent a474e35 commit 13f9640

File tree

4 files changed

+111
-0
lines changed

4 files changed

+111
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# VERSION format is major.minor.patch-post where major, minor, patch and post are integer numbers
3+
# bump post to deploy to the current live Release, rollback to previous post version is not available
4+
# bump patch or minor to deploy a new Release and auto-promote it to live. Add TB_AUTO_PROMOTE=0 to create the Release in preview status
5+
# bump major to deploy a new Release in preview status
6+
VERSION=0.0.0
7+
8+
9+
10+
##########
11+
# OPTIONAL env vars
12+
# Deploy a new Release in preview status (default is 1)
13+
# TB_AUTO_PROMOTE=0
14+
15+
# Check if deploy requires backfilling on preview (default is 1)
16+
# TB_CHECK_BACKFILL_REQUIRED=0
17+
18+
# Force old Releases deletion on promote (default is 0)
19+
# Setting it to 1 will remove oldest rollback Releases even when some resource is still in use
20+
# TB_FORCE_REMOVE_OLDEST_ROLLBACK=0
21+
22+
# Don't print CLI version warning message if there's a new available version
23+
# TB_VERSION_WARNING=0
24+
25+
# Skip regression tests
26+
# TB_SKIP_REGRESSION=0
27+
28+
# Use `OBFUSCATE_REGEX_PATTERN` and `OBFUSCATE_PATTERN_SEPARATOR` environment variables to define a regex pattern and a separator (in case of a single string with multiple regex) to obfuscate secrets in the CLI output.
29+
# OBFUSCATE_REGEX_PATTERN="https://(www\.)?[^/]+||^Follow these instructions =>"
30+
# OBFUSCATE_PATTERN_SEPARATOR=||
31+
##########
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tinybird-cli>=4,<5
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
#!/usr/bin/env bash
3+
set -euxo pipefail
4+
5+
directory="datasources/fixtures"
6+
extensions=("csv" "ndjson")
7+
8+
absolute_directory=$(realpath "$directory")
9+
10+
for extension in "${extensions[@]}"; do
11+
file_list=$(find "$absolute_directory" -type f -name "*.$extension")
12+
13+
for file_path in $file_list; do
14+
file_name=$(basename "$file_path")
15+
file_name_without_extension="${file_name%.*}"
16+
17+
command="tb datasource append $file_name_without_extension datasources/fixtures/$file_name"
18+
echo $command
19+
$command
20+
done
21+
done
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
#!/usr/bin/env bash
3+
set -euxo pipefail
4+
5+
export TB_VERSION_WARNING=0
6+
7+
run_test() {
8+
t=$1
9+
echo "** Running $t **"
10+
echo "** $(cat $t)"
11+
tmpfile=$(mktemp)
12+
retries=0
13+
TOTAL_RETRIES=3
14+
15+
# When appending fixtures, we need to retry in case of the data is not replicated in time
16+
while [ $retries -lt $TOTAL_RETRIES ]; do
17+
# Run the test and store the output in a temporary file
18+
bash $t $2 >$tmpfile
19+
exit_code=$?
20+
if [ "$exit_code" -eq 0 ]; then
21+
# If the test passed, break the loop
22+
if diff -B ${t}.result $tmpfile >/dev/null 2>&1; then
23+
break
24+
# If the test failed, increment the retries counter and try again
25+
else
26+
retries=$((retries+1))
27+
fi
28+
# If the bash command failed, print an error message and break the loop
29+
else
30+
break
31+
fi
32+
done
33+
34+
if diff -B ${t}.result $tmpfile >/dev/null 2>&1; then
35+
echo "✅ Test $t passed"
36+
rm $tmpfile
37+
return 0
38+
elif [ $retries -eq $TOTAL_RETRIES ]; then
39+
echo "🚨 ERROR: Test $t failed, diff:";
40+
diff -B ${t}.result $tmpfile
41+
rm $tmpfile
42+
return 1
43+
else
44+
echo "🚨 ERROR: Test $t failed with bash command exit code $?"
45+
cat $tmpfile
46+
rm $tmpfile
47+
return 1
48+
fi
49+
echo ""
50+
}
51+
export -f run_test
52+
53+
fail=0
54+
find ./tests -name "*.test" -print0 | xargs -0 -I {} -P 4 bash -c 'run_test "$@"' _ {} || fail=1
55+
56+
if [ $fail == 1 ]; then
57+
exit -1;
58+
fi

0 commit comments

Comments
 (0)