test

package
v0.0.0-...-9823ec8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package test implements utility functions to help with API Gateway testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIntegration

func NewIntegration(cfg *Config, cb CmdBuilder, bb BackendBuilder) (*Runner, []TestCase, error)

Types

type BackendBuilder

type BackendBuilder interface {
	New(*Config) http.Server
}

type CmdBuilder

type CmdBuilder interface {
	New(*Config) *exec.Cmd
}

type Config

type Config struct {
	BinPath         string
	CfgPath         string
	SpecsPath       string
	EnvironPatterns string
	BackendPort     int
	Delay           time.Duration
	HttpClient      *http.Client
}

type Input

type Input struct {
	URL    string            `json:"url"`
	Method string            `json:"method"`
	Header map[string]string `json:"header"`
	Body   string            `json:"body"`
}

type Output

type Output struct {
	StatusCode int                 `json:"status_code"`
	Body       interface{}         `json:"body"`
	Header     map[string][]string `json:"header"`
}

type Runner

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

func (*Runner) Check

func (i *Runner) Check(tc TestCase) error

func (*Runner) Close

func (i *Runner) Close()

type TestCase

type TestCase struct {
	Name string `json:"name"`
	Err  string `json:"error"`
	In   Input  `json:"in"`
	Out  Output `json:"out"`
}

Jump to

Keyboard shortcuts

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