testkit

package
v0.0.0-...-5c79e43 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCSR

func CreateCSR(subjectRaw string, key *rsa.PrivateKey) ([]byte, error)

func CreateKey

func CreateKey() (*rsa.PrivateKey, error)

Types

type API

type API struct {
	TargetUrl        string          `json:"targetUrl"`
	Credentials      *Credentials    `json:"credentials,omitempty"`
	Spec             json.RawMessage `json:"spec,omitempty"`
	SpecificationUrl string          `json:"specificationUrl,omitempty"`
	ApiType          string          `json:"apiType"`
}

type ApiInfo

type ApiInfo struct {
	*RuntimeURLs
	ManagementInfoURL string `json:"infoUrl"`
	CertificatesUrl   string `json:"certificatesUrl"`
}

type Basic

type Basic struct {
	Username string    `json:"username"`
	Password string    `json:"password"`
	CSRFInfo *CSRFInfo `json:"csrfInfo,omitempty"`
}

type CSRFInfo

type CSRFInfo struct {
	TokenEndpointURL string `json:"tokenEndpointURL"`
}

type CertInfo

type CertInfo struct {
	Subject      string `json:"subject"`
	Extensions   string `json:"extensions"`
	KeyAlgorithm string `json:"key-algorithm"`
}

type CertificateGen

type CertificateGen struct {
	CommonName  string    `json:"commonName"`
	Certificate string    `json:"certificate"`
	CSRFInfo    *CSRFInfo `json:"csrfInfo,omitempty"`
}

type CompassClients

type CompassClients struct {
	DirectorClient  *CompassDirectorClient
	ConnectorClient *CompassConnectorClient
}

func InitCompassClients

func InitCompassClients(kymaClients KymaClients, state CompassDirectorClientState, domain string, skipSSLVerify bool) CompassClients

type CompassConnectorClient

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

func NewCompassConnectorClient

func NewCompassConnectorClient(skipTLSVerify bool) *CompassConnectorClient

func (*CompassConnectorClient) GenerateCertificateForToken

func (cc *CompassConnectorClient) GenerateCertificateForToken(token, connectorURL string) (tls.Certificate, error)

type CompassDirectorClient

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

func NewCompassDirectorClientOrDie

func NewCompassDirectorClientOrDie(coreClient *k8s.Clientset, state CompassDirectorClientState, domain string) *CompassDirectorClient

func (*CompassDirectorClient) GetApplication

func (dc *CompassDirectorClient) GetApplication(appID string) (graphql.ApplicationExt, error)

func (*CompassDirectorClient) GetOneTimeTokenForApplication

func (dc *CompassDirectorClient) GetOneTimeTokenForApplication(applicationID string) (graphql.OneTimeTokenForApplicationExt, error)

func (*CompassDirectorClient) RegisterApplication

func (*CompassDirectorClient) UnregisterApplication

func (dc *CompassDirectorClient) UnregisterApplication(id string) (graphql.ApplicationExt, error)

type CompassDirectorClientState

type CompassDirectorClientState interface {
	GetScenariosLabelKey() string
	GetDefaultTenant() string
	GetRuntimeID() string
	GetDexSecret() (string, string)
}

type ConnectorClient

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

func NewConnectorClient

func NewConnectorClient(appName string, tokenRequests connectiontokenhandlerclientset.TokenRequestInterface, httpClient *http.Client, logger logrus.FieldLogger) *ConnectorClient

func (*ConnectorClient) GetCertificate

func (cc *ConnectorClient) GetCertificate(url string, csr []byte) ([]*x509.Certificate, error)

func (*ConnectorClient) GetInfo

func (cc *ConnectorClient) GetInfo(url string) (*InfoResponse, error)

func (*ConnectorClient) GetToken

func (cc *ConnectorClient) GetToken(tenant, group string) (string, error)

type Credentials

type Credentials struct {
	Oauth          *Oauth          `json:"oauth,omitempty"`
	Basic          *Basic          `json:"basic,omitempty"`
	CertificateGen *CertificateGen `json:"certificateGen,omitempty"`
}

type CrtResponse

type CrtResponse struct {
	CRTChain  string `json:"crt"`
	ClientCRT string `json:"clientCrt"`
	CaCRT     string `json:"caCrt"`
}

type CsrRequest

type CsrRequest struct {
	Csr string `json:"csr"`
}

type DataStore

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

func NewDataStore

func NewDataStore(coreClient *kubernetes.Clientset, namespace string) *DataStore

func (DataStore) Destroy

func (ds DataStore) Destroy() error

func (DataStore) Load

func (ds DataStore) Load(key string) (string, error)

func (DataStore) Store

func (ds DataStore) Store(key, val string) error

type DocsObject

type DocsObject struct {
	Title  string `json:"title"`
	Type   string `json:"type"`
	Source string `json:"source"`
}

type Documentation

