diff --git a/.github/workflows/pr-Integration-tests.yml b/.github/workflows/pr-Integration-tests.yml index 0e4856f71..597494f4c 100644 --- a/.github/workflows/pr-Integration-tests.yml +++ b/.github/workflows/pr-Integration-tests.yml @@ -130,7 +130,7 @@ jobs: done echo "Finished waiting for service." - - name: Run integration tests + - name: Run Standard Integration Tests run: | echo "Running integration tests..." docker run --rm --network danswer-stack_default \ @@ -145,7 +145,8 @@ jobs: -e OPENAI_API_KEY=${OPENAI_API_KEY} \ -e SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN} \ -e TEST_WEB_HOSTNAME=test-runner \ - danswer/danswer-integration:test + danswer/danswer-integration:test \ + /app/tests/integration/tests continue-on-error: true id: run_tests @@ -158,6 +159,56 @@ jobs: echo "All integration tests passed successfully." fi + - name: Stop Docker containers + run: | + cd deployment/docker_compose + docker compose -f docker-compose.dev.yml -p danswer-stack down -v + + # Start containers for multi-tenant tests + - name: Start Docker containers for multi-tenant tests + run: | + cd deployment/docker_compose + ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=true \ + MULTI_TENANT=true \ + AUTH_TYPE=basic \ # Adjust as needed + REQUIRE_EMAIL_VERIFICATION=false \ + DISABLE_TELEMETRY=true \ + IMAGE_TAG=test \ + docker compose -f docker-compose.dev.yml -p danswer-stack up -d + id: start_docker_multi_tenant + + # In practice, `cloud` Auth type would require OAUTH credentials to be set. + - name: Run Multi-Tenant Integration Tests + run: | + echo "Running integration tests..." + docker run --rm --network danswer-stack_default \ + --name test-runner \ + -e POSTGRES_HOST=relational_db \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=password \ + -e POSTGRES_DB=postgres \ + -e VESPA_HOST=index \ + -e REDIS_HOST=cache \ + -e API_SERVER_HOST=api_server \ + -e OPENAI_API_KEY=${OPENAI_API_KEY} \ + -e SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN} \ + -e TEST_WEB_HOSTNAME=test-runner \ + -e AUTH_TYPE=cloud \ + -e MULTI_TENANT=true \ + danswer/danswer-integration:test \ + /app/tests/integration/multitenant_tests + continue-on-error: true + id: run_tests + + - name: Check multi-tenant test results + run: | + if [ ${{ steps.run_tests.outcome }} == 'failure' ]; then + echo "Integration tests failed. Exiting with error." + exit 1 + else + echo "All integration tests passed successfully." + fi + - name: Save Docker logs if: success() || failure() run: | diff --git a/backend/tests/integration/Dockerfile b/backend/tests/integration/Dockerfile index 02cdcad0b..92a94a32d 100644 --- a/backend/tests/integration/Dockerfile +++ b/backend/tests/integration/Dockerfile @@ -83,4 +83,5 @@ COPY ./tests/integration /app/tests/integration ENV PYTHONPATH=/app -CMD ["pytest", "-s", "/app/tests/integration"] +ENTRYPOINT ["pytest", "-s"] +CMD ["/app/tests/integration"] \ No newline at end of file