Skip to content

Commit

Permalink
add bounday test
Browse files Browse the repository at this point in the history
  • Loading branch information
amyangfei committed May 8, 2019
1 parent 3ac8abf commit ca54fdb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ github.com/go-playground/overalls v0.0.0-20180201144345-22ec1a223b7c/go.mod h1:U
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE=
github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q=
github.com/pelletier/go-toml v1.3.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo=
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 h1:USx2/E1bX46VG32FIw034Au6seQ2fY9NEILmNh/UlQg=
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ=
github.com/pingcap/failpoint v0.0.0-20190409013401-009dadb318df h1:9WAfHlm1oCsql3Zqqn6CCNdhd+QH9RgY/D5CNG1MTpw=
github.com/pingcap/failpoint v0.0.0-20190409013401-009dadb318df/go.mod h1:fSV4Ot8ubP5ht+/gDFtEy7R0Oe7ddc4EhhbIA7QsY4c=
github.com/pingcap/failpoint v0.0.0-20190429160633-3abe504b0948 h1:syQfIQ2WZdTNz5kpja5c/1Rsh/mYltIwwpRV4b9ZKRI=
github.com/pingcap/failpoint v0.0.0-20190429160633-3abe504b0948/go.mod h1:fdAkVXuIXHAPZ7a280nj9bRORfK9NuSsOguvBH0+W6c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
16 changes: 16 additions & 0 deletions pkg/hello/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"sync"
"time"

"github.com/pingcap/failpoint"
)
Expand Down Expand Up @@ -63,3 +64,18 @@ func SubRoutineExit() {
}()
wg.Wait()
}

func Boundary() {
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
time.Sleep(time.Millisecond * 100)
}()
go func() {
fmt.Println("before sleep")
time.Sleep(time.Second * 300)
fmt.Println("after sleep")
}()
wg.Wait()
}
4 changes: 4 additions & 0 deletions pkg/hello/hello_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ func TestSubRoutineExit(t *testing.T) {

assert.Equal(t, got, 1)
}

func TestBoundary(t *testing.T) {
Boundary()
}

0 comments on commit ca54fdb

Please sign in to comment.