Skip to content

INTPYTHON-527 Add Queryable Encryption support #777

INTPYTHON-527 Add Queryable Encryption support

INTPYTHON-527 Add Queryable Encryption support #777

name: Python Tests on Atlas
on:
pull_request:
paths:
- '**.py'
- '!setup.py'
- '.github/workflows/test-python-atlas.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -eux {0}
jobs:
build:
name: Django Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout django-mongodb-backend
uses: actions/checkout@v5
with:
persist-credentials: false
- name: install django-mongodb-backend
run: |
pip3 install --upgrade pip
pip3 install -e .[encryption]
- name: Checkout Django
uses: actions/checkout@v5
with:
repository: 'mongodb-forks/django'
ref: 'mongodb-5.2.x'
path: 'django_repo'
persist-credentials: false
- name: Install system packages for Django's Python test dependencies
run: |
sudo apt-get update
sudo apt-get install libmemcached-dev
- name: Install Django and its Python test dependencies
run: |
cd django_repo/tests/
pip3 install -e ..
pip3 install -r requirements/py3.txt
- name: Copy the test settings files
run: cp .github/workflows/*_settings.py django_repo/tests/
- name: Copy the test runner file
run: cp .github/workflows/runtests.py django_repo/tests/runtests_.py
- name: Download crypt shared
run: |
wget https://downloads.mongodb.com/linux/mongo_crypt_shared_v1-linux-aarch64-enterprise-ubuntu2404-8.0.15.tgz
tar -xvzf mongo_crypt_shared_v1-linux-aarch64-enterprise-ubuntu2404-8.0.15.tgz lib/mongo_crypt_v1.so
- name: Start local Atlas
working-directory: .
run: bash .github/workflows/start_local_atlas.sh mongodb/mongodb-atlas-local:8.0.15
- name: Install mongosh
run: |
wget -q https://downloads.mongodb.com/compass/mongosh-2.2.10-linux-x64.tgz
tar -xzf mongosh-*-linux-x64.tgz
sudo cp mongosh-*-linux-x64/bin/mongosh /usr/local/bin/
mongosh --version
- name: Install mongocryptd from Enterprise tarball
run: |
curl -sSL -o mongodb-enterprise.tgz "https://downloads.mongodb.com/linux/mongodb-linux-x86_64-enterprise-ubuntu2204-8.0.15.tgz"
tar -xzf mongodb-enterprise.tgz
sudo cp mongodb-linux-x86_64-enterprise-ubuntu2204-8.0.15/bin/mongocryptd /usr/local/bin/
- name: Start mongocryptd
run: |
nohup mongocryptd --logpath=/tmp/mongocryptd.log &
- name: Verify MongoDB installation
run: |
mongosh --eval 'db.runCommand({ connectionStatus: 1 })'
- name: Verify mongocryptd is running
run: |
pgrep mongocryptd
- name: Run tests
run: python3 django_repo/tests/runtests_.py
permissions:
contents: read
env:
DJANGO_SETTINGS_MODULE: "encrypted_settings"