1
0
mirror of synced 2026-01-04 09:04:47 -05:00
Files
airbyte/tools/bin/cloud_storage_logging_test.sh
Davin Chia 6565a23af5 Test Kube Log4j2 Logging Configuration (#4972)
- Use JUnit 5 tags for a cleaner build set up + make sure tests are not run unnecessarily.
- The various env set ups are replicated in the cloud_storage_logging_test.sh script. Since there isn't an easy way to dynamically inject env vars from within a JVM, this was the cleanest way of doing this.
2021-07-27 13:47:51 +08:00

76 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
echo "Writing cloud storage credentials.."
# S3
export AWS_ACCESS_KEY_ID="$(echo "$AWS_S3_INTEGRATION_TEST_CREDS" | jq -r .aws_access_key_id)"
export AWS_SECRET_ACCESS_KEY="$(echo "$AWS_S3_INTEGRATION_TEST_CREDS" | jq -r .aws_secret_access_key)"
export S3_LOG_BUCKET=airbyte-kube-integration-logging-test
export S3_LOG_BUCKET_REGION=us-west-2
# GCS
echo "$GOOGLE_CLOUD_STORAGE_TEST_CREDS" > "/tmp/gcs.json"
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcs.json"
export GCP_STORAGE_BUCKET=airbyte-kube-integration-logging-test
# Run the logging test first since the same client is used in the log4j2 integration test.
echo "Running log client tests.."
SUB_BUILD=PLATFORM ./gradlew :airbyte-config:models:logClientsIntegrationTest --scan
# Reset existing configurations and run this for each possible configuration
# These configurations mirror the configurations documented in https://docs.airbyte.io/deploying-airbyte/on-kubernetes#configure-logs.
# Some duplication here for clarity.
export WORKER_ENVIRONMENT=kubernetes
echo "Setting S3 configuration.."
export AWS_ACCESS_KEY_ID="$(echo "$AWS_S3_INTEGRATION_TEST_CREDS" | jq -r .aws_access_key_id)"
export AWS_SECRET_ACCESS_KEY="$(echo "$AWS_S3_INTEGRATION_TEST_CREDS" | jq -r .aws_secret_access_key)"
export S3_LOG_BUCKET=airbyte-kube-integration-logging-test
export S3_LOG_BUCKET_REGION=us-west-2
export S3_MINIO_ENDPOINT=
export S3_PATH_STYLE_ACCESS=
export GOOGLE_APPLICATION_CREDENTIALS=
export GCP_STORAGE_BUCKET=
echo "Running logging to S3 test.."
SUB_BUILD=PLATFORM ./gradlew :airbyte-config:models:log4j2IntegrationTest --scan --rerun-tasks -i
echo "Setting GCS configuration.."
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export S3_LOG_BUCKET=
export S3_LOG_BUCKET_REGION=
export S3_MINIO_ENDPOINT=
export S3_PATH_STYLE_ACCESS=
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcs.json"
export GCP_STORAGE_BUCKET=airbyte-kube-integration-logging-test
echo "Running logging to GCS test.."
SUB_BUILD=PLATFORM ./gradlew :airbyte-config:models:log4j2IntegrationTest --scan --rerun-tasks -i
echo "Starting Minio service.."
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=miniostorage
./minio server /tmp/desktop &
echo "Setting Minio configuration.."
export AWS_ACCESS_KEY_ID=minio
export AWS_SECRET_ACCESS_KEY=miniostorage
export S3_LOG_BUCKET=airbyte-kube-integration-logging-test
export S3_LOG_BUCKET_REGION=
export S3_MINIO_ENDPOINT=http://localhost:9000
export S3_PATH_STYLE_ACCESS=true
export GOOGLE_APPLICATION_CREDENTIALS=
export GCP_STORAGE_BUCKET=
echo "Running logging to Minio test.."
SUB_BUILD=PLATFORM ./gradlew :airbyte-config:models:log4j2IntegrationTest --scan --rerun-tasks -i