Skip to content

feat(ske): Check service enablement only in error case#1457

Open
Fyusel wants to merge 1 commit into
mainfrom
check-enablement-only-in-error
Open

feat(ske): Check service enablement only in error case#1457
Fyusel wants to merge 1 commit into
mainfrom
check-enablement-only-in-error

Conversation

@Fyusel

@Fyusel Fyusel commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

STACKITCLI-287

Description

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see e.g. here)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

STACKITCLI-287

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
@Fyusel Fyusel requested a review from a team as a code owner July 6, 2026 09:04
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/create 37.84% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/list 51.52% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/create/create.go 37.84% (ø) 74 28 46
github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/list/list.go 51.52% (ø) 66 34 32

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Service: "ske",
}
}
return err

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.

it's a bit late, but wouldn't this hide the original error from line 99 (ClusterExists) when service is enabled and the call to ProjectEnabled would return a nil error?
So sth. like

			exists, err := skeUtils.ClusterExists(ctx, apiClient.DefaultAPI, model.ProjectId, model.Region, model.ClusterName)
            // err is now sth. like 'server is down'
			if err != nil {
				// Check if the project is enabled
				enabled, err := serviceEnablementUtils.ProjectEnabled(ctx, serviceEnablementApiClient, model.ProjectId, model.Region)
                 // let's assume call succeeds, enabled=true and err=nil now
				if err != nil {
					return fmt.Errorf("check if project is enabled failed: %w", err)
				}
				if !enabled {
					return &errors.ServiceDisabledError{
						Service: "ske",
					}
				}
				return err
                // we return nil here instead of 'server is down'

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