testserver

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package testserver provides fake Terramate Cloud endpoints for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableEndpoints added in v0.4.4

func DisableEndpoints(paths ...string) map[string]bool

DisableEndpoints the provided path endpoints.

func EnableAllConfig

func EnableAllConfig() map[string]bool

EnableAllConfig returns a map that enables all cloud endpoints.

func GetDeploymentLogs added in v0.4.4

func GetDeploymentLogs(store *cloudstore.Data, w http.ResponseWriter, _ *http.Request, p httprouter.Params)

GetDeploymentLogs is the GET /deployments/.../logs handler.

func GetDeploymentLogsEvents added in v0.4.4

func GetDeploymentLogsEvents(store *cloudstore.Data, w http.ResponseWriter, _ *http.Request, p httprouter.Params)

GetDeploymentLogsEvents is the SSE GET /deployments/.../logs handler.

func GetDeployments added in v0.4.4

func GetDeployments(store *cloudstore.Data, w http.ResponseWriter, _ *http.Request, p httprouter.Params)

GetDeployments is the GET /deployments handler.

func GetDrift added in v0.4.4

func GetDrift(store *cloudstore.Data, w http.ResponseWriter, _ *http.Request, params httprouter.Params)

GetDrift implements the /v1/drifts/:orguuid/:stackid/:driftid endpoint.

func GetDrifts added in v0.4.4

func GetDrifts(store *cloudstore.Data, w http.ResponseWriter, _ *http.Request, p httprouter.Params)

GetDrifts implements the GET /drifts/:orguuid endpoint. Note: this is not a real endpoint.

func GetMemberships added in v0.4.4

func GetMemberships(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetMemberships is the testserver GET /memberships handler.

func GetStackDrifts added in v0.4.4

func GetStackDrifts(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, params httprouter.Params)

GetStackDrifts implements the /v1/stacks/:orguuid/:stackid/drifts endpoint.

func GetStacks added in v0.4.4

func GetStacks(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, params httprouter.Params)

GetStacks is the GET /stacks handler.

func GetUsers added in v0.4.4

func GetUsers(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetUsers implements the /v1/users endpoint.

func GetWellKnown added in v0.4.4

func GetWellKnown(store *cloudstore.Data, w http.ResponseWriter, _ *http.Request, _ httprouter.Params)

GetWellKnown implements the /.well-known/cli.json endpoint.

func PatchDeployment added in v0.4.4

func PatchDeployment(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, p httprouter.Params)

PatchDeployment is the PATCH /deployments handler.

func PostDeployment added in v0.4.4

func PostDeployment(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, p httprouter.Params)

PostDeployment is the POST /deployments handler.

func PostDeploymentLogs added in v0.4.4

func PostDeploymentLogs(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, p httprouter.Params)

PostDeploymentLogs is the POST /deployments/.../logs handler.

func PostDrift added in v0.4.4

func PostDrift(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, p httprouter.Params)

PostDrift implements the POST /v1/drifts/:orguuid endpoint.

func PutStack added in v0.4.4

func PutStack(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, p httprouter.Params)

PutStack is the PUT /stacks handler.

func Router

func Router(store *cloudstore.Data) *httprouter.Router

Router returns the default fake cloud router.

func RouterAdd added in v0.4.2

func RouterAdd(store *cloudstore.Data, router *httprouter.Router, enabled map[string]bool)

RouterAdd enables endpoints in an existing router.

func RouterAddCustoms added in v0.4.2

func RouterAddCustoms(router *httprouter.Router, store *cloudstore.Data, custom Custom)

RouterAddCustoms add custom routes to the fake server. This is used by very specific test cases which requires injection of custom errors in the server.

func RouterWith

func RouterWith(store *cloudstore.Data, enabled map[string]bool) *httprouter.Router

RouterWith returns the testserver router configuration only for the enabled endpoints.

Types

type Custom added in v0.4.2

type Custom struct {
	Routes map[string]Route
}

Custom declares a custom server config.

type Handler added in v0.4.4

type Handler func(store *cloudstore.Data, w http.ResponseWriter, r *http.Request, p httprouter.Params)

Handler is the testserver handler interface.

type Route added in v0.4.2

type Route struct {
	Path    string
	Handler Handler
}

Route declares an HTTP route.

Directories

Path Synopsis
Package cloudstore provides the in-memory store used by the fake Terramate Cloud server.
Package cloudstore provides the in-memory store used by the fake Terramate Cloud server.
cmd
testserver
Package main implements the cloudmock service.
Package main implements the cloudmock service.

Jump to

Keyboard shortcuts

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