diff --git a/.github/workflows/ci-bats-unix-remote.yaml b/.github/workflows/ci-bats-unix-remote.yaml index 7302c351bd1..9e50d2cb0e9 100644 --- a/.github/workflows/ci-bats-unix-remote.yaml +++ b/.github/workflows/ci-bats-unix-remote.yaml @@ -17,60 +17,49 @@ jobs: defaults: run: shell: bash - runs-on: ${{ matrix.os }} + runs-on: ubuntu-22.04 strategy: fail-fast: true - matrix: - os: [ ubuntu-22.04 ] env: use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }} + # We only run these as seaparte workflow if we do not have AWS credentials. steps: - - name: Conditionally Set ENV VARS for AWS tests - run: | - if [[ $use_credentials == true ]]; then - echo "AWS_SDK_LOAD_CONFIG=1" >> $GITHUB_ENV - echo "AWS_REGION=us-west-2" >> $GITHUB_ENV - echo "DOLT_BATS_AWS_TABLE=dolt-ci-bats-manifests-us-west-2" >> $GITHUB_ENV - echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV - echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests__dolt__" >> $GITHUB_ENV - fi - - name: Configure AWS Credentials - if: ${{ env.use_credentials == 'true' }} - uses: aws-actions/configure-aws-credentials@567d4149d67f15f52b09796bea6573fc32952783 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-2 - role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} - role-duration-seconds: 10800 # 3 hours D: - name: Setup Go 1.x + if: ${{ env.use_credentials != 'true' }} uses: actions/setup-go@v3 with: go-version: ^1.21 id: go - name: Setup Python 3.x + if: ${{ env.use_credentials != 'true' }} uses: actions/setup-python@v4 with: python-version: "3.10" - uses: actions/checkout@v3 + if: ${{ env.use_credentials != 'true' }} - uses: actions/setup-node@v3 + if: ${{ env.use_credentials != 'true' }} with: node-version: ^16 - name: Create CI Bin + if: ${{ env.use_credentials != 'true' }} run: | mkdir -p ./.ci_bin echo "$(pwd)/.ci_bin" >> $GITHUB_PATH - name: Install Bats + if: ${{ env.use_credentials != 'true' }} run: | npm i bats echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH working-directory: ./.ci_bin - name: Install Python Deps + if: ${{ env.use_credentials != 'true' }} run: | pip install mysql-connector-python pip install pandas pip install pyarrow - name: Install Dolt + if: ${{ env.use_credentials != 'true' }} working-directory: ./go run: | go build -mod=readonly -o ../.ci_bin/dolt ./cmd/dolt/. @@ -78,25 +67,29 @@ jobs: go build -mod=readonly -o ../.ci_bin/remotesrv ./utils/remotesrv/. go build -mod=readonly -o ../.ci_bin/noms ./store/cmd/noms/. - name: Setup Dolt Config + if: ${{ env.use_credentials != 'true' }} run: | dolt config --global --add user.name 'Dolthub Actions' dolt config --global --add user.email 'actions@dolthub.com' - name: Install expect - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-22.04' && env.use_credentials != 'true' run: sudo apt-get install -y expect - name: Install Maven + if: ${{ env.use_credentials != 'true' }} working-directory: ./.ci_bin run: | curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz tar -xf apache-maven-3.9.4-bin.tar.gz echo "$(pwd)/apache-maven-3.9.4/bin" >> $GITHUB_PATH - name: Install Hadoop + if: ${{ env.use_credentials != 'true' }} working-directory: ./.ci_bin run: | curl -LO https://downloads.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz tar xvf hadoop-3.3.6.tar.gz echo "$(pwd)/hadoop-3.3.6/bin" >> $GITHUB_PATH - name: Install parquet-cli + if: ${{ env.use_credentials != 'true' }} id: parquet_cli working-directory: ./.ci_bin run: | @@ -107,8 +100,10 @@ jobs: runtime_jar="$(pwd)"/target/parquet-cli-1.12.3-runtime.jar echo "runtime_jar=$runtime_jar" >> $GITHUB_OUTPUT - name: Check expect + if: ${{ env.use_credentials != 'true' }} run: expect -v - name: Test all Unix + if: ${{ env.use_credentials != 'true' }} env: SQL_ENGINE: "remote-engine" PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }} diff --git a/.github/workflows/ci-bats-unix.yaml b/.github/workflows/ci-bats-unix.yaml index e6db9efb509..d20f9904877 100644 --- a/.github/workflows/ci-bats-unix.yaml +++ b/.github/workflows/ci-bats-unix.yaml @@ -34,6 +34,10 @@ jobs: echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests__dolt__" >> $GITHUB_ENV fi + - name: Configure filter tags for lambda bats + if: ${{ matrix.os == 'ubuntu-22.04' && env.use_credentials == 'true' }} + run: | + echo "BATS_FILTER=--filter-tags no_lambda" >> $GITHUB_ENV - name: Configure AWS Credentials if: ${{ env.use_credentials == 'true' }} uses: aws-actions/configure-aws-credentials@v2.2.0 @@ -114,5 +118,15 @@ jobs: PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }} BATS_TEST_RETRIES: "3" run: | - bats --tap . + bats --tap $BATS_FILTER . + working-directory: ./integration-tests/bats + - name: Test all Unix, SQL_ENGINE=remote-engine + # If we have AWS credentials, we run these remote-engine tests here instead of in the separate job. + if: ${{ env.use_credentials == 'true' && matrix.os == 'ubuntu-22.04' }} + env: + SQL_ENGINE: "remote-engine" + PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }} + BATS_TEST_RETRIES: "3" + run: | + bats --tap $BATS_FILTER . working-directory: ./integration-tests/bats diff --git a/.github/workflows/ci-lambdabats-unix.yaml b/.github/workflows/ci-lambdabats-unix.yaml new file mode 100644 index 00000000000..591612aa46a --- /dev/null +++ b/.github/workflows/ci-lambdabats-unix.yaml @@ -0,0 +1,63 @@ +name: Test Bats Unix + +on: + pull_request: + branches: [ main ] + paths: + - 'go/**' + - 'integration-tests/**' + +concurrency: + group: ci-lambdabats-unix-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Bats tests, run with lambdabats + defaults: + run: + shell: bash + runs-on: ubuntu-22.04 + strategy: + fail-fast: true + env: + use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }} + steps: + - name: Conditionally Set ENV VARS for AWS tests + if: ${{ env.use_credentials == 'true' }} + run: | + echo "AWS_SDK_LOAD_CONFIG=1" >> $GITHUB_ENV + echo "AWS_REGION=us-west-2" >> $GITHUB_ENV + echo "DOLT_BATS_AWS_TABLE=dolt-ci-bats-manifests-us-west-2" >> $GITHUB_ENV + echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV + echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests__dolt__" >> $GITHUB_ENV + - name: Configure AWS Credentials + if: ${{ env.use_credentials == 'true' }} + uses: aws-actions/configure-aws-credentials@v2.2.0 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + role-duration-seconds: 10800 # 3 hours D: + - uses: actions/checkout@v3 + if: ${{ env.use_credentials == 'true' }} + - name: Setup Go 1.x + uses: actions/setup-go@v3 + if: ${{ env.use_credentials == 'true' }} + with: + go-version: ^1.21 + id: go + - name: install lambdabats + if: ${{ env.use_credentials == 'true' }} + run: go install github.com/dolthub/lambdabats/lambdabats@latest + - name: Test all Unix + if: ${{ env.use_credentials == 'true' }} + run: | + lambdabats -use-aws-environment-credentials -s lambda_skip -F tap . + working-directory: ./integration-tests/bats + - name: Test all Unix, SQL_ENGINE=remote-engine + if: ${{ env.use_credentials == 'true' }} + run: | + lambdabats -env SQL_ENGINE=remote-engine -s lambda_skip -use-aws-environment-credentials -F tap . + working-directory: ./integration-tests/bats diff --git a/integration-tests/bats/failing.txt b/integration-tests/bats/failing.txt deleted file mode 100644 index 3dbc8b91f09..00000000000 --- a/integration-tests/bats/failing.txt +++ /dev/null @@ -1,7 +0,0 @@ -sql-server: Database specific system variables should be loaded -sql-server: disable_client_multi_statements makes create trigger work - sql-server: client_multi_statements work -sql-server: connect to databases case insensitive - sql-server: start server multidir creates sql-server.lock file in every rep -sql-server: running a dolt function in the same directory as a running server correctly errors -sql-server: deleting database directory when a running server is using it does not panic diff --git a/integration-tests/bats/remotes-aws.bats b/integration-tests/bats/remotes-aws.bats index 51c84667d28..f794aaefc84 100644 --- a/integration-tests/bats/remotes-aws.bats +++ b/integration-tests/bats/remotes-aws.bats @@ -20,12 +20,14 @@ skip_if_no_aws_tests() { dolt remote add origin 'aws://[dynamo_db_table:s3_bucket]/repo_name' } +# bats test_tags=no_lambda @test "remotes-aws: can fetch existing aws remote" { skip_if_no_aws_tests dolt remote add origin 'aws://['"$DOLT_BATS_AWS_TABLE"':'"$DOLT_BATS_AWS_BUCKET"']/'"$DOLT_BATS_AWS_EXISTING_REPO" dolt fetch origin } +# bats test_tags=no_lambda @test "remotes-aws: fetch with non-existent dynamo table fails" { skip_if_no_aws_tests dolt remote add origin 'aws://['"this_dynamodb_table_does_not_exist_b612c34f055f4b458"':'"$DOLT_BATS_AWS_BUCKET"']/'"$DOLT_BATS_AWS_EXISTING_REPO" @@ -33,6 +35,7 @@ skip_if_no_aws_tests() { [ "$status" -eq 1 ] } +# bats test_tags=no_lambda @test "remotes-aws: fetch with non-existent s3 bucket fails" { skip_if_no_aws_tests dolt remote add origin 'aws://['"$DOLT_BATS_AWS_TABLE"':'"this_s3_bucket_does_not_exist_5883eaaa20a4797bb"']/'"$DOLT_BATS_AWS_EXISTING_REPO" @@ -40,6 +43,7 @@ skip_if_no_aws_tests() { [ "$status" -eq 1 ] } +# bats test_tags=no_lambda @test "remotes-aws: can clone an existing aws remote" { skip_if_no_aws_tests rm -rf .dolt @@ -48,6 +52,7 @@ skip_if_no_aws_tests() { dolt sql -q 'show tables' } +# bats test_tags=no_lambda @test "remotes-aws: can clone an existing aws remote without AWS_SDK_LOAD_CONFIG=1 set." { skip_if_no_aws_tests rm -rf .dolt @@ -56,6 +61,7 @@ skip_if_no_aws_tests() { dolt sql -q 'show tables' } +# bats test_tags=no_lambda # Matches behavior of other remote types @test "remotes-aws: clone empty aws remote fails" { skip_if_no_aws_tests @@ -67,6 +73,7 @@ skip_if_no_aws_tests() { [[ "$output" =~ "remote at that url contains no Dolt data" ]] || false } +# bats test_tags=no_lambda @test "remotes-aws: can push to new remote" { skip_if_no_aws_tests random_repo=`openssl rand -hex 32` @@ -82,6 +89,7 @@ skip_if_no_aws_tests() { dolt push origin :another-branch } +# bats test_tags=no_lambda @test "remotes-aws: can push to new remote which is a subdirectory" { skip_if_no_aws_tests random_repo=`openssl rand -hex 32`