Skip to content

Commit

Permalink
Add recover to fail datasource test on cty panic
Browse files Browse the repository at this point in the history
  • Loading branch information
nywilken committed Apr 21, 2023
1 parent d37ad45 commit 6e9ac44
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rpc/datasource_test.go
Expand Up @@ -66,6 +66,12 @@ func TestDatasource(t *testing.T) {
d.outputSpec = map[string]hcldec.Spec{
"foo": &hcldec.AttrSpec{Name: "foo", Type: cty.String, Required: false},
}

defer func() {
if r := recover(); r != nil {
t.Errorf("Call to ConfigSpec for datasource panicked: %v", r)
}
}()
spec := dsClient.OutputSpec()
if !reflect.DeepEqual(spec, d.outputSpec) {
t.Fatalf("unknown outputSpec value: %#v", spec)
Expand Down

0 comments on commit 6e9ac44

Please sign in to comment.