Files
deploy/test/e2e/fixture/project/consequences.go
0d2783075a test(e2e): add isolation by ensuring unique name (cherry-pick #25724 for 3.3) (#26287)
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Kanika Rana <[email protected]>
Signed-off-by: Kanika Rana <[email protected]>
Signed-off-by: Oliver Gondža <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Oliver Gondža <[email protected]>
2026-02-12 14:31:21 +02:00

50 lines
1.1 KiB
Go

package project
import (
"context"
"time"
"github.com/argoproj/argo-cd/v3/pkg/apiclient/project"
"github.com/argoproj/argo-cd/v3/test/e2e/fixture"
)
// this implements the "then" part of given/when/then
type Consequences struct {
context *Context
actions *Actions
}
func (c *Consequences) Expect() *Consequences {
return c
}
func (c *Consequences) And(block func(app *project.DetailedProjectsResponse, err error)) *Consequences {
c.context.T().Helper()
block(c.detailedProject())
return c
}
func (c *Consequences) detailedProject() (*project.DetailedProjectsResponse, error) {
prj, err := c.get()
return prj, err
}
func (c *Consequences) get() (*project.DetailedProjectsResponse, error) {
_, projectClient, _ := fixture.ArgoCDClientset.NewProjectClient()
prj, err := projectClient.GetDetailedProject(context.Background(), &project.ProjectQuery{
Name: c.context.GetName(),
})
return prj, err
}
func (c *Consequences) Given() *Context {
return c.context
}
func (c *Consequences) When() *Actions {
time.Sleep(fixture.WhenThenSleepInterval)
return c.actions
}