github.com/argoproj/argo-cd/v3@v3.2.1/test/e2e/fixture/admin/consequences.go (about) 1 package admin 2 3 import ( 4 "time" 5 6 "github.com/argoproj/argo-cd/v3/test/e2e/fixture" 7 "github.com/argoproj/argo-cd/v3/test/e2e/fixture/admin/utils" 8 ) 9 10 // this implements the "then" part of given/when/then 11 type Consequences struct { 12 context *Context 13 actions *Actions 14 } 15 16 func (c *Consequences) And(block func()) *Consequences { 17 c.context.t.Helper() 18 block() 19 return c 20 } 21 22 func (c *Consequences) AndCLIOutput(block func(output string, err error)) *Consequences { 23 c.context.t.Helper() 24 block(c.actions.lastOutput, c.actions.lastError) 25 return c 26 } 27 28 // For use after running export with the exported resources desirialized 29 func (c *Consequences) AndExportedResources(block func(resources *utils.ExportedResources, err error)) { 30 result, err := utils.GetExportedResourcesFromOutput(c.actions.lastOutput) 31 block(&result, err) 32 } 33 34 func (c *Consequences) Given() *Context { 35 return c.context 36 } 37 38 func (c *Consequences) When() *Actions { 39 time.Sleep(fixture.WhenThenSleepInterval) 40 return c.actions 41 }