-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Containerize integration tests. #809
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
11710e1
feat: Containerize integration tests.
b4handjr 76973c3
Updates adding changes to circleci file as well as adding a make comm…
b4handjr bef52a2
Change ci image.
b4handjr c3399e4
Fix for ci step.
b4handjr 6804720
Added integration test container build job.
b4handjr 9bb76d6
Merge branch 'master' into sync-4520
jrconlin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
FROM python:3.12-slim-bookworm | ||
|
||
LABEL org.opencontainers.image.authors="[email protected]" | ||
|
||
ENV LANG=C.UTF-8 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
ENV PATH=$PATH:/root/.cargo/bin | ||
ENV PYTHON_VENV=/venv | ||
ENV PYTEST_ARGS="" | ||
ENV RUST_LOG="autopush=debug,autopush_common=debug,autoendpoint=debug,autoconnect=debug,slog_mozlog_json=info,warn" | ||
ENV DB_DSN=grpc://localhost:8086 | ||
|
||
# Add gcc since there are no wheels for some packages for arm64/aarch64 | ||
# (g++/make for gevent on pypy) | ||
RUN apt-get update && apt install -y --no-install-recommends \ | ||
git \ | ||
gpg \ | ||
build-essential \ | ||
python3-dev \ | ||
curl \ | ||
libstdc++6 \ | ||
libstdc++-12-dev \ | ||
libssl-dev \ | ||
pkg-config \ | ||
cmake | ||
|
||
RUN python -m venv ${PYTHON_VENV} | ||
ENV PATH="${PYTHON_VENV}/bin:${PATH}" | ||
|
||
RUN python -m pip install --upgrade pip | ||
|
||
# Install Rust | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.81 -y | ||
RUN rustc --version | ||
|
||
# Setup poetry and install requirements | ||
ENV POETRY_VIRTUALENVS_CREATE=false \ | ||
POETRY_VERSION=1.7.0 | ||
RUN python -m pip install --no-cache-dir --quiet poetry | ||
COPY ./tests/pyproject.toml ./tests/poetry.lock ./ | ||
RUN poetry install --only=integration --no-interaction --no-ansi | ||
|
||
# Setup cloud big table | ||
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg | ||
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | ||
RUN apt-get update -y && apt install google-cloud-cli-cbt -y | ||
|
||
COPY . /code | ||
|
||
WORKDIR /code | ||
|
||
# Build app | ||
RUN cargo build --features=emulator | ||
|
||
RUN chmod +x scripts/setup_bt.sh | ||
|
||
CMD ["sh", "-c", "./scripts/setup_bt.sh && poetry run pytest tests/integration/test_integration_all_rust.py --junit-xml=integration_test_results.xml -v -m 'not stub' ${PYTEST_ARGS}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
services: | ||
google_cbt: | ||
image: google/cloud-sdk:latest | ||
network_mode: host | ||
platform: linux/amd64 | ||
command: gcloud beta emulators bigtable start --host-port=localhost:8086 | ||
tests: | ||
environment: | ||
- BIGTABLE_EMULATOR_HOST=localhost:8086 | ||
- DB_DSN=grpc://localhost:8086 | ||
build: | ||
context: ../.. | ||
dockerfile: tests/integration/Dockerfile | ||
depends_on: | ||
- google_cbt | ||
network_mode: host | ||
platform: linux/amd64 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the CI stuff. It all works great locally for me! 🌟
Double checking:
I think this job needs to be added to the workflow? Can the image be re-used by the integration test job as a pre-req?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I didn't add it as I wanted to do it in a separate PR. It could be reused after it's pushed to GAR. That would allow us to use circleci layer caching too actually.