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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash when dependent test sweeper is missing #279

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Don't crash when dependent test sweeper is missing #279

merged 1 commit into from
Dec 12, 2019

Conversation

ewbankkit
Copy link
Contributor

Closes #278.

Without the fix the new test cases cause a crash:

$ go test ./helper/resource/...
2019/12/12 07:57:21 [DEBUG] New state was assigned lineage "7d80f5ca-2c51-4290-c29e-0df3b7ff4e30"
2019/12/12 07:57:21 [DEBUG] Waiting for state to become: [done]
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [DEBUG] Waiting for state to become: [done]
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:21 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [WARN] WaitForState timeout after 85ms
2019/12/12 07:57:22 [WARN] WaitForState starting 30s refresh grace period
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: [running]
2019/12/12 07:57:22 [WARN] WaitForState timeout after 1ms
2019/12/12 07:57:22 [WARN] WaitForState starting 5ms refresh grace period
2019/12/12 07:57:22 [ERROR] WaitForState exceeded refresh grace period
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: [running]
2019/12/12 07:57:22 [WARN] WaitForState timeout after 10ms
2019/12/12 07:57:22 [WARN] WaitForState starting 30s refresh grace period
2019/12/12 07:57:22 [TRACE] Waiting 10s before next try
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: [running]
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: [done]
2019/12/12 07:57:22 [TRACE] Waiting 200ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 400ms before next try
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: []
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: []
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [TRACE] Waiting 10ms before next try
2019/12/12 07:57:22 [WARN] WaitForState timeout after 100ms
2019/12/12 07:57:22 [WARN] WaitForState starting 30s refresh grace period
2019/12/12 07:57:22 [DEBUG] Waiting for state to become: [running]
	- aws_dummy
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=0x1 addr=0x18 pc=0xf762dc]

goroutine 94 [running]:
testing.tRunner.func1(0xc000475e00)
	/usr/local/go/src/testing/testing.go:874 +0x3a3
panic(0x10ed6a0, 0x1d8a6c0)
	/usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/hashicorp/terraform-plugin-sdk/helper/resource.filterSweeperWithDependencies(0x127c99a, 0x10, 0xc000486de0, 0x10)
	/home/kit/wrk/src/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing.go:199 +0xcc
github.com/hashicorp/terraform-plugin-sdk/helper/resource.filterSweeperWithDependencies(0x127b6b1, 0xf, 0xc000486de0, 0x0)
	/home/kit/wrk/src/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing.go:200 +0x1b0
github.com/hashicorp/terraform-plugin-sdk/helper/resource.TestFilterSweeperWithDependencies.func1(0xc000475e00)
	/home/kit/wrk/src/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_test.go:1243 +0x5d
testing.tRunner(0xc000475e00, 0xc000496640)
	/usr/local/go/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:960 +0x350
FAIL	github.com/hashicorp/terraform-plugin-sdk/helper/resource	0.907s
FAIL

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Hi @ewbankkit
Good catch!

I'm happy with the implementation functionally, I just left you one comment inline to address.

helper/resource/testing.go Outdated Show resolved Hide resolved
@radeksimko radeksimko added bug Something isn't working testing waiting-response Issues or pull requests waiting for an external response labels Dec 12, 2019
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@radeksimko
Copy link
Member

@kmoe - I reckon this doesn't touch the part of test framework you're currently working on, but FYI

@radeksimko radeksimko merged commit 9f535d8 into hashicorp:master Dec 12, 2019
@ewbankkit ewbankkit deleted the issue-278 branch December 12, 2019 19:05
@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting-response Issues or pull requests waiting for an external response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash in acceptance test sweeper if dependent sweeper is missing
2 participants