-
Notifications
You must be signed in to change notification settings - Fork 91
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types/basetypes: Prevent panics in ListType
, MapType
, and SetType
methods when ElemType
field is not set
#755
Conversation
…e` methods when `ElemType` field is not set Reference: #714 Previously before logic updates: ``` --- FAIL: TestListTypeString (0.00s) --- FAIL: TestListTypeString/ElemType-missing (0.00s) 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=0x28 pc=0x102ff0068] goroutine 19 [running]: testing.tRunner.func1.2({0x1030efe00, 0x1032e7b10}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1526 +0x1c8 testing.tRunner.func1() /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1529 +0x384 panic({0x1030efe00, 0x1032e7b10}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/runtime/panic.go:884 +0x204 github.com/hashicorp/terraform-plugin-framework/types/basetypes.ListType.String(...) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_type.go:115 github.com/hashicorp/terraform-plugin-framework/types/basetypes.TestListTypeString.func1(0x14000082ea0) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_type_test.go:287 +0x48 testing.tRunner(0x14000082ea0, 0x1400009a6f0) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1576 +0x10c created by testing.(*T).Run /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1629 +0x368 --- FAIL: TestListTypeTerraformType (0.00s) --- FAIL: TestListTypeTerraformType/ElemType-missing (0.00s) 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=0x30 pc=0x104acdd8c] goroutine 38 [running]: testing.tRunner.func1.2({0x104bd45a0, 0x104dcbb10}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1526 +0x1c8 testing.tRunner.func1() /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1529 +0x384 panic({0x104bd45a0, 0x104dcbb10}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/runtime/panic.go:884 +0x204 github.com/hashicorp/terraform-plugin-framework/types/basetypes.ListType.TerraformType(...) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_type.go:53 github.com/hashicorp/terraform-plugin-framework/types/basetypes.TestListTypeTerraformType.func1(0x14000103860) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_type_test.go:71 +0x5c testing.tRunner(0x14000103860, 0x1400011c9f0) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1576 +0x10c created by testing.(*T).Run /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1629 +0x368 --- FAIL: TestListTypeValueFromTerraform (0.00s) --- FAIL: TestListTypeValueFromTerraform/missing-element-type (0.00s) 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=0x30 pc=0x10515a414] goroutine 28 [running]: testing.tRunner.func1.2({0x1052785a0, 0x10546fb10}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1526 +0x1c8 testing.tRunner.func1() /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1529 +0x384 panic({0x1052785a0, 0x10546fb10}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/runtime/panic.go:884 +0x204 github.com/hashicorp/terraform-plugin-framework/types/basetypes.ListType.ValueFromTerraform({{0x0?, 0x0?}}, {0x1052c5630, 0x140000a4018}, {{0x1052c70d0?, 0x140000a35c0?}, {0x1052599c0?, 0x140000b62b8?}}) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_type.go:61 +0x64 github.com/hashicorp/terraform-plugin-framework/types/basetypes.TestListTypeValueFromTerraform.func1(0x140001389c0) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_type_test.go:195 +0x60 testing.tRunner(0x140001389c0, 0x140000928a0) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1576 +0x10c created by testing.(*T).Run /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1629 +0x368 ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. Good stuff! 🚀
Do we need an issue tracking the long-term/major version change to ElemType
that is mentioned in #714 ?
@austinvalle created #761 👍 |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #714
Previously before logic updates: