Skip to content
Open
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
37fc4ce
feat(dashboard): improve error handling in testScheme initialization …
asanzgom Sep 24, 2025
8b3b993
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 24, 2025
7d0a934
fix: resolve cleanup duplication and failing dashboard test
asanzgom Sep 24, 2025
9554442
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 25, 2025
7e33e67
refactor: replace fragile deferred recover pattern with explicit pani…
asanzgom Sep 25, 2025
846085f
fix: ensure CRD-present scenarios actually exercise migration logic
asanzgom Sep 25, 2025
b7fcb17
fix: resolve race condition in deterministic-name assertion
asanzgom Sep 25, 2025
3b6bc6c
fix: resolve linter errors and failing tests
asanzgom Sep 25, 2025
be89cc3
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 25, 2025
10e5f22
Add comprehensive unit test coverage for dashboard component
asanzgom Sep 25, 2025
51cf9bf
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 25, 2025
cd7aa9c
Update internal/controller/components/dashboard/dashboard_controller_…
asanzgom Sep 25, 2025
fb4a993
Update internal/controller/components/dashboard/dashboard_controller_…
asanzgom Sep 25, 2025
e5f69ae
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 25, 2025
dcc6526
refactor: improve dashboard controller code quality and test coverage
asanzgom Sep 25, 2025
0397895
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 25, 2025
eb63471
refactor: improve dashboard component test structure and code quality
asanzgom Sep 25, 2025
9020b9f
refactor: improve dashboard component test structure and code quality
asanzgom Sep 25, 2025
8878f9f
fix: remove leading slashes from ManifestInfo.SourcePath values
asanzgom Sep 25, 2025
5f8a5de
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 26, 2025
1c5f97a
refactor: remove tautological tests and fix function naming
asanzgom Sep 26, 2025
f644355
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 26, 2025
1dc3c2b
Fix dashboard component unit tests and resolve linting issues
asanzgom Sep 26, 2025
21d5c9d
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 29, 2025
5839226
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Sep 30, 2025
18af3ab
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 24, 2025
c99ab48
Fix dashboard component tests and resolve linting issues
asanzgom Oct 24, 2025
7f1b025
Resolve merge conflicts
asanzgom Oct 24, 2025
15247ef
Clean up imports and formatting
asanzgom Oct 24, 2025
84b9b3f
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 27, 2025
16c79c4
Merge branch 'feature/Add_unit_test_coverage_on_the_dashboard_compone…
asanzgom Oct 27, 2025
a2f94fe
fix(dashboard): resolve unit test failures and linting issues
asanzgom Oct 27, 2025
2ad3b6e
feat(dashboard): enhance unit test coverage and fix linting issues
asanzgom Oct 27, 2025
27c3014
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 29, 2025
d29f039
Add comprehensive unit test coverage for dashboard component
asanzgom Oct 29, 2025
b136d9f
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 29, 2025
2d5fa60
Consolidate redundant platform tests into single table-driven test
asanzgom Oct 29, 2025
1a278c5
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 29, 2025
df21826
Merge branch 'feature/Add_unit_test_coverage_on_the_dashboard_compone…
asanzgom Oct 29, 2025
dfa0644
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 30, 2025
4a56537
Refactor dashboard tests: consolidate redundant tests and improve mai…
asanzgom Oct 30, 2025
b90e4f7
Merge branch 'feature/Add_unit_test_coverage_on_the_dashboard_compone…
asanzgom Oct 30, 2025
aa9aab3
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Oct 31, 2025
b4729c9
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 3, 2025
d2e8c6f
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 7, 2025
3ec2513
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 17, 2025
9cbc2e6
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 19, 2025
725bdcc
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 19, 2025
a58f4d1
fix(e2e): recreate applications namespace after cleanup to prevent op…
asanzgom Nov 19, 2025
67400b6
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 19, 2025
fa2792d
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 26, 2025
56bf9f1
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 26, 2025
21c4490
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 26, 2025
b384f95
Merge branch 'main' into feature/Add_unit_test_coverage_on_the_dashbo…
asanzgom Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ opt/manifests/

cover.out

# Coverage HTML reports
*_coverage.html
*_coverage.out
coverage.html
coverage.out
overall_coverage.out
config/manager/kustomization.yaml

# Ignore any local.mk files that would be consumed by the Makefile
Expand All @@ -67,3 +73,6 @@ local.mk

# Ignore catalog related files
catalog/

# Ignore backup files
*.backup
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,18 @@ unit-test: envtest ginkgo # directly use ginkgo since the framework is not compa
--coverprofile=cover.out \
--succinct \
$(TEST_SRC)
CLEANFILES += cover.out
CLEANFILES += cover.out coverage.html

.PHONY: test-coverage
test-coverage: ## Generate HTML coverage report
$(MAKE) unit-test
@if [ ! -f cover.out ] || [ ! -s cover.out ]; then \
echo "Warning: cover.out is missing or empty. Skipping coverage report generation."; \
echo "Make sure unit tests are configured to generate coverage data."; \
exit 0; \
fi
go tool cover -html=cover.out -o coverage.html
@echo "Coverage report generated: coverage.html"

$(PROMETHEUS_TEST_DIR)/%.rules.yaml: $(PROMETHEUS_TEST_DIR)/%.unit-tests.yaml $(PROMETHEUS_CONFIG_YAML) $(YQ)
$(YQ) eval ".data.\"$(@F:.rules.yaml=.rules)\"" $(PROMETHEUS_CONFIG_YAML) > $@
Expand Down
22 changes: 16 additions & 6 deletions internal/controller/components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/annotations"
)

const (
// AnacondaSecretName is the name of the anaconda access secret.
AnacondaSecretName = "anaconda-ce-access" //nolint:gosec // This is a Kubernetes secret name, not a credential
)

type componentHandler struct{}

func init() { //nolint:gochecknoinits
Expand All @@ -33,14 +38,17 @@ func (s *componentHandler) GetName() string {
}

func (s *componentHandler) Init(platform common.Platform) error {
mi := defaultManifestInfo(platform)
mi, err := DefaultManifestInfo(platform)
if err != nil {
return err
}

if err := odhdeploy.ApplyParams(mi.String(), "params.env", imagesMap); err != nil {
if err := odhdeploy.ApplyParams(mi.String(), "params.env", ImagesMap); err != nil {
return fmt.Errorf("failed to update images on path %s: %w", mi, err)
}

extra := bffManifestsPath()
if err := odhdeploy.ApplyParams(extra.String(), "params.env", imagesMap); err != nil {
extra := BffManifestsPath()
if err := odhdeploy.ApplyParams(extra.String(), "params.env", ImagesMap); err != nil {
return fmt.Errorf("failed to update modular-architecture images on path %s: %w", extra, err)
}

Expand Down Expand Up @@ -72,6 +80,10 @@ func (s *componentHandler) IsEnabled(dsc *dscv2.DataScienceCluster) bool {
func (s *componentHandler) UpdateDSCStatus(ctx context.Context, rr *types.ReconciliationRequest) (metav1.ConditionStatus, error) {
cs := metav1.ConditionUnknown

if rr.Client == nil {
return cs, errors.New("client is nil")
}

c := componentApi.Dashboard{}
c.Name = componentApi.DashboardInstanceName

Expand All @@ -89,8 +101,6 @@ func (s *componentHandler) UpdateDSCStatus(ctx context.Context, rr *types.Reconc
dsc.Status.Components.Dashboard.ManagementState = ms
dsc.Status.Components.Dashboard.DashboardCommonStatus = nil

rr.Conditions.MarkFalse(ReadyConditionType)

if s.IsEnabled(dsc) {
dsc.Status.Components.Dashboard.DashboardCommonStatus = c.Status.DashboardCommonStatus.DeepCopy()

Expand Down
18 changes: 12 additions & 6 deletions internal/controller/components/dashboard/dashboard_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package dashboard

import (
"context"
"errors"
"fmt"

consolev1 "github.com/openshift/api/console/v1"
Expand Down Expand Up @@ -46,7 +47,11 @@ import (

// NewComponentReconciler creates a ComponentReconciler for the Dashboard API.
func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
componentName := computeComponentName()
if mgr == nil {
return errors.New("could not create the dashboard controller: manager cannot be nil")
}

componentName := ComputeComponentName()

_, err := reconciler.ReconcilerFor(mgr, &componentApi.Dashboard{}).
// operands - owned
Expand Down Expand Up @@ -95,9 +100,10 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.
GenericFunc: func(tge event.TypedGenericEvent[client.Object]) bool { return false },
DeleteFunc: func(tde event.TypedDeleteEvent[client.Object]) bool { return false },
}), reconciler.Dynamic(reconciler.CrdExists(gvk.DashboardHardwareProfile))).
WithAction(initialize).
WithAction(Initialize).
WithAction(setKustomizedParams).
WithAction(configureDependencies).
WithAction(ConfigureDependencies).
WithAction(CustomizeResources).
WithAction(kustomize.NewAction(
// Those are the default labels added by the legacy deploy method
// and should be preserved as the original plugin were affecting
Expand All @@ -112,15 +118,15 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.
)).
WithAction(deploy.NewAction()).
WithAction(deployments.NewAction()).
WithAction(reconcileHardwareProfiles).
WithAction(updateStatus).
WithAction(ReconcileHardwareProfiles).
WithAction(UpdateStatus).
// must be the final action
WithAction(gc.NewAction(
gc.WithUnremovables(gvk.OdhDashboardConfig),
)).
// declares the list of additional, controller specific conditions that are
// contributing to the controller readiness status
WithConditions(conditionTypes...).
WithConditions(ConditionTypes...).
Build(ctx)

if err != nil {
Expand Down
Loading