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

Crash in acceptance test sweeper if dependent sweeper is missing #278

Closed
ewbankkit opened this issue Dec 12, 2019 · 1 comment · Fixed by #279
Closed

Crash in acceptance test sweeper if dependent sweeper is missing #278

ewbankkit opened this issue Dec 12, 2019 · 1 comment · Fixed by #279
Labels
bug Something isn't working

Comments

@ewbankkit
Copy link
Contributor

SDK version

$ go mod edit -json | jq '.Require[] | select(.Path=="github.com/hashicorp/terraform-plugin-sdk")'
{
  "Path": "github.com/hashicorp/terraform-plugin-sdk",
  "Version": "v1.4.0"
}

Relevant provider source code

func init() {
	resource.AddTestSweepers("aws_appmesh_mesh", &resource.Sweeper{
		Name: "aws_appmesh_mesh",
		F:    testSweepAppmeshMeshes,
		Dependencies: []string{
			"aws_appmesh_virtual_service", // But no sweeper has been implemented
			"aws_appmesh_virtual_router",
			"aws_appmesh_virtual_node",
		},
	})
}

Expected Behavior

The aws_appmesh_mesh sweeper should run and log that the aws_appmesh_virtual_service dependent sweeper is missing.

Actual Behavior

A crash:

$ TEST=./aws SWEEP=us-west-2 SWEEPARGS=-sweep-run=aws_appmesh_mesh make sweep
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./aws -v -sweep=us-west-2 -sweep-run=aws_appmesh_mesh
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x101dfcc]

goroutine 1 [running]:
github.com/hashicorp/terraform-plugin-sdk/helper/resource.filterSweeperWithDependencies(0x5ebe9a8, 0x1c, 0xc00044c8a0, 0x10)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.0/helper/resource/testing.go:199 +0xcc
github.com/hashicorp/terraform-plugin-sdk/helper/resource.filterSweeperWithDependencies(0x5e6b37b, 0x10, 0xc00044c8a0, 0x10)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.0/helper/resource/testing.go:200 +0x1b0
github.com/hashicorp/terraform-plugin-sdk/helper/resource.filterSweepers(0x7ffd5e0e41c5, 0x10, 0xc00044c8a0, 0x1)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.0/helper/resource/testing.go:181 +0x226
github.com/hashicorp/terraform-plugin-sdk/helper/resource.TestMain(0xc0002b8a80)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.0/helper/resource/testing.go:105 +0x10b
github.com/terraform-providers/terraform-provider-aws/aws.TestMain(...)
	/home/kit/wrk/src/github.com/terraform-providers/terraform-provider-aws/aws/aws_sweeper_test.go:12
main.main()
	_testmain.go:7256 +0x136
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	0.033s
FAIL
GNUmakefile:17: recipe for target 'sweep' failed
make: *** [sweep] Error 1
@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants