tests

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 77 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EdgeClientApiPath     = "/edge/client/v1"
	EdgeManagementApiPath = "/edge/management/v1"
)
View Source
const (
	ControllerConfFile         = "ats-ctrl.yml"
	EdgeRouterConfFile         = "ats-edge.router.yml"
	TunnelerEdgeRouterConfFile = "ats-edge-tunneler.router.yml"
	TransitRouterConfFile      = "ats-transit.router.yml"
)
View Source
const (
	FabricControllerConfFile = "./testdata/config/ctrl.yml"
	FabricRouterConfFile     = "./testdata/config/router-%v.yml"
)

Variables

View Source
var DefaultFormats strfmt.Registry = NewRegistry()

Functions

func B

func B(b bool) *bool

func I

func I(i int64) *int64

func IsURI

func IsURI(rawurl string) bool

func NewRegistry

func NewRegistry() strfmt.Registry

func NewVersionProviderTest

func NewVersionProviderTest() versions.VersionProvider

func S

func S(s string) *string

func ST

func ST(t time.Time) *strfmt.DateTime

ST returns a pointer to a strfmt.Date time. A helper function for creating rest_model types

func T

func T(t time.Time) *time.Time

func ToPtr

func ToPtr[T any](in T) *T

Types

type Config

type Config struct {
	Id           string
	ConfigTypeId string
	Name         string
	Data         map[string]interface{}
	Tags         map[string]interface{}
	// contains filtered or unexported fields
}

type FabricTestContext

type FabricTestContext struct {
	Req *require.Assertions

	LogLevel         string
	ControllerConfig *config.Config
	// contains filtered or unexported fields
}

func NewFabricTestContext

func NewFabricTestContext(t *testing.T) *FabricTestContext

func (*FabricTestContext) NewControlChannelListener

func (ctx *FabricTestContext) NewControlChannelListener() channel.UnderlayListener

func (*FabricTestContext) NewHttpClient

func (ctx *FabricTestContext) NewHttpClient(transport *http.Transport) *http.Client

func (*FabricTestContext) NewRestClient

func (ctx *FabricTestContext) NewRestClient(i id.Identity) *resty.Client

func (*FabricTestContext) NewRestClientWithDefaults

func (ctx *FabricTestContext) NewRestClientWithDefaults() *resty.Client

func (*FabricTestContext) NewTransport

func (ctx *FabricTestContext) NewTransport(i id.Identity) *http.Transport

func (*FabricTestContext) StartServer

func (ctx *FabricTestContext) StartServer()

func (*FabricTestContext) StartServerFor

func (ctx *FabricTestContext) StartServerFor(test string, clean bool)

func (*FabricTestContext) T

func (ctx *FabricTestContext) T() *testing.T

func (*FabricTestContext) Teardown

func (ctx *FabricTestContext) Teardown()

type JsonMarshallable

type JsonMarshallable interface {
	MarshalJSON() ([]byte, error)
}

type RestClient

type RestClient struct {
	*FabricTestContext
	// contains filtered or unexported fields
}

func (*RestClient) EnrollRouter

func (self *RestClient) EnrollRouter(id string, name string, certFile string)

type SessionRequest

type SessionRequest struct {
	ServiceId string `json:"serviceId"`
}

type TestConn

type TestConn struct {
	edge.Conn
	// contains filtered or unexported fields
}

func (*TestConn) ReadExpected

func (conn *TestConn) ReadExpected(expected string, timeout time.Duration)

func (*TestConn) ReadString

func (conn *TestConn) ReadString(maxSize int, timeout time.Duration) string

func (*TestConn) RequireClose

func (conn *TestConn) RequireClose()

func (*TestConn) WriteString

func (conn *TestConn) WriteString(val string, timeout time.Duration)

type TestContext

type TestContext struct {
	*require.Assertions
	ApiHost                string
	AdminAuthenticator     *updbAuthenticator
	AdminManagementSession *session
	AdminClientSession     *session

	EdgeController *server.Controller
	Req            *require.Assertions

	LogLevel         string
	ControllerConfig *config.Config
	// contains filtered or unexported fields
}

func GetTestContext

func GetTestContext() *TestContext

func NewTestContext

func NewTestContext(t *testing.T) *TestContext

func (*TestContext) CreateEnrollAndStartEdgeRouter

