-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Summary
This issue tracks the discussion about refactoring the test structure in components/odh-notebook-controller/controllers/notebook_runtime_test.go
to improve test organization and clarity.
Background
The current test implementation in PR #623 includes a test loop that handles three scenarios:
- ConfigMap with data
- ConfigMap without data (empty)
- ConfigMap created from ImageStream
Discussion Points
From the PR review discussion:
- @jstourac initially wanted to remove the ConfigMap altogether but realized the empty ConfigMap test case provides valuable validation that can't be easily simulated with ImageStream due to notebook controller logic
- @jiridanek suggested that the empty ConfigMap test could be a separate test, not part of the main
testData
loop
Current Implementation
The test uses a unified structure with test cases that specify either a ConfigMap
or imageStream
:
testCases := []struct {
name string
notebook *nbv1.Notebook
notebookName string
ConfigMap *corev1.ConfigMap
imageStream *imagev1.ImageStream
expectedMountName string
expectedMountPath string
}{
// ConfigMap with data case
// ConfigMap without data case
// ImageStream case
}
Possible Implementation Approaches
-
Separate Test Structure: Extract the empty ConfigMap test case into its own dedicated test function outside the main loop, keeping the loop focused on ConfigMap-with-data and ImageStream scenarios.
-
Grouped Test Organization: Organize tests into logical groups (e.g., "ConfigMap Tests" and "ImageStream Tests") with separate test loops for better clarity.
-
Keep Current Structure: Maintain the current unified approach but add clearer documentation/comments about the test case purposes.
Acceptance Criteria
- Determine the preferred test organization approach
- Implement the chosen approach
- Ensure all existing test scenarios remain covered
- Update test documentation as needed
References
- Original PR: RHOAIENG-27813: extend coverage for the runtime config map tests #623
- Discussion thread: RHOAIENG-27813: extend coverage for the runtime config map tests #623 (comment)
/cc @jstourac @jiridanek