Skip to content

Enable admin ban integration tests in CI #133

@jakebromberg

Description

@jakebromberg

Summary

The admin ban integration tests are currently disabled because they require admin credentials that aren't configured in CI.

Background

The requestLine.spec.js test file includes a test for user banning functionality:

  • should return 403 when user is banned

This test requires:

  1. AUTH_USERNAME and AUTH_PASSWORD environment variables set for the test runner
  2. A corresponding admin user with credentials in better-auth

Requirements

To enable these tests, configure the following in .env:

# Default admin user (created by auth service when CREATE_DEFAULT_USER=TRUE)
DEFAULT_USER_EMAIL=testadmin@test.local
DEFAULT_USER_USERNAME=testadmin
DEFAULT_USER_PASSWORD=<secure-password>
DEFAULT_USER_DJ_NAME=Test DJ
DEFAULT_USER_REAL_NAME=Test Admin
DEFAULT_ORG_SLUG=test-org
DEFAULT_ORG_NAME=Test Organization

# Credentials for test runner (should match DEFAULT_USER)
AUTH_USERNAME=testadmin
AUTH_PASSWORD=<secure-password>

Implementation

  1. Add the required environment variables to .env
  2. Update scripts/ci-test.sh to enable TEST_ADMIN_BAN=true
  3. Verify admin ban test passes with npm run ci:testmock:full

Current Workaround

The admin ban test is skipped when TEST_ADMIN_BAN is not set to true. The ci:test:full script currently does not enable this flag.

Files

  • scripts/ci-test.sh - CI test runner (has TEST_ADMIN_BAN commented out)
  • scripts/ci-env.sh - CI environment setup (checks for DEFAULT_USER credentials)
  • tests/integration/requestLine.spec.js - Contains the admin ban test
  • tests/utils/anonymous_auth.js - Contains banUser, unbanUser, getAdminToken functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI/CD and testing infrastructureenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions