datatracker/.github/workflows/tests.yml
Robert Sparks 997239a2ea
feat: write objects to blob storage (#8557)
* feat: basic blobstore infrastructure for dev

* refactor: (broken) attempt to put minio console behind nginx

* feat: initialize blobstore with boto3

* fix: abandon attempt to proxy minio. Use docker compose instead.

* feat: beginning of blob writes

* feat: storage utilities

* feat: test buckets

* chore: black

* chore: remove unused import

* chore: avoid f string when not needed

* fix: inform all settings files about blobstores

* fix: declare types for some settings

* ci: point to new target base

* ci: adjust test workflow

* fix: give the tests debug environment a blobstore

* fix: "better" name declarations

* ci: use devblobstore container

* chore: identify places to write to blobstorage

* chore: remove unreachable code

* feat: store materials

* feat: store statements

* feat: store status changes

* feat: store liaison attachments

* feat: store agendas provided with Interim session requests

* chore: capture TODOs

* feat: store polls and chatlogs

* chore: remove unneeded TODO

* feat: store drafts on submit and post

* fix: handle storage during doc expiration and resurrection

* fix: mirror an unlink

* chore: add/refine TODOs

* feat: store slide submissions

* fix: structure slide test correctly

* fix: correct sense of existence check

* feat: store some indexes

* feat: BlobShadowFileSystemStorage

* feat: shadow floorplans / host logos to the blob

* chore: remove unused import

* feat: strip path from blob shadow names

* feat: shadow photos / thumbs

* refactor: combine photo and photothumb blob kinds

The photos / thumbs were already dropped in the same
directory, so let's not add a distinction at this point.

* style: whitespace

* refactor: use kwargs consistently

* chore: migrations

* refactor: better deconstruct(); rebuild migrations

* fix: use new class in mack patch

* chore: add TODO

* feat: store group index documents

* chore: identify more TODO

* feat: store reviews

* fix: repair merge

* chore: remove unnecessary TODO

* feat: StoredObject metadata

* fix: deburr some debugging code

* fix: only set the deleted timestamp once

* chore: correct typo

* fix: get_or_create vs get and test

* fix: avoid the questionable is_seekable helper

* chore: capture future design consideration

* chore: blob store cfg for k8s

* chore: black

* chore: copyright

* ci: bucket name prefix option + run Black

Adds/uses DATATRACKER_BLOB_STORE_BUCKET_PREFIX option. Other changes
are just Black styling.

* ci: fix typo in bucket name expression

* chore: parameters in app-configure-blobstore

Allows use with other blob stores.

* ci: remove verify=False option

* fix: don't return value from __init__

* feat: option to log timing of S3Storage calls

* chore: units

* fix: deleted->null when storing a file

* style: Black

* feat: log as JSON; refactor to share code; handle exceptions

* ci: add ietf_log_blob_timing option for k8s

* test: --no-manage-blobstore option for running tests

* test: use blob store settings from env, if set

* test: actually set a couple more storage opts

* feat: offswitch (#8541)

* feat: offswitch

* fix: apply ENABLE_BLOBSTORAGE to BlobShadowFileSystemStorage behavior

* chore: log timing of blob reads

* chore: import Config from botocore.config

* chore(deps): import boto3-stubs / botocore

botocore is implicitly imported, but make it explicit
since we refer to it directly

* chore: drop type annotation that mypy loudly ignores

* refactor: add storage methods via mixin

Shares code between Document and DocHistory without
putting it in the base DocumentInfo class, which
lacks the name field. Also makes mypy happy.

* feat: add timeout / retry limit to boto client

* ci: let k8s config the timeouts via env

* chore: repair merge resolution typo

* chore: tweak settings imports

* chore: simplify k8s/settings_local.py imports

---------

Co-authored-by: Jennifer Richards <jennifer@staff.ietf.org>
2025-02-19 17:41:10 -06:00

190 lines
5.3 KiB
YAML

name: Reusable Tests Workflow
on:
workflow_call:
inputs:
ignoreLowerCoverage:
description: 'Ignore Lower Coverage'
default: false
required: true
type: boolean
skipSelenium:
description: 'Skip Selenium Tests'
default: false
required: false
type: boolean
targetBaseVersion:
description: 'Target Base Image Version'
default: latest
required: false
type: string
jobs:
tests-python:
name: Python Tests
runs-on: ubuntu-latest
container: ghcr.io/ietf-tools/datatracker-app-base:${{ inputs.targetBaseVersion }}
services:
db:
image: ghcr.io/ietf-tools/datatracker-db:latest
blobstore:
image: ghcr.io/ietf-tools/datatracker-devblobstore:latest
steps:
- uses: actions/checkout@v4
- name: Prepare for tests
run: |
chmod +x ./dev/tests/prepare.sh
sh ./dev/tests/prepare.sh
- name: Ensure DB is ready
run: |
/usr/local/bin/wait-for db:5432 -- echo "DB ready"
- name: Run all tests
shell: bash
run: |
echo "Running checks..."
./ietf/manage.py check
./ietf/manage.py migrate --fake-initial
echo "Validating migrations..."
if ! ( ietf/manage.py makemigrations --dry-run --check --verbosity 3 ) ; then
echo "Model changes without migrations found."
exit 1
fi
if [[ "x${{ inputs.skipSelenium }}" == "xtrue" ]]; then
echo "Disable selenium tests..."
rm /usr/bin/geckodriver
fi
echo "Running tests..."
if [[ "x${{ inputs.ignoreLowerCoverage }}" == "xtrue" ]]; then
echo "Lower coverage failures will be ignored."
HOME=/root ./ietf/manage.py test -v2 --validate-html-harder --settings=settings_test --ignore-lower-coverage
else
HOME=/root ./ietf/manage.py test -v2 --validate-html-harder --settings=settings_test
fi
coverage xml
- name: Upload geckodriver.log
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: geckodriverlog
path: geckodriver.log
- name: Upload Coverage Results to Codecov
uses: codecov/codecov-action@v5
with:
disable_search: true
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Convert Coverage Results
if: ${{ always() }}
run: |
mv latest-coverage.json coverage.json
- name: Upload Coverage Results as Build Artifact
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: coverage
path: coverage.json
tests-playwright:
name: Playwright Tests
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
project: [chromium, firefox]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Run all tests
run: |
echo "Installing dependencies..."
yarn
echo "Installing Playwright..."
cd playwright
mkdir test-results
npm ci
npx playwright install --with-deps ${{ matrix.project }}
echo "Running tests..."
npx playwright test --project=${{ matrix.project }}
- name: Upload Report
uses: actions/upload-artifact@v4
if: ${{ always() }}
continue-on-error: true
with:
name: playwright-results-${{ matrix.project }}
path: playwright/test-results/
if-no-files-found: ignore
tests-playwright-legacy:
name: Playwright Legacy Tests
runs-on: ubuntu-latest
container: ghcr.io/ietf-tools/datatracker-app-base:${{ inputs.targetBaseVersion }}
strategy:
fail-fast: false
matrix:
project: [chromium, firefox]
services:
db:
image: ghcr.io/ietf-tools/datatracker-db:latest
steps:
- uses: actions/checkout@v4
- name: Prepare for tests
run: |
chmod +x ./dev/tests/prepare.sh
sh ./dev/tests/prepare.sh
- name: Ensure DB is ready
run: |
/usr/local/bin/wait-for db:5432 -- echo "DB ready"
- name: Start Datatracker
run: |
echo "Running checks..."
./ietf/manage.py check
./ietf/manage.py migrate --fake-initial
echo "Starting datatracker..."
./ietf/manage.py runserver 0.0.0.0:8000 --settings=settings_local &
echo "Waiting for datatracker to be ready..."
/usr/local/bin/wait-for localhost:8000 -- echo "Datatracker ready"
- name: Run all tests
env:
# Required to get firefox to run as root:
HOME: ""
run: |
echo "Installing dependencies..."
yarn
echo "Installing Playwright..."
cd playwright
mkdir test-results
npm ci
npx playwright install --with-deps ${{ matrix.project }}
echo "Running tests..."
npx playwright test --project=${{ matrix.project }} -c playwright-legacy.config.js
- name: Upload Report
uses: actions/upload-artifact@v4
if: ${{ always() }}
continue-on-error: true
with:
name: playwright-legacy-results-${{ matrix.project }}
path: playwright/test-results/
if-no-files-found: ignore