Back to godoc.org
github.com/apache/beam/sdks/go/pkg/beam/testing/ptest

package ptest

v2.22.0+incompatible
Latest Go to latest
Published: Jun 3, 2020 | License: Apache-2.0 | Module: github.com/apache/beam

Overview

Package ptest contains utilities for pipeline unit testing.

Index

Variables

var (
	Runner = flag.String("runner", "", "Pipeline runner.")
)

Runner is a flag that sets which runner pipelines under test will use.

The test file must have a TestMain that calls Main or MainWithDefault to function.

func Create

func Create(values []interface{}) (*beam.Pipeline, beam.Scope, beam.PCollection)

Create creates a pipeline and a PCollection with the given values.

func Create2

func Create2(a, b []interface{}) (*beam.Pipeline, beam.Scope, beam.PCollection, beam.PCollection)

Create2 creates a pipeline and 2 PCollections with the given values.

func CreateList

func CreateList(values interface{}) (*beam.Pipeline, beam.Scope, beam.PCollection)

CreateList creates a pipeline and a PCollection with the given values.

func CreateList2

func CreateList2(a, b interface{}) (*beam.Pipeline, beam.Scope, beam.PCollection, beam.PCollection)

CreateList2 creates a pipeline and 2 PCollections with the given values.

func Main

func Main(m *testing.M)

Main is an implementation of testing's TestMain to permit testing pipelines on runners other than the direct runner.

To enable this behavior, _ import the desired runner, and set the flag accordingly.

func TestMain(m *testing.M) {
	ptest.Main(m)
}

func MainWithDefault

func MainWithDefault(m *testing.M, runner string)

MainWithDefault is an implementation of testing's TestMain to permit testing pipelines on runners other than the direct runner, while setting the default runner to use.

func Run

func Run(p *beam.Pipeline) error

Run runs a pipeline for testing. The semantics of the pipeline is expected to be verified through passert.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier