Skip to content

[WIP] Inject admin password into test JVM for integration tests - #17

Closed
rish-kar with Copilot wants to merge 2 commits into
Bug-Fixesfrom
copilot/configure-surefire-admin-password
Closed

[WIP] Inject admin password into test JVM for integration tests#17
rish-kar with Copilot wants to merge 2 commits into
Bug-Fixesfrom
copilot/configure-surefire-admin-password

Conversation

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown
  • Add systemPropertyVariables configuration to maven-surefire-plugin to pass ACTONE_ADMIN_PASSWORD to test JVM
  • Set ACTONE_ADMIN_PASSWORD environment variable for testing
  • Run integration tests to verify they pass with the configuration
  • Verify the admin password is properly injected and used by tests
Original prompt

e> $env:ACTONE_ADMIN_PASSWORD=prarambh-admin-delhi

The user has attached the following files from their workspace:

  • src/test/resources/application-test.yaml
  • Act-One

TITLE: Inject admin password into test JVM for Spring integration tests

USER INTENT: Ensure the admin password used in integration tests is available as a system property to the test JVM (Spring context), preserving the encrypted/env-based workflow.

TASK DESCRIPTION: Configure Maven Surefire to pass the ACTONE_ADMIN_PASSWORD (set directly or decrypted at build-init) into test executions so controllers/tests expecting the header/password work reliably, especially on Windows/OneDrive where forked JVMs can linger.

EXISTING:

  • An Ant-run decrypt step exists in pom.xml (maven-antrun-plugin, id decrypt-admin-password, phase initialize) to set ACTONE_ADMIN_PASSWORD from ENCRYPTED_ADMIN_PASSWORD + ADMIN_PASSWORD_KEY if provided.
  • Integration tests reference TestAdminPasswordProvider.adminPassword() and set the X-Admin-Password header (files under src/test/java/com/prarambh/act/one/ticketing/...).

PENDING:

  • Run tests with ACTONE_ADMIN_PASSWORD set (either directly or via encrypted/env) to confirm they pass. No additional code changes requested.

CODE STATE:

  • pom.xml (build/surefire plugin) now includes:
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
            <!-- Windows/OneDrive-friendly: avoid forked JVMs that can linger and lock target/ -->
            <forkCount>0</forkCount>
            <reuseForks>false</reuseForks>
            <systemPropertyVariables>
                <ACTONE_ADMIN_PASSWORD>${ACTONE_ADMIN_PASSWORD}</ACTONE_ADMIN_PASSWORD>
            </systemPropertyVariables>
        </configuration>
    </plugin>
  • pom.xml retains the decrypt step in maven-antrun-plugin to populate ACTONE_ADMIN_PASSWORD when ENCRYPTED_ADMIN_PASSWORD and ADMIN_PASSWORD_KEY are set.

RELEVANT CODE/DOCUMENTATION SNIPPETS:

  • Tests set admin password header via TestAdminPasswordProvider.adminPassword() (e.g., in TicketControllerIntegrationTest, UserControllerIntegrationTest, etc.): .header("X-Admin-Password", TestAdminPasswordProvider.adminPassword()).
  • Ant decrypt script (summarized): if ENCRYPTED_ADMIN_PASSWORD and ADMIN_PASSWORD_KEY are set and ACTONE_ADMIN_PASSWORD is not, decrypts the password (AES/GCM with key hashed via SHA-256) and sets ACTONE_ADMIN_PASSWORD for the build.

OTHER NOTES:

  • Suggested usage: set ACTONE_ADMIN_PASSWORD (e.g., set ACTONE_ADMIN_PASSWORD=prarambh-admin-delhi) or provide ENCRYPTED_ADMIN_PASSWORD and ADMIN_PASSWORD_KEY, then run mvn clean test.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…test JVM

Co-authored-by: rishabhkar <46086520+rishabhkar@users.noreply.github.com>
@rish-kar rish-kar closed this Jan 8, 2026
Copilot AI requested a review from rish-kar January 8, 2026 09:01
Copilot stopped work on behalf of rish-kar due to an error January 8, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants