Skip to content

test(auth): move jobs-auth tests to integration suite and extract shared fixtures - #861

Merged
ironcommit merged 1 commit into
mainfrom
auth-jobs-k8s-e2e/rsadler
Jul 23, 2026
Merged

test(auth): move jobs-auth tests to integration suite and extract shared fixtures#861
ironcommit merged 1 commit into
mainfrom
auth-jobs-k8s-e2e/rsadler

Conversation

@ironcommit

@ironcommit ironcommit commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Relocates the jobs-auth e2e tests (test_jobs_auth.py) from e2e/ into a new tests/auth/integration/ directory so they run as integration tests backed by the services pool rather than requiring a full Kubernetes cluster. This enables the tests to run in CI without the --kubernetes flag.

Changes

Test relocation and refactoring

  • Move e2e/test_jobs_auth.pytests/auth/integration/test_jobs_auth.py with updated imports and fixture usage
  • Extract helper functions (managed_admin_workspace, job_exists_in_pages) into tests/auth/integration/jobs_auth_helpers.py
  • Rename companion unit tests from tests/test_e2e_jobs_auth.pytests/auth/test_jobs_auth_helpers.py
  • Add tests/auth to pytest.ini testpaths

Shared fixtures extraction

  • Extract services pool fixtures from e2e/conftest.py into e2e/services_pool_fixtures.py so both the e2e and auth integration suites can reuse them
  • Add a new services_pool_sdk fixture with explicit DefaultHttpxClient for local pool processes
  • Wire up tests/auth/integration/conftest.py with the shared fixtures and report hooks

CI improvements

  • Create .github/actions/finalize-kind-e2e/ composite action consolidating the repeated Kind cleanup steps (log collection, disk summary, artifact upload, cluster deletion)
  • Replace duplicated cleanup steps in both kind-smoke and kind-cpu-e2e jobs with the new composite action
  • Update e2e/k8s/scripts/run_auth_e2e.sh: remove test_jobs_auth.py from default targets, export NMP_BASE_URL, switch to --run-e2e flag

Test correctness

  • Generate distinct OIDC principal_id (UUID) per test user instead of reusing the email as subject, matching real IdP behavior

Summary by CodeRabbit

  • New Features
    • Added a dedicated CI “Finalize Kind e2e” action to collect Kubernetes logs, capture host diagnostics, upload artifacts, and clean up the Kind cluster.
    • Introduced shared services-pool fixtures with improved failure reporting (services log tail + binding metadata).
    • Expanded auth integration coverage with principal propagation support.
  • Bug Fixes
    • Improved reliability of post-test diagnostics and cleanup by ensuring they run even after failures.
    • Ensured services log-tail reporting only includes recent lines to avoid large-log loading.
  • Tests
    • Added/updated tests for pagination, workspace lifecycle handling, and services log tail behavior.
  • Chores
    • Updated E2E auth script behavior (no targets ⇒ no tests) and environment variable naming; expanded Pytest discovery for auth integration tests.

@ironcommit
ironcommit requested review from a team as code owners July 23, 2026 00:45
@github-actions github-actions Bot added the chore label Jul 23, 2026
@ironcommit ironcommit changed the title chore(auth): enable skipped e2e tests test(auth): move jobs-auth tests to integration suite and extract shared fixtures Jul 23, 2026
@github-actions github-actions Bot added the test conventional-commit type label Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fc68282f-7279-487d-941e-5ad4fee33473

📥 Commits

Reviewing files that changed from the base of the PR and between 1ad244d and 4cfa443.

📒 Files selected for processing (12)
  • .github/actions/finalize-kind-e2e/action.yaml
  • .github/workflows/ci.yaml
  • e2e/conftest.py
  • e2e/k8s/scripts/run_auth_e2e.sh
  • e2e/services_pool.py
  • e2e/services_pool_fixtures.py
  • pytest.ini
  • tests/auth/integration/conftest.py
  • tests/auth/integration/jobs_auth_helpers.py
  • tests/auth/integration/test_jobs_auth.py
  • tests/auth/test_jobs_auth_helpers.py
  • tests/test_e2e_services_pool.py
🚧 Files skipped from review as they are similar to previous changes (11)
  • pytest.ini
  • e2e/services_pool.py
  • .github/actions/finalize-kind-e2e/action.yaml
  • tests/test_e2e_services_pool.py
  • tests/auth/test_jobs_auth_helpers.py
  • .github/workflows/ci.yaml
  • tests/auth/integration/jobs_auth_helpers.py
  • tests/auth/integration/conftest.py
  • e2e/services_pool_fixtures.py
  • tests/auth/integration/test_jobs_auth.py
  • e2e/conftest.py

📝 Walkthrough

Walkthrough

The PR extracts Kind E2E cleanup into a reusable composite action and centralizes pytest services-pool fixtures and reporting. Authentication integration tests are added to discovery, migrated to shared helpers and SDK fixtures, and the Kubernetes auth runner is updated.

