1
0
mirror of synced 2025-12-26 14:02:10 -05:00
Files
airbyte/airbyte-cdk/python/bin/low-code-unit-tests.sh
Brian Lai 52f83d4cda [source-monday] [source-square] [source-greenhouse] [source-tempo] [source-zenloop] fix a few connectors with failing custom component unit tests + release some connectors w/ beta (#23231)
* fix a few connectors with failing custom component unit tests

* fix outdated expected records

* make square orders stream incremental

* Updated square SAT and delete custom extractor for monday.

* Added allowedHosts

* Delete DpathStringExtractor from init

* Updated abnormal records

* bump versions of greenhouse, tempo, woocommerce, and zenloop to use beta low code version

* remove woocommerce because it's already published with beta

* add allowedHosts for tempo and zenloop

* fix abnormal state file to use created_at for some streams

* auto-bump connector version

* bump versions for square and monday

* auto-bump connector version

* auto-bump connector version

* manually update square definition generation due to failure

* auto-bump connector version

---------

Co-authored-by: Serhii Lazebnyi <serhii.lazebnyi@globallogic.com>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
2023-03-08 14:44:27 -05:00

43 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Ideally we'd like to have set -e, but when set -e is used, the `python -m pytest unit_tests` command can return a
# non-zero exit code and end the whole script prematurely
# set -e
[ -z "$ROOT_DIR" ] && exit 1
CONNECTORS_DIR=$ROOT_DIR/airbyte-integrations/connectors
CDK_DIR=$ROOT_DIR/airbyte-cdk/python/
for directory in $CONNECTORS_DIR/source-* ; do
MANIFEST_DIRECTORY=$(basename $directory | tr - _)
SOURCE_NAME=${MANIFEST_DIRECTORY#source_}
if test -f "$directory/$MANIFEST_DIRECTORY/manifest.yaml"; then
cd $directory
# Unit tests are optional for most connectors unless they implement custom components
if [ -d "unit_tests" ]; then
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt > /dev/null 2>&1
pip install -e ".[tests]" > /dev/null 2>&1
pip install -e $CDK_DIR > /dev/null 2>&1
test_output=$(python -m pytest unit_tests)
ret=$?
if [[ "$test_output" == *"no tests ran"* ]]; then
# When there are no tests defined, code 5 gets emitted so we should also check test output for no tests run
echo "Source $SOURCE_NAME did not have any tests"
elif [ $ret -ne 0 ]; then
echo "----Tests failed for source $SOURCE_NAME"
else
echo "Source $SOURCE_NAME passed tests"
fi
deactivate
cd ..
fi
fi
done