Files
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

38 lines
925 B
Go

package admin
import (
"testing"
"time"
"github.com/argoproj/argo-cd/v3/test/e2e/fixture"
)
// Context implements the "given" part of given/when/then.
// It embeds fixture.TestState to provide test-specific state that enables parallel test execution.
type Context struct {
*fixture.TestState
}
func Given(t *testing.T) *Context {
t.Helper()
state := fixture.EnsureCleanState(t)
return &Context{TestState: state}
}
// GivenWithSameState creates a new Context that shares the same TestState as an existing context.
// Use this when you need multiple fixture contexts within the same test.
func GivenWithSameState(ctx fixture.TestContext) *Context {
ctx.T().Helper()
return &Context{TestState: fixture.NewTestStateFromContext(ctx)}
}
func (c *Context) And(block func()) *Context {
block()
return c
}
func (c *Context) When() *Actions {
time.Sleep(fixture.WhenThenSleepInterval)
return &Actions{context: c}
}