Skip to content

fix(observability): print valid JSON/YAML output for list cmds#1393

Merged
rubenhoenle merged 4 commits intomainfrom
fix/STACKITCLI-268-observability-json-list-output
Apr 29, 2026
Merged

fix(observability): print valid JSON/YAML output for list cmds#1393
rubenhoenle merged 4 commits intomainfrom
fix/STACKITCLI-268-observability-json-list-output

Conversation

@j1n-o9r
Copy link
Copy Markdown
Contributor

@j1n-o9r j1n-o9r commented Apr 29, 2026

Description

relates to STACKITCLI-268 / #893

Testing Instructions

Observability Plans:

  • stackit observability plans -> Expected: No plans found for project "xxx"
  • stackit observability plans --output-format json -> Should output valid JSON
  • stackit observability plans --output-format yaml -> Should output valid YAML

Observability Instance:

  • stackit observability instance list -> Expected: No servers found for project "xxx"
  • stackit observability instance list --output-format json -> Should output valid JSON
  • stackit observability instance list --output-format yaml -> Should output valid YAML

Create Observability Instance with ID yyy and name zzz

Observability Credentials:

  • stackit observability credentials list --instance-id yyy -> Expected: No credentials found for instance "zzz"
  • stackit observability credentials list --instance-id yyy --output-format json -> Should output valid JSON
  • stackit observability credentials list --instance-id yyy --output-format yaml -> Should output valid YAML

Observability Scrape Config:

  • stackit observability scrape-config list --instance-id yyy -> Expected: No scrape configurations found for instance "zzz"
  • stackit observability scrape-config list --instance-id yyy --output-format json -> Should output valid JSON
  • stackit observability scrape-config list --instance-id yyy --output-format yaml -> Should output valid YAML

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)

@j1n-o9r j1n-o9r changed the title adapted observability instances list command to return valid json and yaml when no instances are found fix(observability): print valid JSON/YAML output for list cmds Apr 29, 2026
@j1n-o9r j1n-o9r marked this pull request as ready for review April 29, 2026 10:18
@j1n-o9r j1n-o9r requested a review from a team as a code owner April 29, 2026 10:18
@rubenhoenle rubenhoenle enabled auto-merge (squash) April 29, 2026 14:27
@rubenhoenle rubenhoenle force-pushed the fix/STACKITCLI-268-observability-json-list-output branch from 75e2b9d to 15cc8de Compare April 29, 2026 14:27
@rubenhoenle rubenhoenle merged commit 8b6bb19 into main Apr 29, 2026
3 checks passed
@rubenhoenle rubenhoenle deleted the fix/STACKITCLI-268-observability-json-list-output branch April 29, 2026 14:31
@github-actions
Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/observability/credentials/list 58.33% (+6.25%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/observability/instance/list 57.45% (+6.38%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/observability/plans 59.18% (+6.12%) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/observability/scrape-config/list 55.56% (+5.56%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/stackit-cli/internal/cmd/observability/credentials/list/list.go 58.33% (+6.25%) 48 28 (+3) 20 (-3) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/observability/instance/list/list.go 57.45% (+6.38%) 47 27 (+3) 20 (-3) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/observability/plans/plans.go 59.18% (+6.12%) 49 29 (+3) 20 (-3) 👍
github.com/stackitcloud/stackit-cli/internal/cmd/observability/scrape-config/list/list.go 55.56% (+5.56%) 54 30 (+3) 24 (-3) 👍

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/observability/credentials/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/observability/instance/list/list_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/observability/plans/plans_test.go
  • github.com/stackitcloud/stackit-cli/internal/cmd/observability/scrape-config/list/list_test.go

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