File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -558,7 +558,6 @@ func Test(t TestT, c TestCase) {
558558 // We require verbose mode so that the user knows what is going on.
559559 if ! testTesting && ! testing .Verbose () && ! c .IsUnitTest {
560560 t .Fatal ("Acceptance tests must be run with the -v flag on tests" )
561- return
562561 }
563562
564563 // get instances of all providers, so we can use the individual
Original file line number Diff line number Diff line change @@ -509,22 +509,26 @@ func TestTest_stepError(t *testing.T) {
509509
510510func TestTest_factoryError (t * testing.T ) {
511511 resourceFactoryError := fmt .Errorf ("resource factory error" )
512-
513512 factory := func () (terraform.ResourceProvider , error ) {
514513 return nil , resourceFactoryError
515514 }
516-
517515 mt := new (mockT )
518- Test (mt , TestCase {
519- ProviderFactories : map [string ]terraform.ResourceProviderFactory {
520- "test" : factory ,
521- },
522- Steps : []TestStep {
523- {
524- ExpectError : regexp .MustCompile ("resource factory error" ),
516+
517+ func () {
518+ defer func () {
519+ if r := recover (); r != nil {
520+ if ! strings .HasPrefix (r .(string ), "mockT" ) {
521+ panic (r )
522+ }
523+ }
524+ }()
525+ Test (mt , TestCase {
526+ ProviderFactories : map [string ]terraform.ResourceProviderFactory {
527+ "test" : factory ,
525528 },
526- },
527- })
529+ IsUnitTest : true ,
530+ })
531+ }()
528532
529533 if ! mt .failed () {
530534 t .Fatal ("test should've failed" )
@@ -751,6 +755,8 @@ func (t *mockT) Fatal(args ...interface{}) {
751755 t .FatalCalled = true
752756 t .FatalArgs = args
753757 t .f = true
758+
759+ panic ("mockT.Fatal" )
754760}
755761
756762func (t * mockT ) Parallel () {
You can’t perform that action at this time.
0 commit comments