Changes

Kind E2E cleanup

Layer / File(s) Summary
Finalize Kind cleanup action
.github/actions/finalize-kind-e2e/action.yaml, .github/workflows/ci.yaml
A reusable action collects logs, reports storage usage, uploads artifacts, and deletes Kind resources; both Kind CI jobs invoke it with job-specific inputs.

Authentication integration services pool

Layer / File(s) Summary
Shared services-pool wiring
e2e/services_pool_fixtures.py, e2e/conftest.py, tests/auth/integration/conftest.py, pytest.ini, tests/test_e2e_services_pool.py
Services-pool configuration, lifecycle fixtures, SDK construction, failure reporting, auth integration hooks, test discovery, and log-tail validation are connected through shared helpers.
Authentication job helpers and tests
tests/auth/integration/jobs_auth_helpers.py, tests/auth/integration/test_jobs_auth.py, tests/auth/test_jobs_auth_helpers.py, e2e/services_pool.py
Workspace and pagination helpers are relocated, authentication tests use distinct OIDC subjects and services_pool_sdk, and related helper tests use the new names.
Authentication test runner updates
e2e/k8s/scripts/run_auth_e2e.sh
The runner changes its default target, base URL variable, pytest flag, and handling of empty targets.

Sequence Diagram(s)

sequenceDiagram
  participant Pytest
  participant ServicesPoolFixtures
  participant E2EServicesPool
  participant ServicesPoolSDK
  participant TestReport
  Pytest->>ServicesPoolFixtures: configure_services_pool(config)
  Pytest->>ServicesPoolFixtures: register_services_pool_items(config, items)
  ServicesPoolFixtures->>E2EServicesPool: acquire module services
  ServicesPoolFixtures->>ServicesPoolSDK: construct NeMoPlatform client
  ServicesPoolFixtures->>TestReport: append services log and binding sections
Loading

Possibly related PRs

Suggested reviewers: mckornfield

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: moving jobs-auth tests into the integration suite and extracting shared fixtures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch auth-jobs-k8s-e2e/rsadler

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/services_pool_fixtures.py`:
- Around line 96-101: Update the fixture’s fallback log storage around
_services_log_key to key service log paths by module.nodeid rather than
retaining a single last path. When active binding metadata is unavailable, look
up the path for the current module so failures cannot reuse another module’s
log.
- Around line 61-63: Update the log-tail handling around log_path.read_text so
it streams the file and retains only the last _TAIL_LINES_ON_FAILURE lines,
avoiding materialization of the complete services log while preserving the
existing tail output behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2560b490-ae73-4cb0-add4-bcdb3b71bc92

📥 Commits

Reviewing files that changed from the base of the PR and between 7662279 and 667a847.

📒 Files selected for processing (11)
  • .github/actions/finalize-kind-e2e/action.yaml
  • .github/workflows/ci.yaml
  • e2e/conftest.py
  • e2e/k8s/scripts/run_auth_e2e.sh
  • e2e/services_pool.py
  • e2e/services_pool_fixtures.py
  • pytest.ini
  • tests/auth/integration/conftest.py
  • tests/auth/integration/jobs_auth_helpers.py
  • tests/auth/integration/test_jobs_auth.py
  • tests/auth/test_jobs_auth_helpers.py

Comment thread e2e/services_pool_fixtures.py Outdated
Comment thread e2e/services_pool_fixtures.py
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 27123/34832 77.9% 62.1%
Integration Tests 15963/33544 47.6% 20.0%

@ironcommit
ironcommit force-pushed the auth-jobs-k8s-e2e/rsadler branch 2 times, most recently from 9773f57 to 1ad244d Compare July 23, 2026 18:34
@svvarom
svvarom self-requested a review July 23, 2026 18:34

@crookedstorm crookedstorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should tidy up a bit. It feels like this probably should become a javascript action so it has a nice teardown hook, but honestly, it's not necessary right now.

@anastasia-nesterenko anastasia-nesterenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit question

Comment thread e2e/k8s/scripts/run_auth_e2e.sh Outdated
Signed-off-by: Ryan S <267728323+ironcommit@users.noreply.github.com>
@ironcommit
ironcommit force-pushed the auth-jobs-k8s-e2e/rsadler branch from 1ad244d to 4cfa443 Compare July 23, 2026 19:43
@ironcommit
ironcommit added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit e0362ba Jul 23, 2026
60 checks passed
@ironcommit
ironcommit deleted the auth-jobs-k8s-e2e/rsadler branch July 23, 2026 21:00
AnuradhaKaruppiah pushed a commit to AnuradhaKaruppiah/nemo-platform that referenced this pull request Jul 24, 2026
Signed-off-by: Ryan S <267728323+ironcommit@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore test conventional-commit type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants