Documentation ¶
Overview ¶
Package tests contains tests for go-orb/plugins/client/*.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ServiceName = types.ServiceName("org.orb.svc.service") DefaultRequests = []TestRequest{ { Name: "32byte", Endpoint: "echo.Streams/Call", Request: &proto.CallRequest{ Name: "32byte", }, Response: &proto.CallResponse{ Msg: "", }, URL: "t", }, { Name: "default codec with URL", Endpoint: "echo.Streams/Call", Request: &proto.CallRequest{ Name: "Alex", }, Response: &proto.CallResponse{ Msg: "Hello Alex", }, URL: "t", }, { Name: "default codec", Endpoint: "echo.Streams/Call", Request: &proto.CallRequest{ Name: "Alex", }, Response: &proto.CallResponse{ Msg: "Hello Alex", }, }, { Name: "proto", Endpoint: "echo.Streams/Call", ContentType: "application/x-protobuf", Request: &proto.CallRequest{ Name: "Alex", }, Response: &proto.CallResponse{ Msg: "Hello Alex", }, }, { Name: "json", Endpoint: "echo.Streams/Call", ContentType: "application/json", Request: &proto.CallRequest{ Name: "Alex", }, Response: &proto.CallResponse{ Msg: "Hello Alex", }, }, { Name: "error request", Endpoint: "echo.Streams/Call", Error: true, Request: &proto.CallRequest{ Name: "error", }, Response: &proto.CallResponse{ Msg: "Hello Alex", }, }, } )
Functions ¶
This section is empty.
Types ¶
type PackageRunner ¶
type PackageRunner struct {
// contains filtered or unexported fields
}
PackageRunner builds and runs go packages.
func NewPackageRunner ¶
func NewPackageRunner(logger log.Logger, packagePath string, binaryPath string, opts ...PackageRunnerOption) *PackageRunner
NewPackageRunner creates a new package runner.
func (*PackageRunner) Build ¶
func (p *PackageRunner) Build() error
Build makes a binary from the package.
func (*PackageRunner) Start ¶
func (p *PackageRunner) Start() error
Start runs the binary build with Build().
type PackageRunnerOption ¶
type PackageRunnerOption func(*PackageRunnerOptions)
PackageRunnerOption is a option, see below.
func WithNumProcesses ¶
func WithNumProcesses(n int) PackageRunnerOption
WithNumProcesses set's the number of parallel processes to start.
func WithRunEnv ¶
func WithRunEnv(n ...string) PackageRunnerOption
WithRunEnv sets environment variables in the form of KEY=VAR.
func WithStdErr ¶
func WithStdErr(n io.Writer) PackageRunnerOption
WithStdErr sets where to write stderr.
func WithStdOut ¶
func WithStdOut(n io.Writer) PackageRunnerOption
WithStdOut sets where to write stdout.
type PackageRunnerOptions ¶
type PackageRunnerOptions struct { OverWrite bool StdOut io.Writer StdErr io.Writer RunEnv []string Args []string NumProcesses int }
PackageRunnerOptions contains the options.
type TestRequest ¶
type TestRequest struct { Name string Service string Endpoint string // PreferredTransports overwrites the list of preferred transports. PreferredTransports []string // ContentType overwrites the client's content-type. ContentType string // URL when set bypasses the registry. URL string // Expect an error? Error bool Request any Response any }
TestRequest contains all informations to run a test request.
type TestSuite ¶
type TestSuite struct { suite.Suite // Transports is the list of preferred transports for all requests Transports []string // Requests is the requests to make. Requests []TestRequest // contains filtered or unexported fields }
TestSuite runs a bunch of tests.
func NewSuite ¶
func NewSuite(_ string, transports []string, requests ...TestRequest) *TestSuite
NewSuite creates a new test suite.
func (*TestSuite) TearDownSuite ¶
func (s *TestSuite) TearDownSuite()
TearDownSuite runs after all tests.
func (*TestSuite) TestFailingAuthorization ¶
func (s *TestSuite) TestFailingAuthorization()
TestFailingAuthorization tests an authorization call that must fail.
func (*TestSuite) TestMetadata ¶
func (s *TestSuite) TestMetadata()
TestMetadata checks if metadata gets transported over the wire.
func (*TestSuite) TestResolveServiceTransport ¶
func (s *TestSuite) TestResolveServiceTransport()
TestResolveServiceTransport checks if the right transport has been selected.
func (*TestSuite) TestRunRequests ¶
func (s *TestSuite) TestRunRequests()
TestRunRequests makes the configured requests.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
tests_server
Package main contains a server for running tests on.
|
Package main contains a server for running tests on. |
Package handler provdes a test handler.
|
Package handler provdes a test handler. |
Package proto ...
|
Package proto ... |