github.com/argoproj/argo-cd/v3@v3.2.1/test/e2e/fixture/admin/context.go (about) 1 package admin 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/argoproj/argo-cd/v3/test/e2e/fixture" 8 ) 9 10 // this implements the "given" part of given/when/then 11 type Context struct { 12 t *testing.T 13 } 14 15 func Given(t *testing.T) *Context { 16 t.Helper() 17 fixture.EnsureCleanState(t) 18 return GivenWithSameState(t) 19 } 20 21 func GivenWithSameState(t *testing.T) *Context { 22 t.Helper() 23 return &Context{t} 24 } 25 26 func (c *Context) And(block func()) *Context { 27 block() 28 return c 29 } 30 31 func (c *Context) When() *Actions { 32 time.Sleep(fixture.WhenThenSleepInterval) 33 return &Actions{context: c} 34 }