fixtures

package
v1.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Namespace  = "numaflow-system"
	Label      = "numaflow-e2e"
	LabelValue = "true"
	ISBSvcName = "numaflow-e2e"

	LogSourceVertexStarted    = "Start processing source messages"
	SinkVertexStarted         = "Start processing sink messages"
	LogUDFVertexStarted       = "Start processing udf messages"
	LogReduceUDFVertexStarted = "Start processing reduce udf messages"
	LogDaemonStarted          = "Daemon server started successfully"
)

Variables

View Source
var CheckPodKillSucceeded = func(t *testing.T, output string, err error) {
	assert.Contains(t, output, "deleted")
	assert.NoError(t, err)
}
View Source
var CheckVertexScaled = func(t *testing.T, output string, err error) {
	assert.Contains(t, output, "scaled")
	assert.NoError(t, err)
}
View Source
var OutputRegexp = func(rx string) func(t *testing.T, output string, err error) {
	return func(t *testing.T, output string, err error) {
		t.Helper()
		if assert.NoError(t, err, output) {
			assert.Regexp(t, rx, output)
		}
	}
}

Functions

func CreateKafkaTopic

func CreateKafkaTopic(topicName string, partitions int32)

func DaemonPodLogContains added in v0.5.4

func DaemonPodLogContains(ctx context.Context, kubeClient kubernetes.Interface, namespace, pipelineName, regex string, opts ...PodLogCheckOption) (bool, error)

func DeleteKafkaTopic

func DeleteKafkaTopic(topic string)

func Exec

func Exec(name string, args ...string) (string, error)

func ExpectKafkaTopicCount

func ExpectKafkaTopicCount(topic string, total int, timeout time.Duration)

func GenerateKafkaTopicName added in v1.3.0

func GenerateKafkaTopicName() string

func GetKafkaCount

func GetKafkaCount(topic string, count int) int

func GetMsgCountContains added in v0.7.0

func GetMsgCountContains(pipelineName, sinkName, targetStr string) int

GetMsgCountContains returns number of occurrences of the targetStr in redis that are written by pipelineName, sinkName.

func HTTPExpect

func HTTPExpect(t require.TestingT, baseURL string) *httpexpect.Expect

func InvokeE2EAPI

func InvokeE2EAPI(format string, args ...interface{}) string

func InvokeE2EAPIPOST

func InvokeE2EAPIPOST(format string, body string, args ...interface{}) string

func ListKafkaTopics added in v1.3.0

func ListKafkaTopics()

func PodPortForward

func PodPortForward(config *rest.Config, namespace, podName string, localPort, remotePort int, stopCh <-chan struct{}) error

func PodsLogContains

func PodsLogContains(ctx context.Context, kubeClient kubernetes.Interface, namespace, regex string, podList *corev1.PodList, opts ...PodLogCheckOption) bool

func PodsLogNotContains added in v0.5.3

func PodsLogNotContains(ctx context.Context, kubeClient kubernetes.Interface, namespace, regex string, podList *corev1.PodList, opts ...PodLogCheckOption) bool

func PumpJetstream added in v1.3.0

func PumpJetstream(streamName string, payload string, count int)

func PumpKafkaTopic

func PumpKafkaTopic(topic string, n int, opts ...interface{})

func PumpNatsSubject added in v0.7.0

func PumpNatsSubject(subject string, n int, opts ...interface{})

func RedisContains added in v0.7.0

func RedisContains(ctx context.Context, pipelineName, sinkName, targetStr string, opts ...SinkCheckOption) bool

RedisContains verifies that there are targetStr in redis written by pipelineName, sinkName.

func RedisNotContains added in v0.7.0

func RedisNotContains(ctx context.Context, pipelineName, sinkName, targetStr string, opts ...SinkCheckOption) bool

RedisNotContains verifies that there is no occurrence of targetStr in redis that is written by pipelineName, sinkName.

func SendMessage

func SendMessage(topic string, key string, message string, partition int)

func SendMessageTo added in v0.7.0

func SendMessageTo(host string, vertexName string, r HttpPostRequest)

SendMessageTo sends a http post request to a pod in http source vertex.

func VertexPodLogContains

func VertexPodLogContains(ctx context.Context, kubeClient kubernetes.Interface, namespace, pipelineName, vertexName, regex string, opts ...PodLogCheckOption) (bool, error)

func VertexPodLogNotContains added in v0.5.3

func VertexPodLogNotContains(ctx context.Context, kubeClient kubernetes.Interface, namespace, pipelineName, vertexName, regex string, opts ...PodLogCheckOption) (bool, error)

func WaitForDaemonPodsRunning added in v0.5.4

func WaitForDaemonPodsRunning(kubeClient kubernetes.Interface, namespace, pipelineName string, timeout time.Duration) error

func WaitForISBSvcReady

func WaitForISBSvcReady(ctx context.Context, isbSvcClient flowpkg.InterStepBufferServiceInterface, isbSvcName string, timeout time.Duration) error

func WaitForISBSvcStatefulSetReady

func WaitForISBSvcStatefulSetReady(ctx context.Context, kubeClient kubernetes.Interface, namespace, isbSvcName string, timeout time.Duration) error

func WaitForPipelineRunning

func WaitForPipelineRunning(ctx context.Context, pipelineClient flowpkg.PipelineInterface, pipelineName string, timeout time.Duration) error

func WaitForVertexPodRunning

func WaitForVertexPodRunning(kubeClient kubernetes.Interface, vertexClient flowpkg.VertexInterface, namespace, pipelineName, vertexName string, timeout time.Duration) error

func WaitForVertexPodScalingTo added in v0.7.3

func WaitForVertexPodScalingTo(kubeClient kubernetes.Interface, vertexClient flowpkg.VertexInterface, namespace, pipelineName, vertexName string, timeout time.Duration, size int) error

Types

type CheckFunc added in v0.7.0

type CheckFunc func() bool

type E2ESuite

type E2ESuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func (*E2ESuite) CheckError

func (s *E2ESuite) CheckError(err error)

func (*E2ESuite) Given

func (s *E2ESuite) Given() *Given

func (*E2ESuite) SetupSuite

func (s *E2ESuite) SetupSuite()

func (*E2ESuite) TearDownSuite

func (s *E2ESuite) TearDownSuite()

type Expect

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

func (*Expect) DaemonPodLogContains added in v0.5.4

func (t *Expect) DaemonPodLogContains(pipelineName, regex string, opts ...PodLogCheckOption) *Expect

func (*Expect) DaemonPodsRunning added in v0.5.4

func (t *Expect) DaemonPodsRunning() *Expect

func (*Expect) ISBSvcDeleted

func (t *Expect) ISBSvcDeleted(timeout time.Duration) *Expect

func (*Expect) SinkContains added in v0.7.0

func (t *Expect) SinkContains(sinkName string, targetStr string, opts ...SinkCheckOption) *Expect

func (*Expect) SinkNotContains added in v0.7.0

func (t *Expect) SinkNotContains(sinkName string, targetStr string, opts ...SinkCheckOption) *Expect

func (*Expect) VertexPodLogContains

func (t *Expect) VertexPodLogContains(vertexName, regex string, opts ...PodLogCheckOption) *Expect

func (*Expect) VertexPodLogNotContains added in v0.5.3

func (t *Expect) VertexPodLogNotContains(vertexName, regex string, opts ...PodLogCheckOption) *Expect

func (*Expect) VertexPodsRunning

func (t *Expect) VertexPodsRunning() *Expect

func (*Expect) VertexSizeScaledTo added in v0.7.3

func (t *Expect) VertexSizeScaledTo(v string, size int) *Expect

func (*Expect) When

func (t *Expect) When() *When

type Given

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

func (*Given) ISBSvc

func (g *Given) ISBSvc(text string) *Given

creates an ISBSvc based on the parameter, this may be:

1. A file name if it starts with "@" 2. Raw YAML.

