mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
41 lines
990 B
Go
41 lines
990 B
Go
package admin
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/argoproj/argo-cd/v3/test/e2e/fixture"
|
|
"github.com/argoproj/argo-cd/v3/test/e2e/fixture/admin/utils"
|
|
)
|
|
|
|
// this implements the "then" part of given/when/then
|
|
type Consequences struct {
|
|
context *Context
|
|
actions *Actions
|
|
}
|
|
|
|
func (c *Consequences) And(block func()) *Consequences {
|
|
c.context.t.Helper()
|
|
block()
|
|
return c
|
|
}
|
|
|
|
func (c *Consequences) AndCLIOutput(block func(output string, err error)) *Consequences {
|
|
c.context.t.Helper()
|
|
block(c.actions.lastOutput, c.actions.lastError)
|
|
return c
|
|
}
|
|
|
|
// For use after running export with the exported resources desirialized
|
|
func (c *Consequences) AndExportedResources(block func(resources *utils.ExportedResources, err error)) {
|
|
result, err := utils.GetExportedResourcesFromOutput(c.actions.lastOutput)
|
|
block(&result, err)
|
|
}
|
|
|
|
func (c *Consequences) Given() *Context {
|
|
return c.context
|
|
}
|
|
|
|
func (c *Consequences) When() *Actions {
|
|
time.Sleep(fixture.WhenThenSleepInterval)
|
|
return c.actions
|
|
}
|