testsupport

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOutput

func CaptureOutput(fn func()) string

func WaitForCondition

func WaitForCondition(t testing.TB, timeout time.Duration, cond func() bool, description string)

func WaitForEvent

func WaitForEvent(t testing.TB, ch <-chan *clientpb.Event, description string) *clientpb.Event

Types

type ClientHarness

type ClientHarness struct {
	Server  *clientcore.Server
	Console *clientcore.Console
	Conn    io.Closer
}

func NewClientHarness

func NewClientHarness(t testing.TB, h *ControlPlaneHarness) *ClientHarness

type ControlPlaneHarness

type ControlPlaneHarness struct {
	Address  string
	Admin    *mtls.ClientConfig
	Server   *grpc.Server
	Listener net.Listener
	// contains filtered or unexported fields
}

func NewControlPlaneHarness

func NewControlPlaneHarness(t testing.TB) *ControlPlaneHarness

func (*ControlPlaneHarness) Connect

func (*ControlPlaneHarness) ConnectWithConfig

func (h *ControlPlaneHarness) ConnectWithConfig(ctx context.Context, config *mtls.ClientConfig) (*grpc.ClientConn, error)

func (*ControlPlaneHarness) ControlHistory

func (h *ControlPlaneHarness) ControlHistory() []*clientpb.JobCtrl

func (*ControlPlaneHarness) FailNextCtrl

func (h *ControlPlaneHarness) FailNextCtrl(ctrl, name string, err error)

func (*ControlPlaneHarness) GetContext

func (h *ControlPlaneHarness) GetContext(id string) (*clientpb.Context, error)

func (*ControlPlaneHarness) GetPipeline

func (h *ControlPlaneHarness) GetPipeline(name, listenerID string) (*clientpb.Pipeline, error)

func (*ControlPlaneHarness) GetRuntimeSession

func (h *ControlPlaneHarness) GetRuntimeSession(sessionID string) (*clientpb.Session, error)

func (*ControlPlaneHarness) GetRuntimeTask

func (h *ControlPlaneHarness) GetRuntimeTask(sessionID string, taskID uint32) (*clientpb.Task, error)

func (*ControlPlaneHarness) GetSession

func (h *ControlPlaneHarness) GetSession(sessionID string) (*clientpb.Session, error)

func (*ControlPlaneHarness) GetWebContent

func (h *ControlPlaneHarness) GetWebContent(id string) (*clientpb.WebContent, error)

func (*ControlPlaneHarness) GetWebContents

func (h *ControlPlaneHarness) GetWebContents(name string) ([]*clientpb.WebContent, error)

func (*ControlPlaneHarness) GetWebsite

func (h *ControlPlaneHarness) GetWebsite(name string) (*clientpb.Pipeline, error)

func (*ControlPlaneHarness) JobExists

func (h *ControlPlaneHarness) JobExists(name, listenerID string) bool

func (*ControlPlaneHarness) ListenerID

func (h *ControlPlaneHarness) ListenerID() string

func (*ControlPlaneHarness) NewBindPipeline

func (h *ControlPlaneHarness) NewBindPipeline(t testing.TB, name string) *clientpb.Pipeline

func (*ControlPlaneHarness) NewHTTPPipeline

func (h *ControlPlaneHarness) NewHTTPPipeline(t testing.TB, name string) *clientpb.Pipeline

func (*ControlPlaneHarness) NewListenerClientConfig

func (h *ControlPlaneHarness) NewListenerClientConfig(t testing.TB, name string) *mtls.ClientConfig

func (*ControlPlaneHarness) NewREMPipeline

func (h *ControlPlaneHarness) NewREMPipeline(name, console string) *clientpb.Pipeline

func (*ControlPlaneHarness) NewTCPPipeline

func (h *ControlPlaneHarness) NewTCPPipeline(t testing.TB, name string) *clientpb.Pipeline

func (*ControlPlaneHarness) NewWebsitePipeline

func (h *ControlPlaneHarness) NewWebsitePipeline(name string, port uint32, root string) *clientpb.Pipeline

func (*ControlPlaneHarness) ReadWebsiteContent

func (h *ControlPlaneHarness) ReadWebsiteContent(websiteName, contentID string) ([]byte, error)

func (*ControlPlaneHarness) RuntimeKeepaliveEnabled

func (h *ControlPlaneHarness) RuntimeKeepaliveEnabled(sessionID string) (bool, error)

func (*ControlPlaneHarness) SeedCredentialContext

func (h *ControlPlaneHarness) SeedCredentialContext(t testing.TB, task *core.Task, target string, params map[string]string) *clientpb.Context

func (*ControlPlaneHarness) SeedDownloadContext

func (h *ControlPlaneHarness) SeedDownloadContext(t testing.TB, task *core.Task, fileName string, content []byte) *clientpb.Context

func (*ControlPlaneHarness) SeedPipeline

func (h *ControlPlaneHarness) SeedPipeline(t testing.TB, pipeline *clientpb.Pipeline, started bool) *clientpb.Pipeline

func (*ControlPlaneHarness) SeedSession

func (h *ControlPlaneHarness) SeedSession(t testing.TB, sessionID, pipelineName string, active bool) *core.Session

func (*ControlPlaneHarness) SeedTask

func (h *ControlPlaneHarness) SeedTask(t testing.TB, sess *core.Session, typ string) *core.Task

func (*ControlPlaneHarness) SeedWebsite

func (h *ControlPlaneHarness) SeedWebsite(t testing.TB, pipeline *clientpb.Pipeline, started bool) *clientpb.Pipeline

func (*ControlPlaneHarness) StartRealWebsite

func (h *ControlPlaneHarness) StartRealWebsite(t testing.TB, name string) string

StartRealWebsite reads a website's pipeline and content from DB, starts a real HTTP server on a random port, and returns the base URL. The server is stopped on test cleanup. This bridges the gap between the mock control plane and actual HTTP serving for full E2E verification.

func (*ControlPlaneHarness) WriteTempFile

func (h *ControlPlaneHarness) WriteTempFile(name string, content []byte) (string, error)

Jump to

Keyboard shortcuts

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