fixtures

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 44 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() string

func DaemonPodLogContains

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

func DeleteKafkaTopic

func DeleteKafkaTopic(topic string) string

func Exec

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

func ExpectKafkaTopicCount

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

func GetKafkaCount

func GetKafkaCount(topic string, count int) int

func GetMsgCountContains

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 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

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

func PumpKafkaTopic

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

func PumpNatsSubject

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

func RedisContains

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

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)

func SendMessageTo

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

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

func ValidateMessage

func ValidateMessage(topic string, key string, position int)

func VertexPodLogContains

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

func VertexPodLogNotContains

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

func WaitForDaemonPodsRunning

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 WaitForPipelineRunning

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

func WaitForPodToBeReady added in v0.0.5

func WaitForPodToBeReady(ctx context.Context, kubeClient kubernetes.Interface, timeout time.Duration, namespace, podName string, labelSelector string) error

func WaitForStatefulSetReady added in v0.0.2

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

func WaitForVertexPodRunning

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

func WaitForVertexPodScalingTo

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

Types

type CheckFunc

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) GetNumaflowServerPodName

func (s *E2ESuite) GetNumaflowServerPodName() string

func (*E2ESuite) Given

func (s *E2ESuite) Given() *Given

func (*E2ESuite) SetupSuite

func (s *E2ESuite) SetupSuite()

func (*E2ESuite) StartPortForward

func (s *E2ESuite) StartPortForward(podName string, port int) (stopPortForward func())

func (*E2ESuite) TearDownSuite

func (s *E2ESuite) TearDownSuite()

type Expect

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

func (*Expect) DaemonPodLogContains

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

func (*Expect) DaemonPodsRunning

func (t *Expect) DaemonPodsRunning() *Expect

func (*Expect) ISBSvcDeleted

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

func (*Expect) SinkContains

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

func (*Expect) SinkNotContains

func (t *Expect) SinkNotContains(sinkName string, targetStr string) *Expect

func (*Expect) VertexPodLogContains

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

func (*Expect) VertexPodLogNotContains

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

func (*Expect) VertexPodsRunning

func (t *Expect) VertexPodsRunning() *Expect

func (*Expect) VertexSizeScaledTo

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

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

func NewHttpPostRequest

func NewHttpPostRequest() HttpPostRequest

NewHttpPostRequest constructor for HttpPostRequest

func (HttpPostRequest) WithBody

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

func (HttpPostRequest) WithHeader

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

type PodLogCheckOption

type PodLogCheckOption func(*podLogCheckOptions)

func PodLogCheckOptionWithContainer

func PodLogCheckOptionWithContainer(c string) PodLogCheckOption

func PodLogCheckOptionWithCount

func PodLogCheckOptionWithCount(c int) PodLogCheckOption

func PodLogCheckOptionWithTimeout

func PodLogCheckOptionWithTimeout(t time.Duration) PodLogCheckOption

type SinkCheckOption

type SinkCheckOption func(*redisCheckOptions)

func WithContainCount

func WithContainCount(c int) SinkCheckOption

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

func WithTimeout

func WithTimeout(t time.Duration) SinkCheckOption

WithTimeout 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

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(argTimeout ...time.Duration) *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

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) TerminateAllPodPortForwards

func (w *When) TerminateAllPodPortForwards() *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

func (*When) WaitForPodReady added in v0.0.5

func (w *When) WaitForPodReady(podName string, labelSelector string) *When

func (*When) WaitForStatefulSetReady added in v0.0.2

func (w *When) WaitForStatefulSetReady(labelSelector string) *When

Jump to

Keyboard shortcuts

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