Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

feat(scf): onboard scf platform describe/list and quota describe/list - #1720

Open
SerseusWasTaken wants to merge 1 commit into
mainfrom
feat/scf-platform-commands
Open

SerseusWasTaken wants to merge 1 commit into
mainfrom
feat/scf-platform-commands

Conversation

@SerseusWasTaken

Copy link
Copy Markdown
Contributor

Description

Relates to STACKITCLI-484

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)

@SerseusWasTaken
SerseusWasTaken requested a review from a team as a code owner October 30, 2026 14:31
@SerseusWasTaken
SerseusWasTaken force-pushed the feat/scf-platform-commands branch from 2fcc3e0 to 500d923 Compare October 30, 2026 14:40
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/describe 64.86% (+64.86%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/list 60.78% (+60.78%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota 0.00% (ø)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/describe 78.69% (+78.69%) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/list 64.86% (+64.86%) 🌟
Coverage details

Compared to commit 33ab07e (run #41070632930)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/describe/describe.go 64.86% (+64.86%) 37 (+37) 24 (+24) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/list/list.go 60.78% (+60.78%) 51 (+51) 31 (+31) 20 (+20) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/platform.go 0.00% (ø) 6 (+6) 0 6 (+6)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/describe/describe.go 78.69% (+78.69%) 61 (+61) 48 (+48) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/list/list.go 64.86% (+64.86%) 37 (+37) 24 (+24) 13 (+13) 🌟
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/quota.go 0.00% (ø) 5 (+5) 0 5 (+5)
github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/scf.go 0.00% (ø) 5 (+1) 0 5 (+1)

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.

Changed unit test files:

  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/describe/describe_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/beta/scf/platform/quota/list/list_test.go

Comment on lines +111 to +118
func buildRequest(ctx context.Context, model *inputModel, apiClient scf.DefaultAPI, page, perPage int64) scf.ApiListPlatformsRequest {
// the API has non AIP-compliant pagination, which cannot be adapted with out SDK pagination utils.
pageSize := int64(perPage)
if model.Limit != nil && *model.Limit < pageSize {
pageSize = *model.Limit
}
return apiClient.ListPlatforms(ctx, model.ProjectId, model.Region).Page(page).PerPage(pageSize)
}

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.

Suggested change
func buildRequest(ctx context.Context, model *inputModel, apiClient scf.DefaultAPI, page, perPage int64) scf.ApiListPlatformsRequest {
// the API has non AIP-compliant pagination, which cannot be adapted with out SDK pagination utils.
pageSize := int64(perPage)
if model.Limit != nil && *model.Limit < pageSize {
pageSize = *model.Limit
}
return apiClient.ListPlatforms(ctx, model.ProjectId, model.Region).Page(page).PerPage(pageSize)
}
func buildRequest(ctx context.Context, model *inputModel, apiClient scf.DefaultAPI) scf.ApiListPlatformsRequest {
// the API has non AIP-compliant pagination, which cannot be adapted with out SDK pagination utils.
pageSize := int64(maxPageSize)
if model.Limit != nil && *model.Limit < pageSize {
pageSize = *model.Limit
}
return apiClient.ListPlatforms(ctx, model.ProjectId, model.Region).Page(1).PerPage(pageSize)
}

function is always called with constant values, I'd inline them

}),
isValid: true,
expectedRequest: fixtureRequest(func(request *scf.ApiListPlatformsRequest) {
request.PerPage(maxPageSize)

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.

Suggested change
request.PerPage(maxPageSize)
*request = request.PerPage(maxPageSize)

PerPage has a value receiver.

In line 147 a request is built with testLimit whereas in prod code we always pass maxPageSize. I'd remove this param and also the page param, see comment in list.go

params := testparams.NewTestParams()
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := outputResult(params.Printer, tt.model, tt.quotas); (err != nil) != tt.wantErr {

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.

Suggested change
if err := outputResult(params.Printer, tt.model, tt.quotas); (err != nil) != tt.wantErr {
tt.model.OutputFormat = tt.outputFormat
if err := outputResult(params.Printer, tt.model, tt.quotas); (err != nil) != tt.wantErr {

tt.outputFormat currently never read

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