gateway_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: 23 Imported by: 2

README

Gateway integration tests

Gateway integration tests are a collection of the following tests:

  • Playground tests check if the playground is available through Gateway
  • Viewer tests check the correctness of the viewer mutation
  • Tenant Mapping Handler checks tenant separation
  • Compass Authentication checks different methods of access to Director via Gateway

Compass authentication test scenario

Director authentication test scenario consists of the following steps:

  • Get a Dex token, register the Integration System using this token, and request client credentials for the IntegrationSystem
  • Call Hydra for OAuth 2.0 access token with client_id and client_secret pair - https://github.com/kyma-incubator/examples/tree/master/ory-hydra/scenarios/client-credentials
  • Register an Application as the Integration System
  • Add example API Spec using issued OAuth2.0 Access token (as Integration System)
  • Try removing the Integration System
  • Remove Application using issued OAuth2.0 Access token (test if the token is still valid)
  • Remove IntegrationSystem as user (using JWT token from Dex)
  • Test if token granted for Integration System is invalid
  • Test if IntegrationSystem cannot fetch token

How to run test locally

To run the test locally, set these environment variables:

Name Description Default value
DIRECTOR_URL URL to Compass Director https://compass-gateway.kyma.local/director
USER_EMAIL Dex static user email admin@kyma.cx
USER_PASSWORD Dex static user password -
DEFAULT_TENANT Default tenant value 3e64ebae-38b5-46a0-b1ed-9ccee153a0ae
DOMAIN Kyma domain name kyma.local
GATEWAY_JWTSUBDOMAIN Default gateway for handling requests with a JWT compass-gateway
GATEWAY_CLIENT_CERTS_SUBDOMAIN Default gateway for handling requests with a certificate compass-gateway-mtls
GATEWAY_OAUTH20_SUBDOMAIN Default gateway for handling requests with an OAuth access token compass-gateway-auth-oauth

Then run go test ./... -count=1 -v inside the ./tests/director/gateway-integration directory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAPIToBundleWithInput

func AddAPIToBundleWithInput(t *testing.T, ctx context.Context, gqlClient *gcli.Client, bndlID, tenant string, input graphql.APIDefinitionInput) graphql.APIDefinitionExt

func CreateBundle

func CreateBundle(t *testing.T, ctx context.Context, gqlClient *gcli.Client, appID, tenant, bndlName string) graphql.BundleExt

func DeleteBundle

func DeleteBundle(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant, id string)

func GenerateOneTimeTokenForApplication

func GenerateOneTimeTokenForApplication(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, id string) graphql.OneTimeTokenForApplicationExt

func GenerateOneTimeTokenForRuntime

func GenerateOneTimeTokenForRuntime(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, runtimeID string) graphql.OneTimeTokenForRuntimeExt

func GetApplication

func GetApplication(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, id string) graphql.ApplicationExt

func GetRuntime

func GetRuntime(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, id string) graphql.RuntimeExt

func RegisterApplicationWithinTenant

func RegisterApplicationWithinTenant(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, in graphql.ApplicationRegisterInput) (graphql.ApplicationExt, error)

func RegisterRuntimeFromInputWithinTenant

func RegisterRuntimeFromInputWithinTenant(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, input *graphql.RuntimeInput) graphql.RuntimeExt

Runtime

func UnregisterApplication

func UnregisterApplication(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, applicationID string) graphql.ApplicationExt

func UnregisterRuntimeWithinTenant

func UnregisterRuntimeWithinTenant(t *testing.T, ctx context.Context, gqlClient *gcli.Client, tenant string, id string)

Types

type TestContext

type TestContext struct {
	Graphqlizer       graphqlizer.Graphqlizer
	GQLFieldsProvider graphqlizer.GqlFieldsProvider
}

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