func (ctx *TestContext) CreateEnrollAndStartEdgeRouter(roleAttributes ...string)

func (*TestContext) CreateEnrollAndStartTunnelerEdgeRouter

func (ctx *TestContext) CreateEnrollAndStartTunnelerEdgeRouter(roleAttributes ...string)

func (*TestContext) DefaultClientApiClient

func (ctx *TestContext) DefaultClientApiClient() *resty.Client

func (*TestContext) DefaultManagementApiClient

func (ctx *TestContext) DefaultManagementApiClient() *resty.Client

func (*TestContext) EnrollIdentity

func (ctx *TestContext) EnrollIdentity(identityId string) *ziti.Config

func (*TestContext) NewClientComponents

func (ctx *TestContext) NewClientComponents(apiPath string) (*resty.Client, *http.Client, *http.Transport)

func (*TestContext) NewClientComponentsWithClientCert

func (ctx *TestContext) NewClientComponentsWithClientCert(cert *x509.Certificate, privateKey crypto.PrivateKey) (*resty.Client, *http.Client, *http.Transport)

func (*TestContext) NewHttpClient

func (ctx *TestContext) NewHttpClient(transport *http.Transport) *http.Client

func (*TestContext) NewRestClient

func (ctx *TestContext) NewRestClient(i idlib.Identity) *resty.Client

func (*TestContext) NewRestClientWithDefaults

func (ctx *TestContext) NewRestClientWithDefaults() *resty.Client

func (*TestContext) NewTransport

func (ctx *TestContext) NewTransport() *http.Transport

func (*TestContext) NewTransportWithClientCert

func (ctx *TestContext) NewTransportWithClientCert(cert *x509.Certificate, privateKey crypto.PrivateKey) *http.Transport

func (*TestContext) NewTransportWithIdentity

func (ctx *TestContext) NewTransportWithIdentity(i idlib.Identity) *http.Transport

func (*TestContext) NewWsMgmtChannel added in v0.31.1

func (ctx *TestContext) NewWsMgmtChannel(bindHandler channel.BindHandler) (channel.Channel, error)

func (*TestContext) RequireAdminClientApiLogin

func (ctx *TestContext) RequireAdminClientApiLogin()

func (*TestContext) RequireAdminManagementApiLogin

func (ctx *TestContext) RequireAdminManagementApiLogin()

func (*TestContext) RequireChildWith

func (ctx *TestContext) RequireChildWith(container *gabs.Container, attribute string, value interface{}) *gabs.Container

func (*TestContext) RequireGetNonNilPathValue

func (ctx *TestContext) RequireGetNonNilPathValue(container *gabs.Container, searchPath ...string) *gabs.Container

func (*TestContext) RequireNoChildWith

func (ctx *TestContext) RequireNoChildWith(container *gabs.Container, attribute string, value interface{}) *gabs.Container

func (*TestContext) RequireNotFoundError

func (ctx *TestContext) RequireNotFoundError(httpStatus int, body []byte) *gabs.Container

func (*TestContext) RequirePathExists

func (ctx *TestContext) RequirePathExists(container *gabs.Container, searchPath ...string)

func (*TestContext) StartServer

func (ctx *TestContext) StartServer()

func (*TestContext) StartServerFor

func (ctx *TestContext) StartServerFor(testDb string, clean bool)

func (*TestContext) T

func (ctx *TestContext) T() *testing.T

func (*TestContext) Teardown

func (ctx *TestContext) Teardown()

func (*TestContext) WrapConn

func (ctx *TestContext) WrapConn(conn edge.Conn, err error) *TestConn

func (*TestContext) WrapNetConn

func (ctx *TestContext) WrapNetConn(conn edge.Conn, err error) *TestConn

type VersionProviderTest

type VersionProviderTest struct {
}

func (VersionProviderTest) AsVersionInfo

func (v VersionProviderTest) AsVersionInfo() *versions.VersionInfo

func (VersionProviderTest) Branch

func (v VersionProviderTest) Branch() string

func (VersionProviderTest) BuildDate

func (v VersionProviderTest) BuildDate() string

func (VersionProviderTest) EncoderDecoder

func (v VersionProviderTest) EncoderDecoder() versions.VersionEncDec

func (VersionProviderTest) Revision

func (v VersionProviderTest) Revision() string

func (VersionProviderTest) Version

func (v VersionProviderTest) Version() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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