session

package
v3.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct {
	// contains filtered or unexported fields
}

Actions implements the "when" part of given/when/then for session/logout tests.

func (*Actions) GetUserInfo

func (a *Actions) GetUserInfo(tokenName string) *Actions

GetUserInfo calls "argocd account get-user-info" using the named token.

func (*Actions) ListAccounts

func (a *Actions) ListAccounts(tokenName string) *Actions

ListAccounts calls "argocd account list" using the named token.

func (*Actions) ListApplications

func (a *Actions) ListApplications(tokenName string) *Actions

ListApplications calls "argocd app list" using the named token.

func (*Actions) ListProjects

func (a *Actions) ListProjects(tokenName string) *Actions

ListProjects calls "argocd proj list" using the named token.

func (*Actions) ListRepositories

func (a *Actions) ListRepositories(tokenName string) *Actions

ListRepositories calls "argocd repo list" using the named token.

func (*Actions) Login

func (a *Actions) Login(tokenName string) *Actions

Login creates a new session as admin using the argocd CLI login command. Each token name gets its own isolated config file so multiple sessions can coexist without interfering with each other.

func (*Actions) LoginWithSSO

func (a *Actions) LoginWithSSO(tokenName string) *Actions

LoginWithSSO mints an OIDC token directly from the shared mock OIDC server, bypassing the normal browser-based SSO flow. Each call creates a unique user identity based on tokenName so multiple SSO sessions produce different tokens. This exercises the IDP token verification and revocation code path in SessionManager.VerifyToken.

func (*Actions) Logout

func (a *Actions) Logout(tokenName string) *Actions

Logout revokes the named token using the argocd CLI logout command. This triggers the full CLI logout flow including server-side token revocation.

func (*Actions) Sleep

func (a *Actions) Sleep(d time.Duration) *Actions

Sleep pauses execution for the given duration.

func (*Actions) Then

func (a *Actions) Then() *Consequences

func (*Actions) WithDirectOIDC

func (a *Actions) WithDirectOIDC() *Actions

WithDirectOIDC configures ArgoCD with oidc.config pointing directly to a shared mock OIDC server (bypassing Dex). Tests using this setup should use LoginWithSSO to mint OIDC tokens programmatically. This exercises the IDP token verification and revocation code path in SessionManager.VerifyToken.

type Consequences

type Consequences struct {
	// contains filtered or unexported fields
}

Consequences implements the "then" part of given/when/then for session/logout tests.

func (*Consequences) ActionShouldFail

func (c *Consequences) ActionShouldFail(block func(err error)) *Consequences

ActionShouldFail asserts that the last action returned an error and passes it to the callback for further inspection.

func (*Consequences) ActionShouldSucceed

func (c *Consequences) ActionShouldSucceed() *Consequences

ActionShouldSucceed asserts that the last action completed without error.

func (*Consequences) AndCLIOutput

func (c *Consequences) AndCLIOutput(block func(output string, err error)) *Consequences

AndCLIOutput passes the CLI output and error from the last action to the callback for custom assertions.

func (*Consequences) Given

func (c *Consequences) Given() *Context

Given returns the Context to allow chaining back to setup.

func (*Consequences) When

func (c *Consequences) When() *Actions

When returns the Actions to allow chaining back to actions.

type Context

type Context struct {
	*fixture.TestState
}

Context implements the "given" part of given/when/then for session/logout tests.

func Given

func Given(t *testing.T) *Context

func GivenWithSameState

func GivenWithSameState(ctx fixture.TestContext) *Context

GivenWithSameState creates a new Context that shares the same TestState as an existing context.

func (*Context) When

func (c *Context) When() *Actions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL