Skip to content

Conversation

@earaghbidikashani
Copy link
Contributor

@earaghbidikashani earaghbidikashani commented Oct 23, 2025

Add comprehensive e2e test coverage

This PR expands the end-to-end test suite to provide better coverage of the jupyter-k8s operator's core functionality.

Changes

New test files:
• workspace_lifecycle_test.go - Tests workspace creation, status transitions, and resource validation
• workspace_access_test.go - Tests WorkspaceAccessStrategy creation and workspace integration

Enhanced existing tests:
• Fixed flaky webhook connectivity issues in workspace_scheduling_test.go by adding webhook readiness checks
• Re-enabled previously disabled scheduling tests with improved reliability

Makefile improvements:
• Added FOCUS parameter support to test-e2e target for running specific tests: make test-e2e FOCUS="test name"

Test Coverage Added

Workspace Lifecycle:
• Workspace creation with valid configurations
• Status condition management (Valid, Degraded conditions)
• Workspace state transitions (Running → Stopped)
• Resource validation handling for invalid configurations

Access Control:
• WorkspaceAccessStrategy resource creation and configuration
• Workspace integration with access strategies via accessStrategy.name references
• Access URL templates and resource template functionality

Reliability Improvements:
• Added webhook readiness verification to prevent connection refused errors
• Improved controller startup detection with proper retry logic

All tests use the //go:build e2e tag and integrate with the existing test infrastructure using Kind clusters and the standard make test-e2e workflow.

closes #45

Copy link
Contributor

@andrii-i andrii-i left a comment

Choose a reason for hiding this comment

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

HI @earaghbidikashani. Thank you for your work. Could you please create test *.yamls non-inline as files and put them in static sub-folder in test or test/e2e folder (if they are only used by e2e)?

I know that our existing e2e tests define files inline but it's a bad practice, we should refactor existing tests doing that and not add new ones doing that.

@JGuinegagne JGuinegagne changed the title chore: Enhance e2e tests for recently added features test: Enhance e2e tests for recently added features Oct 23, 2025
@andrii-i
Copy link
Contributor

Created #69 to track the need to refactor other / existing e2e tests to use static *.yaml files instead of defining them inline

@earaghbidikashani
Copy link
Contributor Author

HI @earaghbidikashani. Thank you for your work. Could you please create test *.yamls non-inline as files and put them in static sub-folder in test or test/e2e folder (if they are only used by e2e)?

I know that our existing e2e tests define files inline but it's a bad practice, we should refactor existing tests doing that and not add new ones doing that.

Sure @andrii-i, added static files for the new tests I added

Copy link
Contributor

@andrii-i andrii-i left a comment

Choose a reason for hiding this comment

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

Note that the invalid-resources test only creates the Workspace and checks that a status section exists and that the Workspace object is present. Should it also assert that the operator marks the Workspace as invalid (or rejects the creation) when the Workspace resource spec is invalid?

Note that the access-strategy test currently verifies the WorkspaceAccessStrategy exists and the Workspace.spec references it. Should it also verify the end-to-end behavior: that the controller materializes the configured access resources, that an access URL is populated on the Workspace status and templating is resolved, that access-related environment variables are applied to the generated workload spec, and also potentially that access resources/status are removed when the Workspace stops and recreated when it runs again?

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.

Pod Scheduling Flaky e2e tests

2 participants