diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml deleted file mode 100644 index f04a96c1c9..0000000000 --- a/.github/workflows/build_test.yml +++ /dev/null @@ -1,628 +0,0 @@ -name: Build and Test - -on: - push: - branches: - - master - - main - - dev/aio-connector - tags: - - v* - pull_request: - branches: - - '**' - workflow_dispatch: - inputs: - logLevel: - default: warning - description: "Log level" - required: true - tags: - description: "Test scenario tags" - -concurrency: - # older builds for the same pull request number or branch should be cancelled - cancel-in-progress: true - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - -jobs: - lint: - name: Check linting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Display Python version - run: python -c "import sys; import os; print(\"\n\".join(os.environ[\"PATH\"].split(os.pathsep))); print(sys.version); print(sys.executable);" - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Set PY - run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - uses: actions/cache@v4 - with: - path: ~/.cache/pre-commit - key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - name: Run fix_lint - run: python -m tox run -e fix_lint - - dependency: - name: Check dependency - runs-on: ubuntu-latest - strategy: - matrix: - # TODO: temporarily reduce number of jobs: SNOW-2311643 - # python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - python-version: ["3.9", "3.13"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Install tox - run: python -m pip install tox>=4 - - name: Run tests - run: python -m tox run -e dependency - - build: - needs: lint - strategy: - matrix: - os: - - image: ubuntu-latest - id: manylinux_x86_64 - - image: ubuntu-latest - id: manylinux_aarch64 - - image: windows-latest - id: win_amd64 - - image: windows-11-arm - id: win_arm64 - - image: macos-latest - id: macosx_x86_64 - - image: macos-latest - id: macosx_arm64 - # TODO: temporarily reduce number of jobs: SNOW-2311643 - # python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - python-version: ["3.9", "3.13"] - exclude: - - os: - image: windows-11-arm - id: win_arm64 - python-version: "3.9" - - os: - image: windows-11-arm - id: win_arm64 - python-version: "3.10" - name: Build ${{ matrix.os.id }}-py${{ matrix.python-version }} - runs-on: ${{ matrix.os.image }} - steps: - - name: Set shortver - run: echo "shortver=${longver//./}" >> $GITHUB_ENV - env: - longver: ${{ matrix.python-version }} - shell: bash - - name: Set up QEMU - if: ${{ matrix.os.id == 'manylinux_aarch64' }} - uses: docker/setup-qemu-action@v2 - with: - # xref https://github.com/docker/setup-qemu-action/issues/188 - # xref https://github.com/tonistiigi/binfmt/issues/215 - image: tonistiigi/binfmt:qemu-v8.1.5 - platforms: all - - uses: actions/checkout@v4 - - name: Building wheel - uses: pypa/cibuildwheel@v2.21.3 - env: - CIBW_BUILD: cp${{ env.shortver }}-${{ matrix.os.id }} - CIBW_ARCHS_WINDOWS: ${{ matrix.os.id == 'win_arm64' && 'ARM64' || 'auto' }} - MACOSX_DEPLOYMENT_TARGET: 10.14 # Should be kept in sync with ci/build_darwin.sh - with: - output-dir: dist - - name: Show wheels generated - run: ls -lh dist - shell: bash - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: ${{ matrix.os.id }}_py${{ matrix.python-version }} - path: dist/ - - test: - name: Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: build - runs-on: ${{ matrix.os.image_name }} - strategy: - fail-fast: false - matrix: - os: - - image_name: ubuntu-latest - download_name: manylinux_x86_64 - - image_name: macos-latest - download_name: macosx_x86_64 - - image_name: windows-latest - download_name: win_amd64 - - image_name: windows-11-arm - download_name: win_arm64 - # TODO: temporarily reduce number of jobs: SNOW-2311643 - # python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - python-version: ["3.9", "3.13"] - cloud-provider: [aws, azure, gcp] - exclude: - - os: - image_name: windows-11-arm - download_name: win_arm64 - python-version: "3.9" - - os: - image_name: windows-11-arm - download_name: win_arm64 - python-version: "3.10" - - os: - image_name: windows-11-arm - download_name: win_arm64 - python-version: "3.11" - - os: - image_name: windows-11-arm - download_name: win_arm64 - python-version: "3.12" - - os: - image_name: windows-11-arm - download_name: win_arm64 - python-version: "3.13" - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Set up Java - uses: actions/setup-java@v4 # for wiremock - with: - java-version: ${{ matrix.os.download_name == 'win_arm64' && '21.0.5+11.0.LTS' || '11' }} - distribution: 'temurin' - java-package: 'jre' - - name: Fetch Wiremock - shell: bash - run: curl https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/3.11.0/wiremock-standalone-3.11.0.jar --output .wiremock/wiremock-standalone.jar - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/public/parameters_${{ matrix.cloud-provider }}.py.gpg > test/parameters.py - - name: Setup private key file - shell: bash - env: - PYTHON_PRIVATE_KEY_SECRET: ${{ secrets.PYTHON_PRIVATE_KEY_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PYTHON_PRIVATE_KEY_SECRET" \ - .github/workflows/parameters/public/rsa_keys/rsa_key_python_${{ matrix.cloud-provider }}.p8.gpg > test/rsa_key_python_${{ matrix.cloud-provider }}.p8 - - name: Download wheel(s) - uses: actions/download-artifact@v4 - with: - name: ${{ matrix.os.download_name }}_py${{ matrix.python-version }} - path: dist - - name: Show wheels downloaded - run: ls -lh dist - shell: bash - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Run tests - # To run a single test on GHA use the below command: -# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'` - run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit-parallel,integ-parallel,pandas-parallel,sso}-ci | sed 's/ /,/g'` - - env: - PYTHON_VERSION: ${{ matrix.python-version }} - cloud_provider: ${{ matrix.cloud-provider }} - PYTEST_ADDOPTS: --color=yes --tb=short - TOX_PARALLEL_NO_SPINNER: 1 - # To specify the test name (in single test mode) pass this env variable: -# SINGLE_TEST_NAME: test/path/filename.py::test_name - shell: bash - - name: Combine coverages - run: python -m tox run -e coverage --skip-missing-interpreters false - shell: bash - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: coverage_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - .tox/.coverage - .tox/coverage.xml - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: junit_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - .tox/junit.*.xml - - test-olddriver: - name: Old Driver Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: lint - runs-on: ${{ matrix.os.image_name }} - strategy: - fail-fast: false - matrix: - os: - # Because old the version 3.0.2 of snowflake-connector-python depends on oscrypto which causes conflicts with higher versions of libssl - # TODO: It can be changed to ubuntu-latest, when python sf connector version in tox is above 3.4.0 - - image_name: ubuntu-20.04 - download_name: linux - python-version: [3.9] - cloud-provider: [aws] - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/public/parameters_${{ matrix.cloud-provider }}.py.gpg > test/parameters.py - - name: Setup private key file - shell: bash - env: - PYTHON_PRIVATE_KEY_SECRET: ${{ secrets.PYTHON_PRIVATE_KEY_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PYTHON_PRIVATE_KEY_SECRET" \ - .github/workflows/parameters/public/rsa_keys/rsa_key_python_${{ matrix.cloud-provider }}.p8.gpg > test/rsa_key_python_${{ matrix.cloud-provider }}.p8 - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Run tests - run: python -m tox run -e olddriver - env: - PYTHON_VERSION: ${{ matrix.python-version }} - cloud_provider: ${{ matrix.cloud-provider }} - PYTEST_ADDOPTS: --color=yes --tb=short - shell: bash - - test-noarrowextension: - name: No Arrow Extension Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: lint - runs-on: ${{ matrix.os.image_name }} - strategy: - fail-fast: false - matrix: - os: - - image_name: ubuntu-latest - download_name: linux - python-version: [3.9] - cloud-provider: [aws] - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Run tests - run: python -m tox run -e noarrowextension - env: - PYTHON_VERSION: ${{ matrix.python-version }} - cloud_provider: ${{ matrix.cloud-provider }} - PYTEST_ADDOPTS: --color=yes --tb=short - shell: bash - - test-fips: - name: Test FIPS linux-3.9-${{ matrix.cloud-provider }} - needs: build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - cloud-provider: [aws] - steps: - - uses: actions/checkout@v4 - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/public/parameters_${{ matrix.cloud-provider }}.py.gpg > test/parameters.py - - name: Setup private key file - shell: bash - env: - PYTHON_PRIVATE_KEY_SECRET: ${{ secrets.PYTHON_PRIVATE_KEY_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PYTHON_PRIVATE_KEY_SECRET" \ - .github/workflows/parameters/public/rsa_keys/rsa_key_python_${{ matrix.cloud-provider }}.p8.gpg > test/rsa_key_python_${{ matrix.cloud-provider }}.p8 - - name: Download wheel(s) - uses: actions/download-artifact@v4 - with: - name: manylinux_x86_64_py3.9 - path: dist - - name: Show wheels downloaded - run: ls -lh dist - shell: bash - - name: Run tests - run: ./ci/test_fips_docker.sh - env: - PYTHON_VERSION: 3.9 - cloud_provider: ${{ matrix.cloud-provider }} - PYTEST_ADDOPTS: --color=yes --tb=short - TOX_PARALLEL_NO_SPINNER: 1 - shell: bash - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: coverage_linux-fips-3.9-${{ matrix.cloud-provider }} - path: | - .coverage - coverage.xml - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: junit_linux-fips-3.9-${{ matrix.cloud-provider }} - path: | - junit.*.xml - - test-lambda: - name: Test Lambda linux-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - # TODO: temporarily reduce number of jobs: SNOW-2311643 - # python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - python-version: ["3.9", "3.13"] - cloud-provider: [aws] - steps: - - name: Set shortver - run: echo "shortver=${longver//./}" >> $GITHUB_ENV - env: - longver: ${{ matrix.python-version }} - shell: bash - - uses: actions/checkout@v4 - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/public/parameters_${{ matrix.cloud-provider }}.py.gpg > test/parameters.py - - name: Setup private key file - shell: bash - env: - PYTHON_PRIVATE_KEY_SECRET: ${{ secrets.PYTHON_PRIVATE_KEY_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PYTHON_PRIVATE_KEY_SECRET" \ - .github/workflows/parameters/public/rsa_keys/rsa_key_python_${{ matrix.cloud-provider }}.p8.gpg > test/rsa_key_python_${{ matrix.cloud-provider }}.p8 - - name: Download wheel(s) - uses: actions/download-artifact@v4 - with: - name: manylinux_x86_64_py${{ matrix.python-version }} - path: dist - - name: Show wheels downloaded - run: ls -lh dist - shell: bash - - name: Run tests - run: ./ci/test_lambda_docker.sh ${PYTHON_VERSION} - env: - PYTHON_VERSION: ${{ matrix.python-version }} - cloud_provider: ${{ matrix.cloud-provider }} - PYTEST_ADDOPTS: --color=yes --tb=short - TOX_PARALLEL_NO_SPINNER: 1 - shell: bash - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: coverage_linux-lambda-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - .coverage.py${{ env.shortver }}-lambda-ci - junit.py${{ env.shortver }}-lambda-ci-dev.xml - - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: junit_linux-lambda-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - junit.py${{ env.shortver }}-lambda-ci-dev.xml - - test-aio: - name: Test asyncio ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: build - runs-on: ${{ matrix.os.image_name }} - strategy: - fail-fast: false - matrix: - os: - - image_name: ubuntu-latest - download_name: manylinux_x86_64 - - image_name: macos-latest - download_name: macosx_x86_64 - - image_name: windows-latest - download_name: win_amd64 - # TODO: temporarily reduce number of jobs: SNOW-2311643 - # python-version: ["3.10", "3.11", "3.12"] - python-version: ["3.13"] - cloud-provider: [aws, azure, gcp] - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Set up Java - uses: actions/setup-java@v4 # for wiremock - with: - java-version: 11 - distribution: 'temurin' - java-package: 'jre' - - name: Fetch Wiremock - shell: bash - run: curl https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/3.11.0/wiremock-standalone-3.11.0.jar --output .wiremock/wiremock-standalone.jar - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/public/parameters_${{ matrix.cloud-provider }}.py.gpg > test/parameters.py - - name: Setup private key file - shell: bash - env: - PYTHON_PRIVATE_KEY_SECRET: ${{ secrets.PYTHON_PRIVATE_KEY_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PYTHON_PRIVATE_KEY_SECRET" \ - .github/workflows/parameters/public/rsa_keys/rsa_key_python_${{ matrix.cloud-provider }}.p8.gpg > test/rsa_key_python_${{ matrix.cloud-provider }}.p8 - - name: Download wheel(s) - uses: actions/download-artifact@v4 - with: - name: ${{ matrix.os.download_name }}_py${{ matrix.python-version }} - path: dist - - name: Show wheels downloaded - run: ls -lh dist - shell: bash - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Run tests - run: python -m tox run -e aio - env: - PYTHON_VERSION: ${{ matrix.python-version }} - cloud_provider: ${{ matrix.cloud-provider }} - PYTEST_ADDOPTS: --color=yes --tb=short - TOX_PARALLEL_NO_SPINNER: 1 - shell: bash - - name: Combine coverages - run: python -m tox run -e coverage --skip-missing-interpreters false - shell: bash - - uses: actions/upload-artifact@v4 - with: - name: coverage_aio_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - .tox/.coverage - .tox/coverage.xml - - test-unsupporeted-aio: - name: Test unsupported asyncio ${{ matrix.os.download_name }}-${{ matrix.python-version }} - runs-on: ${{ matrix.os.image_name }} - strategy: - fail-fast: false - matrix: - os: - - image_name: ubuntu-latest - download_name: manylinux_x86_64 - python-version: [ "3.9", ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Run tests - run: python -m tox run -e aio-unsupported-python - env: - PYTHON_VERSION: ${{ matrix.python-version }} - PYTEST_ADDOPTS: --color=yes --tb=short - TOX_PARALLEL_NO_SPINNER: 1 - shell: bash - - combine-coverage: - if: ${{ success() || failure() }} - name: Combine coverage - needs: [lint, test, test-fips, test-lambda, test-aio] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - path: artifacts - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Upgrade setuptools and pip - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox>=4 - - name: Collect all coverages to one dir - run: | - python -c ' - from pathlib import Path - import shutil - - src_dir = Path("artifacts") - dst_dir = Path(".") / ".tox" - dst_dir.mkdir() - for src_file in src_dir.glob("*/.coverage"): - dst_file = dst_dir / ".coverage.{}".format(src_file.parent.name[9:]) - print("{} copy to {}".format(src_file, dst_file)) - shutil.copy(str(src_file), str(dst_file))' - - name: Collect all JUnit XML files to one dir - run: | - python -c ' - from pathlib import Path - import shutil - - src_dir = Path("artifacts") - dst_dir = Path(".") / "junit_results" - dst_dir.mkdir() - # Collect all JUnit XML files with different naming patterns - for pattern in ["*/junit.*.xml", "*/junit.py*-lambda-ci-dev.xml"]: - for src_file in src_dir.glob(pattern): - dst_file = dst_dir / src_file.name - print("{} copy to {}".format(src_file, dst_file)) - shutil.copy(str(src_file), str(dst_file))' - - name: Combine coverages - run: python -m tox run -e coverage - - name: Publish html coverage - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: overall_cov_html - path: .tox/htmlcov - - name: Publish xml coverage - uses: actions/upload-artifact@v4 - with: - include-hidden-files: true - name: overall_cov_xml - path: .tox/coverage.xml - - uses: codecov/codecov-action@v4 - with: - files: .tox/coverage.xml - token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: junit_results/junit.*.xml diff --git a/ci/test_wif.sh b/ci/test_wif.sh index 741948764d..4342b5f6f7 100755 --- a/ci/test_wif.sh +++ b/ci/test_wif.sh @@ -1,6 +1,7 @@ #!/bin/bash -e set -o pipefail +set -x export THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export RSA_KEY_PATH_AWS_AZURE="$THIS_DIR/wif/parameters/rsa_wif_aws_azure" @@ -77,9 +78,9 @@ setup_parameters # Run tests for all cloud providers EXIT_STATUS=0 set +e # Don't exit on first failure -run_tests_and_set_result "AZURE" "$HOST_AZURE" "$SNOWFLAKE_TEST_WIF_HOST_AZURE" "$RSA_KEY_PATH_AWS_AZURE" +# run_tests_and_set_result "AZURE" "$HOST_AZURE" "$SNOWFLAKE_TEST_WIF_HOST_AZURE" "$RSA_KEY_PATH_AWS_AZURE" run_tests_and_set_result "AWS" "$HOST_AWS" "$SNOWFLAKE_TEST_WIF_HOST_AWS" "$RSA_KEY_PATH_AWS_AZURE" -run_tests_and_set_result "GCP" "$HOST_GCP" "$SNOWFLAKE_TEST_WIF_HOST_GCP" "$RSA_KEY_PATH_GCP" +# run_tests_and_set_result "GCP" "$HOST_GCP" "$SNOWFLAKE_TEST_WIF_HOST_GCP" "$RSA_KEY_PATH_GCP" set -e # Re-enable exit on error echo "Exit status: $EXIT_STATUS" exit $EXIT_STATUS diff --git a/ci/wif/test_wif.sh b/ci/wif/test_wif.sh index 3053d6dcf3..b45e22801a 100755 --- a/ci/wif/test_wif.sh +++ b/ci/wif/test_wif.sh @@ -1,10 +1,21 @@ #!/bin/bash -e set -o pipefail +set -x export SF_OCSP_TEST_MODE=true export RUN_WIF_TESTS=true -/opt/python/cp39-cp39/bin/python -m pip install --break-system-packages -e '.[aio]' -/opt/python/cp39-cp39/bin/python -m pip install --break-system-packages pytest -/opt/python/cp39-cp39/bin/python -m pytest test/wif/* +# /opt/python/cp312-cp312/bin/python -m pip install --break-system-packages uv + +# setup pytest +/opt/python/cp312-cp312/bin/python -m pip install --break-system-packages pytest pytest-asyncio + +# # test WIF without asyncio installed +# /opt/python/cp312-cp312/bin/python -m uv pip install --break-system-packages -e . +# /opt/python/cp312-cp312/bin/python -m pytest test/wif/ --ignore test/wif/test_wif_async.py + +# test WIF with asyncio installed +/opt/python/cp312-cp312/bin/python -m pip install --break-system-packages -e '.[aio]' +# run all tests to see whether installation does not break anything +/opt/python/cp312-cp312/bin/python -m pytest -vv test/wif/ diff --git a/src/snowflake/connector/aio/_wif_util.py b/src/snowflake/connector/aio/_wif_util.py index 1f2a62ff5c..8bc8b90643 100644 --- a/src/snowflake/connector/aio/_wif_util.py +++ b/src/snowflake/connector/aio/_wif_util.py @@ -21,7 +21,7 @@ extract_iss_and_sub_without_signature_verification, get_aws_sts_hostname, ) -from ._session_manager import SessionManager, SessionManagerFactory +from ._session_manager import SessionManager logger = logging.getLogger(__name__) @@ -38,6 +38,8 @@ async def get_aws_region() -> str: msg="No AWS region was found. Ensure the application is running on AWS.", errno=ER_WIF_CREDENTIALS_NOT_FOUND, ) + print(f"DEBUG AWS region: {region}") + print(f"DEBUG AWS region type: {type(region)}") return region diff --git a/test/wif/test_wif_async.py b/test/wif/test_wif_async.py index 9db0301cc3..c548c30d5d 100644 --- a/test/wif/test_wif_async.py +++ b/test/wif/test_wif_async.py @@ -67,4 +67,5 @@ async def connect_and_execute_simple_query_async(connection_params) -> bool: return True except Exception as e: logger.error(e) - return False + # return False + raise e