Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ginkgoparallel_test
- import (
- "fmt"
- "math/rand"
- "time"
- g "github.com/onsi/ginkgo"
- )
- func init() {
- rand.Seed(time.Now().Unix())
- }
- type framework struct {
- namespace string
- }
- func (f *framework) BeforeEach() {
- f.namespace = fmt.Sprintf("ns-%d", rand.Int())
- }
- var _ = g.Describe("d1", func() {
- f := &framework{}
- g.BeforeEach(f.BeforeEach)
- g.AfterEach(func() {
- fmt.Printf("%s %s", g.CurrentGinkgoTestDescription().TestText, f.namespace)
- })
- makeTest := func(i int) {
- g.Describe(fmt.Sprintf("t%d", i), func() {
- g.It(fmt.Sprintf("should t%d", i), func() {
- fmt.Printf("NODE=%d\n", g.GinkgoParallelNode())
- })
- })
- }
- for i := 0; i < 20; i++ {
- makeTest(i)
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement