diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 6c967501..c24ef63c 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -23,7 +23,7 @@ jobs: run: sleep 10 - name: Generate Test Fixtures - run: docker exec -w /app --tty $(docker-compose ps -q backend) make fake-data ARGS="--teams 10 --users 2 --categories 10 --challenges 100 --solves 1000" + run: docker exec -w /app --tty $(docker-compose ps -q backend) make fake-data ARGS="--teams 10 --users 2 --categories 10 --challenges 100 --solves 1000 --zoom" - name: Confirm Upstream is Healthy run: curl -v --fail localhost:8000/api/v2/stats/stats/ diff --git a/scripts/fake/__init__.py b/scripts/fake/__init__.py index 01cba69e..52b23839 100644 --- a/scripts/fake/__init__.py +++ b/scripts/fake/__init__.py @@ -1,12 +1,13 @@ """A command-line tool for generating and inserting many rows of fake data into the database. Usage: - fake generate [--teams=] [--users=] [--categories=] [--challenges=] [--solves=] [--force] + fake generate [--teams=] [--users=] [--categories=] [--challenges=] [--solves=] [--force] [--zoom] fake -h | --help Options: --help -h Show this screen. --force Run even when the database is populated. + --zoom Disable Postgres logging so the script runs faster. --users= The number of users to generate per team. [default: 2] --categories= The number of categories to generate. [default: 5] diff --git a/scripts/fake/__main__.py b/scripts/fake/__main__.py index c0691ba1..1edf0db7 100644 --- a/scripts/fake/__main__.py +++ b/scripts/fake/__main__.py @@ -51,9 +51,10 @@ db_indexes[table] = indexes db_constraints[table] = constraints - for table in TABLE_NAMES: - cursor.execute(f"ALTER TABLE {table} SET UNLOGGED") - db.connection.commit() + if arguments.get("zoom"): + for table in TABLE_NAMES: + cursor.execute(f"ALTER TABLE {table} SET UNLOGGED") + db.connection.commit() with TimedLog("Inserting data... ", ending="\n"): fake = Faker() diff --git a/scripts/fake/config.py b/scripts/fake/config.py index 86d1e7bf..732cd0b5 100644 --- a/scripts/fake/config.py +++ b/scripts/fake/config.py @@ -28,6 +28,7 @@ def dsn(cls) -> str: TABLE_NAMES = [ + "admin_auditlogentry", "member_member_groups", "authentication_token", "member_member_user_permissions",