func (*Given) Pipeline

func (g *Given) Pipeline(text string) *Given

creates a Pipeline based on the parameter, this may be:

1. A file name if it starts with "@" 2. Raw YAML.

func (*Given) When

func (g *Given) When() *When

func (*Given) WithPipeline

func (g *Given) WithPipeline(p *dfv1.Pipeline) *Given

type HttpPostRequest added in v0.7.0

type HttpPostRequest struct {
	Header map[string]string `json:"header"`
	Body   []byte            `json:"body"`
}

func NewHttpPostRequest added in v0.7.0

func NewHttpPostRequest() HttpPostRequest

NewHttpPostRequest constructor for HttpPostRequest

func (HttpPostRequest) WithBody added in v0.7.0

func (b HttpPostRequest) WithBody(body []byte) HttpPostRequest

func (HttpPostRequest) WithHeader added in v0.7.0

func (b HttpPostRequest) WithHeader(k, v string) HttpPostRequest

type PodLogCheckOption added in v0.5.3

type PodLogCheckOption func(*podLogCheckOptions)

func PodLogCheckOptionWithContainer added in v0.5.3

func PodLogCheckOptionWithContainer(c string) PodLogCheckOption

func PodLogCheckOptionWithCount added in v0.5.3

func PodLogCheckOptionWithCount(c int) PodLogCheckOption

func PodLogCheckOptionWithTimeout added in v0.5.3

func PodLogCheckOptionWithTimeout(t time.Duration) PodLogCheckOption

type SinkCheckOption added in v0.7.0

type SinkCheckOption func(*redisCheckOptions)

func SinkCheckWithContainCount added in v1.2.0

func SinkCheckWithContainCount(c int) SinkCheckOption

SinkCheckWithContainCount updates the redisCheckOptions to specify count. The count is the expected number of matches for the check.

func SinkCheckWithTimeout added in v1.2.0

func SinkCheckWithTimeout(t time.Duration) SinkCheckOption

SinkCheckWithTimeout updates the redisCheckOptions to specify timeout. The timeout specifies how long the redis check will wait for expected data to be ready in redis.

type When

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

func (*When) And

func (w *When) And(block func()) *When

func (*When) CreateISBSvc

func (w *When) CreateISBSvc() *When

func (*When) CreatePipelineAndWait

func (w *When) CreatePipelineAndWait() *When

func (*When) DaemonPodPortForward added in v0.5.4

func (w *When) DaemonPodPortForward(pipelineName string, localPort, remotePort int) *When

func (*When) DeleteISBSvc

func (w *When) DeleteISBSvc() *When

func (*When) DeletePipelineAndWait

func (w *When) DeletePipelineAndWait() *When

func (*When) Exec

func (w *When) Exec(name string, args []string, block func(t *testing.T, output string, err error)) *When

func (*When) Expect

func (w *When) Expect() *Expect

func (*When) Given

func (w *When) Given() *Given

func (*When) SendMessageTo added in v0.7.0

func (w *When) SendMessageTo(pipelineName string, vertexName string, req HttpPostRequest) *When

SendMessageTo sends msg to one of the pods in http source vertex.

func (*When) StreamVertexPodlogs added in v1.2.0

func (w *When) StreamVertexPodlogs(vertexName, containerName string) *When

func (*When) TerminateAllPodLogs added in v1.2.0

func (w *When) TerminateAllPodLogs() *When

func (*When) TerminateAllPodPortForwards

func (w *When) TerminateAllPodPortForwards() *When

func (*When) UXServerPodPortForward added in v1.1.0

func (w *When) UXServerPodPortForward(localPort, remotePort int) *When

func (*When) VertexPodPortForward

func (w *When) VertexPodPortForward(vertexName string, localPort, remotePort int) *When

func (*When) Wait

func (w *When) Wait(timeout time.Duration) *When

func (*When) WaitForISBSvcReady

func (w *When) WaitForISBSvcReady() *When

Jump to

Keyboard shortcuts

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