testserver

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package testserver provides fake Terramate Cloud endpoints for testing purposes.

Index

Constants

View Source
const DefaultOrgUUID = "0000-1111-2222-3333"

DefaultOrgUUID is the test organization UUID.

Variables

This section is empty.

Functions

func EnableAllConfig

func EnableAllConfig() map[string]bool

EnableAllConfig returns a map that enables all cloud endpoints.

func Router

func Router() *httprouter.Router

Router returns the default fake cloud router.

func RouterAdd added in v0.4.2

func RouterAdd(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, 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(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 Route added in v0.4.2

type Route struct {
	Path    string
	Handler http.Handler
}

Route declares an HTTP route.

Directories

Path Synopsis
cmd
fakecloud
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