external_services_mock_integration

package
v0.0.0-...-0e91422 Latest Latest
Warning

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

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

README

External Services Mock integration tests

External Services Mock tests check a contract between Compass and external services.

The tests cover the following scenarios:

  • Audit log scenario
  • API specification scenario

Audit log test scenario

The audit log test performs the following operations:

  1. Register an application through the Compass Gateway.
  2. Get an audit log from the mock service based on the application's name
  3. Compare the audit log with the request for registering the application.

API specification scenario

The API specification test uses the endpoint that returns a random API specification on every call. It performs the following operations:

  1. Register an API Definition with a fetch request.
  2. Fetch the API specification.
  3. Refetch the API specification and check if it is different from the previous one.
  4. Get the API Definition and check if the API specification is equal to the new one.

Development

To run the test locally, set these environment variables:

Environment variable Description Default value
DIRECTOR_URL URL to the Director https://compass-gateway.kyma.local/director
USER_EMAIL Dex static user email admin@kyma.cx
USER_PASSWORD Dex static user password None
DEFAULT_TENANT Default tenant value 3e64ebae-38b5-46a0-b1ed-9ccee153a0ae
DOMAIN Kyma domain name kyma.local
EXTERNAL_SERVICES_MOCK_BASE_URL URL to External Services Mock None
APP_CLIENT_SECRET The expected audit log client Secret used to obtain a JWT client_secret
APP_CLIENT_ID The expected audit log client ID used to obtain a JWT client_id
BASIC_USERNAME The expected username from basic credentials admin
BASIC_PASSWORD The expected password from basic credentials admin

After specyfing the environment variables, run go test ./... -count=1 -v inside the ./tests/director/external-services-mock-integration directory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestContext

type TestContext struct {
	Graphqlizer graphqlizer.Graphqlizer
	// contains filtered or unexported fields
}

TestContext contains dependencies that help executing tests

func NewTestContext

func NewTestContext() (*TestContext, error)

func (*TestContext) RunOperationWithCustomTenant

func (tc *TestContext) RunOperationWithCustomTenant(ctx context.Context, cli *gcli.Client, tenant string, req *gcli.Request, resp interface{}) error

Jump to

Keyboard shortcuts

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