mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-23 20:13:21 +03:00
8ef4efa0f5
https://github.com/twentyhq/private-issues/issues/75 **TLDR** Add twenty-server package, wich contains the last tinybird datasources and pipes used in analytics. This new version of the API endpoints, pipes and datasources are inspired by the implementation of dub.co (https://github.com/dubinc/dub/blob/main/packages/tinybird/). It contains the webhooks analytics, serverless functions duration and serverless functions error count analytics. As well as **In order to test** - Follow the instructions in the README.md on twenty-tinybird using your admin token from twenty_analytics_playground if you want to modify them. - For a better experience add the extension Tinybird support for VsCode - If you want more info about datasources and pipes please read the tinybird docs. --------- Co-authored-by: Félix Malfait <felix@twenty.com> Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
|
|
export TB_VERSION_WARNING=0
|
|
|
|
run_test() {
|
|
t=$1
|
|
echo "** Running $t **"
|
|
echo "** $(cat $t)"
|
|
tmpfile=$(mktemp)
|
|
retries=0
|
|
TOTAL_RETRIES=3
|
|
|
|
# When appending fixtures, we need to retry in case of the data is not replicated in time
|
|
while [ $retries -lt $TOTAL_RETRIES ]; do
|
|
# Run the test and store the output in a temporary file
|
|
bash $t $2 >$tmpfile
|
|
exit_code=$?
|
|
if [ "$exit_code" -eq 0 ]; then
|
|
# If the test passed, break the loop
|
|
if diff -B ${t}.result $tmpfile >/dev/null 2>&1; then
|
|
break
|
|
# If the test failed, increment the retries counter and try again
|
|
else
|
|
retries=$((retries+1))
|
|
fi
|
|
# If the bash command failed, print an error message and break the loop
|
|
else
|
|
break
|
|
fi
|
|
done
|
|
|
|
if diff -B ${t}.result $tmpfile >/dev/null 2>&1; then
|
|
echo "✅ Test $t passed"
|
|
rm $tmpfile
|
|
return 0
|
|
elif [ $retries -eq $TOTAL_RETRIES ]; then
|
|
echo "🚨 ERROR: Test $t failed, diff:";
|
|
diff -B ${t}.result $tmpfile
|
|
rm $tmpfile
|
|
return 1
|
|
else
|
|
echo "🚨 ERROR: Test $t failed with bash command exit code $?"
|
|
cat $tmpfile
|
|
rm $tmpfile
|
|
return 1
|
|
fi
|
|
echo ""
|
|
}
|
|
export -f run_test
|
|
|
|
fail=0
|
|
find ./tests -name "*.test" -print0 | xargs -0 -I {} -P 4 bash -c 'run_test "$@"' _ {} || fail=1
|
|
|
|
if [ $fail == 1 ]; then
|
|
exit -1;
|
|
fi
|