util

package
v0.0.0-...-5984036 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNeverSynced = errors.New("never synced")

Functions

func AddToWorkspace

func AddToWorkspace(path string, tunnels []config.Tunnel) error

func TestWithRetry

func TestWithRetry(ctx context.Context, trigger chan struct{}, test func() bool) bool

Types

type ReadResult

type ReadResult struct {
	Bytes []byte
	Error error
}

type StreamReader

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

StreamReader provides convenience methods for reading from io streams.

func NewStreamReader

func NewStreamReader(stream io.Reader) StreamReader

NewStreamReader returns a new StreamReader

func (StreamReader) Read

func (sr StreamReader) Read(ctx context.Context) chan ReadResult

Read reads from the stream and sends the result on the channel.

func (StreamReader) ReadUntilTimeout

func (sr StreamReader) ReadUntilTimeout(ctx context.Context, timeout time.Duration) ([]byte, error)

ReadUntilTimeout reads from the stream until nothing new has been written in `timeout`.

type TestHelper

type TestHelper struct {
	KubeClient       kubernetes.Interface
	KeldaClient      keldaClientset.Interface
	User             config.User
	ExamplesRepoPath string
	CIRootPath       string
	// contains filtered or unexported fields
}

TestHelper contains methods commonly used during integration tests.

func NewTestHelper

func NewTestHelper(examplesRepoPath, ciRootPath string) (*TestHelper, error)

NewTestHelper creates a new TestHelper.

func (*TestHelper) Dev

func (helper *TestHelper) Dev(ctx context.Context, args ...string) (chan error, error)

Dev runs `kelda dev` with the given arguments, and waits until the development environment is ready for use.

func (*TestHelper) Exec

func (helper *TestHelper) Exec(service string, command []string) (string, error)

func (*TestHelper) MicroserviceTrigger

func (helper *TestHelper) MicroserviceTrigger() (chan struct{}, error)

MicroserviceTrigger returns a channel that triggers each time there's a change in the Microservice CRDs.

func (*TestHelper) Run

func (helper *TestHelper) Run(ctx context.Context, command ...string) ([]byte, error)

Run runs the given Kelda command, and returns its stdout.

func (*TestHelper) Start

func (helper *TestHelper) Start(ctx context.Context, args ...string) (
	io.Reader, chan error, error)

Start starts the given Kelda command. It returns a thread-safe reader for the stdout output, and a channel for obtaining any errors after starting the command, and any errors from starting the command.

func (*TestHelper) TunnelTrigger

func (helper *TestHelper) TunnelTrigger() (chan struct{}, error)

TunnelTrigger returns a channel that triggers each time there's a change in the Tunnel CRDs.

func (*TestHelper) WaitUntilReady

func (helper *TestHelper) WaitUntilReady(ctx context.Context) error

WaitUntilReady blocks until all the Tunnels and Microservices in the Workspace are ready.

func (*TestHelper) WaitUntilSynced

func (helper *TestHelper) WaitUntilSynced(ctx context.Context, servicePath string) error

WaitUntilSynced blocks until the local files in `servicePath` are running in the development environment.

func (*TestHelper) WatchForErrors

func (helper *TestHelper) WatchForErrors(ctx context.Context, t *testing.T)

WatchForErrors watches for any errors in development environment.

Jump to

Keyboard shortcuts

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