Remove parallel as that makes goroutines deadlock

pull/869/head
Dinesh Kumar 2019-08-02 18:00:16 +05:30 committed by Boyan Soubachov
parent 0d3c8ce9f8
commit e7b6c14305
1 changed files with 7 additions and 9 deletions

View File

@ -1,8 +1,10 @@
package suite
import (
"math/rand"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
@ -13,9 +15,7 @@ type CallOrderSuite struct {
}
func (s *CallOrderSuite) call(method string) {
// s.Mutex.Lock()
// defer s.Mutex.Unlock()
time.Sleep(time.Duration(rand.Intn(300)) * time.Millisecond)
s.callOrder = append(s.callOrder, method)
}
@ -28,10 +28,9 @@ func (s *CallOrderSuite) SetupSuite() {
func (s *CallOrderSuite) TearDownSuite() {
s.call("TearDownSuite")
assert.Equal(s.T(), "SetupSuite;SetupTest;Test A;TearDownTest;TearDownSuite", strings.Join(s.callOrder, ";"))
assert.Equal(s.T(), "SetupSuite;SetupTest;Test A;TearDownTest;SetupTest;Test B;TearDownTest;TearDownSuite", strings.Join(s.callOrder, ";"))
}
func (s *CallOrderSuite) SetupTest() {
s.T().Parallel()
s.call("SetupTest")
}
@ -43,7 +42,6 @@ func (s *CallOrderSuite) Test_A() {
s.call("Test A")
}
//func (s *CallOrderSuite) Test_B() {
// time.Sleep(time.Second)
// s.call("Test B")
//}
func (s *CallOrderSuite) Test_B() {
s.call("Test B")
}