Skip to content

fix(branch): log in with EMAIL/PASSWORD and manage own environments in BranchAPITest (DX-31579) - #277

Merged
reeshika-h merged 1 commit into
epic/DX-31560-branch-create-environmentsfrom
claude/fix/DX-31579-branch-api-test-login
Oct 28, 2026
Merged

reeshika-h merged 1 commit into
epic/DX-31560-branch-create-environmentsfrom
claude/fix/DX-31579-branch-api-test-login

Conversation

@reeshika-h

Copy link
Copy Markdown
Contributor

AI-authored (Claude Code), run under the assignee's account.

Fixes DX-31579 (Epic DX-31560, blocks QA story DX-31569).

Problem: BranchAPITest used TestClient.getStack() (management token), so every branch create returned 401 / 161. It also assumed development and production exist on the stack.

Change (BranchAPITest.java, TestClient.java):

  • @BeforeAll: login(EMAIL, PASSWORD), stack built with the API key header only; creates two run-unique environments.
  • Polls fetch after each create until ready (422 / 905 meanwhile, bounded 60s); asserts on create response and fetched branch.
  • Adds TC-23 (no list, no publish_config) and the TC-24 case variant (422). A rejected create means fetch 422 / 905, not 404.
  • @AfterAll: deletes branches (force=true), the environments, then logs out.
  • No EMAIL/PASSWORD/API key: the class is skipped with a "not run" message.
  • TestClient gains public EMAIL, PASSWORD, isApiKeyConfigured().

Verification: mvn -q test-compile passes; the no-credentials path was run through the JUnit launcher and aborts (skip), not a pass. The live suite was NOT run: no credentials in this environment. A person or the QA agent must run it against dev11. Reviewer verdict: pass, 3 nits (cleanup catches IOException only; rejected-create uids not tracked; key not trimmed).

Known gap (not in this PR): pom.xml hard-codes skipTests, so -DskipTests=false runs nothing; separate ticket per DX-31579.


Generated by Claude Code

…in BranchAPITest

BranchAPITest used TestClient.getStack(), which sends the management token.
Branch create answered 401 (error 161) with it, and the test assumed the
'development' and 'production' environments exist on the stack.

The class now:
- logs in with EMAIL / PASSWORD and uses the apiKey header only;
- creates two environments whose names are unique to the run, and deletes
  them, with every created branch (force=true), and logs out in @afterall;
- polls fetch until a created branch is ready (bounded, 60s, 2s steps);
- treats a rejected create as no branch when fetch answers 422 with
  error_code 905, the same answer as a missing branch;
- adds TC-23 (create without publish_config) and TC-24 (environment name in
  a different case gets 422).

Without EMAIL, PASSWORD or apiKey in .env the class is skipped with a
"not run" message. TestClient gains public EMAIL and PASSWORD constants and
isApiKeyConfigured().

Refs: DX-31579

Co-authored-by: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ef6P4M5YRs6tDbdFqkvmZc
@reeshika-h
reeshika-h requested a review from a team as a code owner October 28, 2026 13:45
@snyk-io

snyk-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@reeshika-h
reeshika-h merged commit 6a5e5d2 into epic/DX-31560-branch-create-environments Oct 28, 2026
9 checks passed
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