argo-cd/test/e2e/fixture/admin/consequences.go
Michael Crenshaw 0ec46f6857
chore(ci): upgrade golangci-lint to v2 (#22484)
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>
2025-03-27 12:37:52 -04:00

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
}