|
|
@ -30,24 +30,44 @@ type MySuite struct{} |
|
|
|
|
|
|
|
|
|
|
|
var _ = Suite(&MySuite{}) |
|
|
|
var _ = Suite(&MySuite{}) |
|
|
|
|
|
|
|
|
|
|
|
func helloTask1() error { |
|
|
|
func helloTask1() <-chan error { |
|
|
|
fmt.Println("Hello task1") |
|
|
|
errCh := make(chan error) |
|
|
|
return nil |
|
|
|
go func() { |
|
|
|
|
|
|
|
defer close(errCh) |
|
|
|
|
|
|
|
println("Hello task1") |
|
|
|
|
|
|
|
errCh <- nil |
|
|
|
|
|
|
|
}() |
|
|
|
|
|
|
|
return errCh |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func helloTask2() error { |
|
|
|
func helloTask2() <-chan error { |
|
|
|
fmt.Println("Hello task2") |
|
|
|
errCh := make(chan error) |
|
|
|
return nil |
|
|
|
go func() { |
|
|
|
|
|
|
|
defer close(errCh) |
|
|
|
|
|
|
|
println("Hello task2") |
|
|
|
|
|
|
|
errCh <- nil |
|
|
|
|
|
|
|
}() |
|
|
|
|
|
|
|
return errCh |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func newJob1() error { |
|
|
|
func newJob1() <-chan error { |
|
|
|
fmt.Println("New Job1") |
|
|
|
errCh := make(chan error) |
|
|
|
return nil |
|
|
|
go func() { |
|
|
|
|
|
|
|
defer close(errCh) |
|
|
|
|
|
|
|
println("New Job1") |
|
|
|
|
|
|
|
errCh <- nil |
|
|
|
|
|
|
|
}() |
|
|
|
|
|
|
|
return errCh |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func newJob2() error { |
|
|
|
func newJob2() <-chan error { |
|
|
|
fmt.Println("New Job2") |
|
|
|
errCh := make(chan error) |
|
|
|
return nil |
|
|
|
go func() { |
|
|
|
|
|
|
|
defer close(errCh) |
|
|
|
|
|
|
|
println("New Job2") |
|
|
|
|
|
|
|
errCh <- nil |
|
|
|
|
|
|
|
}() |
|
|
|
|
|
|
|
return errCh |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestPQ(c *C) { |
|
|
|
func (s *MySuite) TestPQ(c *C) { |
|
|
|