Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
exec_timeout_secs: 3600

# Mark a failure as a system/bootstrap failure (purple box) rather then a task
# failure by default.
# Actual testing tasks are marked with `type: test`
command_type: system

# Ensure that setup and teardown is working as expected.
pre_error_fails_task: true
pre_timeout_secs: 1800 # 5 minutes
post_error_fails_task: true
post_timeout_secs: 1800 # 5 minutes

functions:
"setup":
- command: git.get_project
params:
directory: src
- command: subprocess.exec
params:
binary: bash
working_dir: "src"
add_expansions_to_env: true
args:
- ./.evergreen/setup.sh
- command: expansions.update
params:
file: src/expansion.yml

"bootstrap mongo-orchestration":
- command: subprocess.exec
params:
binary: bash
env:
MONGODB_VERSION: "5.0"
TOPOLOGY: server
AUTH: "noauth"
SSL: "nossl"
args:
- ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh

"run unit tests":
- command: subprocess.exec
type: test
params:
binary: bash
working_dir: "src"
include_expansions_in_env: ["DRIVERS_TOOLS"]
args:
- ./.evergreen/run-tests.sh

"teardown":
- command: subprocess.exec
params:
binary: bash
args:
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh

pre:
- func: setup
- func: bootstrap mongo-orchestration

post:
- func: teardown

tasks:
- name: run-tests
commands:
- func: "run unit tests"

buildvariants:
- name: tests
display_name: Run Tests
run_on: rhel87-small
tasks:
- name: run-tests
25 changes: 25 additions & 0 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/bash

set -eux

# Install the django-mongodb backend
/opt/python/3.10/bin/python3 -m venv venv
. venv/bin/activate
python -m pip install -U pip
pip install -e .

# Install django and test dependencies
git clone --branch mongodb-5.0.x https://github.com/mongodb-forks/django django_repo
pushd django_repo/tests/
pip install -e ..
pip install -r requirements/py3.txt
popd

# Copy the test settings file
cp ./.github/workflows/mongodb_settings.py django_repo/tests/

# Copy the test runner file
cp ./.github/workflows/runtests.py django_repo/tests/runtests_.py

# Run tests
python django_repo/tests/runtests_.py
48 changes: 48 additions & 0 deletions .evergreen/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/bash

set -eux

# Get the current unique version of this checkout
# shellcheck disable=SC2154
if [ "${is_patch}" = "true" ]; then
# shellcheck disable=SC2154
CURRENT_VERSION=$(git describe || echo "null")-patch-${version_id}
else
CURRENT_VERSION=latest
fi

# Python has cygwin path problems on Windows.
DRIVERS_TOOLS="$(dirname "$(pwd)")/drivers-tools"
PROJECT_DIRECTORY="$(pwd)"

if [ "Windows_NT" = "${OS:-}" ]; then
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
fi
export PROJECT_DIRECTORY
export DRIVERS_TOOLS

export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
# shellcheck disable=SC2154
export UPLOAD_BUCKET="${project}"

cat <<EOT > expansion.yml
CURRENT_VERSION: "$CURRENT_VERSION"
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES: "$MONGODB_BINARIES"
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
EOT

# Set up drivers-tools with a .env file.
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git ${DRIVERS_TOOLS}
cat <<EOT > ${DRIVERS_TOOLS}/.env
CURRENT_VERSION="$CURRENT_VERSION"
DRIVERS_TOOLS="$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES="$MONGODB_BINARIES"
UPLOAD_BUCKET="$UPLOAD_BUCKET"
PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
EOT
12 changes: 12 additions & 0 deletions sbom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"metadata": {
"timestamp": "2024-11-05T12:48:05.688090+00:00"
},
"components": [],
"serialNumber": "urn:uuid:f3728d07-e448-4fae-8e28-c08f8c75f747",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"vulnerabilities": []
}