Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix manifest waiter dropping resource state on un-recoverable errors #2360

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexsomesan
Copy link
Member

Description

Fixes an issue with the waiter logic in the kubernetes_manifest resource where it aborts the processing of apply entirely on non-recoverable errors, which leads to the resource state not being saved.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ go test -v -tags acceptance -run '^TestKubernetesManifest_WaitFields_IncompletePath$' ./manifest/test/acceptance        
2023/12/04 14:28:01 Testing against Kubernetes API version: v1.27.3
=== RUN   TestKubernetesManifest_WaitFields_IncompletePath
2023-12-04T14:28:02.754+0100 [INFO]  [ApplyResourceChange][Wait] Waiting until ready...

2023-12-04T14:28:02.756+0100 [INFO]  [ApplyResourceChange][Wait] Done waiting.

--- FAIL: TestKubernetesManifest_WaitFields_IncompletePath (1.90s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1041d4bc8]

goroutine 54 [running]:
testing.tRunner.func1.2({0x1047791c0, 0x105a0b290})
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1545 +0x1c8
testing.tRunner.func1()
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1548 +0x360
panic({0x1047791c0?, 0x105a0b290?})
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/runtime/panic.go:914 +0x218
github.com/hashicorp/terraform-provider-kubernetes/manifest/test/helper/state.getAttributesValuesFromResource(0x10423cf5e?, {0x14001877770, 0x18})
        /Users/alex/work/terraform-provider-kubernetes/manifest/test/helper/state/state_helper.go:37 +0x28
github.com/hashicorp/terraform-provider-kubernetes/manifest/test/helper/state.(*Helper).GetAttributeValue(0x14000683040?, 0x14000683040, {0x10423cf5e, 0x26})
        /Users/alex/work/terraform-provider-kubernetes/manifest/test/helper/state/state_helper.go:113 +0x60
github.com/hashicorp/terraform-provider-kubernetes/manifest/test/helper/state.(*Helper).AssertAttributeValues(0x10479de00?, 0x14000683040, 0x10423cf5e?)
        /Users/alex/work/terraform-provider-kubernetes/manifest/test/helper/state/state_helper.go:147 +0x98
github.com/hashicorp/terraform-provider-kubernetes/manifest/test/acceptance.TestKubernetesManifest_WaitFields_IncompletePath(0x14000683040)
        /Users/alex/work/terraform-provider-kubernetes/manifest/test/acceptance/wait_test.go:323 +0x62c
testing.tRunner(0x14000683040, 0x104a3f848)
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1595 +0xe8
created by testing.(*T).Run in goroutine 1
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1648 +0x33c
FAIL    github.com/hashicorp/terraform-provider-kubernetes/manifest/test/acceptance     2.492s
FAIL

Release Note

Release note for CHANGELOG:

...

References

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

@alexsomesan alexsomesan self-assigned this Dec 4, 2023
@github-actions github-actions bot added the size/M label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant