Skip to content

Conversation

@rubenhoenle
Copy link
Member

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)

@rubenhoenle rubenhoenle requested a review from a team as a code owner November 14, 2025 13:19
@rubenhoenle rubenhoenle self-assigned this Nov 14, 2025
@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas 0.00% (ø)
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/network/utils/v1network 55.88% (+0.25%) 👍
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/network/utils/v2network 54.25% (+0.44%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/network/utils/v1network/resource.go 51.35% (+0.34%) 296 152 (+1) 144 (-1) 👍
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/network/utils/v2network/resource.go 49.37% (+0.64%) 318 (+2) 157 (+3) 161 (-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/terraform-provider-stackit/stackit/internal/services/iaas/iaas_acc_test.go

Comment on lines -3632 to +3635
resource.TestCheckResourceAttrPair(
"stackit_public_ip.public_ip_simple", "network_interface_id",
"stackit_network_interface.network_interface_simple", "network_interface_id",
),
// The network gets re-created, which triggers a re-create of the 'network_interface_simple' NIC, which leads the 'stackit_public_ip_associate' resource to update the
// networkInterfaceId of the public IP. All that without the public ip resource noticing. So the public ip resource will still hold the networkInterfaceId of the old NIC.
// So we can only check that *some* network interface ID is set here, but can't compare it with the networkInterfaceId of the NIC resource (old vs. new NIC id)
resource.TestCheckResourceAttrSet("stackit_public_ip.public_ip_simple", "network_interface_id"),
Copy link
Contributor

Choose a reason for hiding this comment

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

No blame on you, this test case was the last time changed by me, so probably I mixed up something.
I think we should adjust the tests, to prevent the recreation of the network interfaces. Actually not to prevent the error you commented, but to test the intended case here is. This would be in my opinion, to check if the Update function of network interface works as expected.

func (r *networkInterfaceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform

With the current test cases, the update function isn't covered in the tests

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.

3 participants