type Documentation struct {
	DisplayName string       `json:"displayName"`
	Description string       `json:"description"`
	Type        string       `json:"type"`
	Tags        []string     `json:"tags,omitempty"`
	Docs        []DocsObject `json:"docs,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Code     int    `json:"code"`
	ErrorMsg string `json:"error"`
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type EventSender

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

func NewEventSender

func NewEventSender(httpClient *http.Client, domain, application string) *EventSender

func (*EventSender) SendCloudEventToMesh

func (s *EventSender) SendCloudEventToMesh(ctx context.Context, event cloudevents.Event) (ct context.Context, evt *cloudevents.Event, err error)

func (*EventSender) SendEventToCompatibilityLayer

func (s *EventSender) SendEventToCompatibilityLayer(appName string, event *ExampleEvent) error

type Events

type Events struct {
	Spec json.RawMessage `json:"spec,omitempty"`
}

type ExampleEvent

type ExampleEvent struct {
	EventType        string    `json:"event-type"`
	EventTypeVersion string    `json:"event-type-version"`
	EventID          string    `json:"event-id"`
	EventTime        time.Time `json:"event-time"`
	Data             string    `json:"data"`
}

type InfoResponse

type InfoResponse struct {
	CertUrl     string   `json:"csrUrl"`
	Api         ApiInfo  `json:"api"`
	Certificate CertInfo `json:"certificate"`
}

type KymaClients

type KymaClients struct {
	AppOperatorClientset         *appoperatorclientset.Clientset
	AppBrokerClientset           *appbrokerclientset.Clientset
	CoreClientset                *k8s.Clientset
	Pods                         coreclient.PodInterface
	ServiceCatalogClientset      *servicecatalogclientset.Clientset
	ServiceBindingUsageClientset *sbuclientset.Clientset
	ApiRules                     dynamic.ResourceInterface
	Function                     dynamic.ResourceInterface
}

func InitKymaClients

func InitKymaClients(config *rest.Config, testID string) KymaClients

type LegacyRegistryClient

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

func NewLegacyRegistryClient

func NewLegacyRegistryClient(httpClient *http.Client) *LegacyRegistryClient

func (*LegacyRegistryClient) RegisterService

func (lrc *LegacyRegistryClient) RegisterService(url string, service *ServiceDetails) (string, error)

type Oauth

type Oauth struct {
	URL          string    `json:"url"`
	ClientID     string    `json:"clientId"`
	ClientSecret string    `json:"clientSecret"`
	CSRFInfo     *CSRFInfo `json:"csrfInfo,omitempty"`
}

type RegisterServiceResponse

type RegisterServiceResponse struct {
	ID string `json:"id"`
}

type RegistryClient

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

func NewRegistryClient

func NewRegistryClient(url string, httpClient resilient.HttpClient) *RegistryClient

func (*RegistryClient) DeleteService

func (rc *RegistryClient) DeleteService(id string) error

func (*RegistryClient) GetService

func (rc *RegistryClient) GetService(id string) (*ServiceDetails, error)

func (*RegistryClient) RegisterService

func (rc *RegistryClient) RegisterService(service *ServiceDetails) (string, error)

type RuntimeURLs

type RuntimeURLs struct {
	MetadataUrl string `json:"metadataUrl"`
	EventsUrl   string `json:"eventsUrl"`
}

type SendEvent

type SendEvent struct {
	State   SendEventState
	AppName string
	Payload string
}

type SendEventState

type SendEventState interface {
	GetEventSender() *EventSender
}

SendEventState represents SendEvent dependencies

type ServiceDetails

type ServiceDetails struct {
	Provider         string            `json:"provider"`
	Name             string            `json:"name"`
	Description      string            `json:"description"`
	ShortDescription string            `json:"shortDescription,omitempty"`
	Identifier       string            `json:"identifier,omitempty"`
	Labels           map[string]string `json:"labels,omitempty"`
	Api              *API              `json:"api,omitempty"`
	Events           *Events           `json:"events,omitempty"`
	Documentation    *Documentation    `json:"documentation,omitempty"`
}

type TestService

type TestService struct {
	HttpClient *http.Client
	// contains filtered or unexported fields
}

func NewTestService

func NewTestService(httpClient *http.Client, deployments appsclient.DeploymentInterface, services coreclient.ServiceInterface, apiRules dynamic.ResourceInterface, domain, namespace, testServiceImage string) *TestService

func (*TestService) CheckEventId

func (ts *TestService) CheckEventId(eventId string) error

func (*TestService) CreateTestService

func (ts *TestService) CreateTestService() error

func (*TestService) DeleteTestService

func (ts *TestService) DeleteTestService() error

func (*TestService) DumpAllReceivedEvents

func (ts *TestService) DumpAllReceivedEvents() error

DumpAllReceivedEvents returns an error containing all the received CloudEvents

func (*TestService) GetInClusterTestServiceURL

func (ts *TestService) GetInClusterTestServiceURL() string

func (*TestService) GetTestServiceURL

func (ts *TestService) GetTestServiceURL() string

func (*TestService) IsReady

func (ts *TestService) IsReady() error

func (*TestService) Reset

func (ts *TestService) Reset() error

func (*TestService) WaitForCounterPodToUpdateValue

func (ts *TestService) WaitForCounterPodToUpdateValue(val int) error

Jump to

Keyboard shortcuts

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