Skip to content

chore(modelserving): switch to new SDK structure#1377

Open
s-inter wants to merge 2 commits intomainfrom
chore/modelserving-sdk-migration
Open

chore(modelserving): switch to new SDK structure#1377
s-inter wants to merge 2 commits intomainfrom
chore/modelserving-sdk-migration

Conversation

@s-inter
Copy link
Copy Markdown
Contributor

@s-inter s-inter commented Apr 15, 2026

Description

relates to STACKITTPR-563

Checklist

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

@s-inter s-inter requested a review from a team as a code owner April 15, 2026 07:35
@s-inter s-inter changed the title chore(modelserving): migrate to new sdk chore(modelserving): switch to new SDK structure Apr 15, 2026
@github-actions
Copy link
Copy Markdown

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving 0.00% (ø)
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving/token 16.60% (-0.70%) 👎
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving/utils 75.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving/token/resource.go 16.60% (-0.70%) 235 (-2) 39 (-2) 196 👎
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving/utils/util.go 75.00% (ø) 8 6 2

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/terraform-provider-stackit/stackit/internal/services/modelserving/modelserving_acc_test.go
  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving/token/resource_test.go
  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/modelserving/utils/util_test.go

Comment on lines +590 to 594
// theoretically, should never happen, but still catch zero values
validUntil := types.StringNull()
if tokenGetResp.Token.ValidUntil != nil {
if !tokenGetResp.Token.ValidUntil.IsZero() {
validUntil = types.StringValue(tokenGetResp.Token.ValidUntil.Format(time.RFC3339))
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this check isn't needed anymore—I'd remove it. But I'd like another opinion.

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.

I'd also remove it, the old code would also just have assigned a 0-value

Comment on lines +590 to 594
// theoretically, should never happen, but still catch zero values
validUntil := types.StringNull()
if tokenGetResp.Token.ValidUntil != nil {
if !tokenGetResp.Token.ValidUntil.IsZero() {
validUntil = types.StringValue(tokenGetResp.Token.ValidUntil.Format(time.RFC3339))
}
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.

I'd also remove it, the old code would also just have assigned a 0-value

Comment on lines +250 to +251
Description: utils.Ptr("desc"),
TtlDuration: utils.Ptr("1h"),
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.

running go fix would reintroduce using new instead of utils.Ptr

Comment on lines +302 to +303
Name: utils.Ptr("name"),
Description: utils.Ptr("desc"),
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.

same as above

}
if utils.Contains(tokensToDestroy, *items[i].Name) {
_, err := client.DeleteToken(ctx, testutil.Region, testutil.ProjectId, *items[i].Id).Execute()
if utils.Contains(tokensToDestroy, items[i].Name) {
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.

could use slices.Contains instead of custom utility func

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