testutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSchemaViolation = errors.New("JsonSchemaViolation")
View Source
var ErrTplDummyFailureError = errors.New("tpl dummy failure")

failure dummy

View Source
var TplDummy = &tplDummy{}
View Source
var TplDummyFailure = &tplDummyFailure{}

Functions

func CleanTestYaml

func CleanTestYaml(value string) string

Go doesnt have nice heredocs or <<~EOF things. this lets me not write ugly yaml blocks for test cases

func DisableLogging

func DisableLogging()

func DisableLoggingForTest

func DisableLoggingForTest(t *testing.T)

func JmesPathSearch

func JmesPathSearch(obj interface{}, searchPath string) interface{}

func JmesRequestMatcher

func JmesRequestMatcher(jmesMap map[string]interface{}) func(*awsmocker.ReceivedRequest) bool

func JmesSearchOrNil

func JmesSearchOrNil(obj interface{}, searchPath string) interface{}

func MockResponse_ECS_Service

func MockResponse_ECS_Service(service ecsTypes.Service) map[string]interface{}

func MockResponse_ELBv2_DescribeTargetGroups_Single

func MockResponse_ELBv2_DescribeTargetGroups_Single(tgName string) *awsmocker.MockedResponse

func MockResponse_EmptySuccess

func MockResponse_EmptySuccess() *awsmocker.MockedResponse

func MockSimpleStsProxy

func MockSimpleStsProxy(t *testing.T)

This is just a basic mock server to get the account ID and region

func Mock_EC2_DescribeSecurityGroups_Simple added in v0.2.0

func Mock_EC2_DescribeSecurityGroups_Simple() *awsmocker.MockedEndpoint

func Mock_EC2_DescribeSubnets_Simple added in v0.2.0

func Mock_EC2_DescribeSubnets_Simple() *awsmocker.MockedEndpoint

func Mock_ECS_CreateService_Generic added in v0.2.0

func Mock_ECS_CreateService_Generic() *awsmocker.MockedEndpoint

func Mock_ECS_CreateService_jmespath

func Mock_ECS_CreateService_jmespath(jmesMatchers map[string]any, service ecsTypes.Service) *awsmocker.MockedEndpoint

func Mock_ECS_DeleteService_jmespath

func Mock_ECS_DeleteService_jmespath(jmesMatchers map[string]any, service ecsTypes.Service) *awsmocker.MockedEndpoint

func Mock_ECS_DeregisterTaskDefinition

func Mock_ECS_DeregisterTaskDefinition(family string, rev int) *awsmocker.MockedEndpoint

params should be "dummy-task" and 1234 format

func Mock_ECS_DescribeServices_Missing

func Mock_ECS_DescribeServices_Missing(maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_DescribeServices_Single

func Mock_ECS_DescribeServices_Single(svc ecsTypes.Service, maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_DescribeServices_jmespath

func Mock_ECS_DescribeServices_jmespath(jmesMatches map[string]any, svc ecsTypes.Service, maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_DescribeTasks_Failure added in v0.2.0

func Mock_ECS_DescribeTasks_Failure(maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_DescribeTasks_Pending

func Mock_ECS_DescribeTasks_Pending(status string, maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_DescribeTasks_Stopped

func Mock_ECS_DescribeTasks_Stopped(stopCode ecsTypes.TaskStopCode, exitCode int, maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_ListTaskDefinitionFamilies

func Mock_ECS_ListTaskDefinitionFamilies(results []string) *awsmocker.MockedEndpoint

func Mock_ECS_ListTaskDefinitions

func Mock_ECS_ListTaskDefinitions(familyName string, revisions []int) *awsmocker.MockedEndpoint

func Mock_ECS_RegisterTaskDefinition_Generic

func Mock_ECS_RegisterTaskDefinition_Generic() *awsmocker.MockedEndpoint

func Mock_ECS_RunTask

func Mock_ECS_RunTask() *awsmocker.MockedEndpoint

func Mock_ECS_RunTask_FailToLaunch

func Mock_ECS_RunTask_FailToLaunch(maxCount int) *awsmocker.MockedEndpoint

func Mock_ECS_UpdateService_Generic added in v0.2.0

func Mock_ECS_UpdateService_Generic() *awsmocker.MockedEndpoint

func Mock_ECS_UpdateService_jmespath

func Mock_ECS_UpdateService_jmespath(jmesMatchers map[string]any, service ecsTypes.Service) *awsmocker.MockedEndpoint

func Mock_ELBv2_DescribeTargetGroups_Generic_Success added in v0.2.0

func Mock_ELBv2_DescribeTargetGroups_Generic_Success() *awsmocker.MockedEndpoint

func Mock_ELBv2_DescribeTargetGroups_Single_Failure

func Mock_ELBv2_DescribeTargetGroups_Single_Failure(tgName string) *awsmocker.MockedEndpoint

func Mock_ELBv2_DescribeTargetGroups_Single_Success

func Mock_ELBv2_DescribeTargetGroups_Single_Success(tgName string) *awsmocker.MockedEndpoint

func Mock_Events_DeleteRule

func Mock_Events_DeleteRule(ruleName, busName string) *awsmocker.MockedEndpoint

func Mock_Events_ListTargetsByRule

func Mock_Events_ListTargetsByRule(ruleName, busName string, targetIds []string) *awsmocker.MockedEndpoint

func Mock_Events_PutRule_Generic

func Mock_Events_PutRule_Generic() *awsmocker.MockedEndpoint

func Mock_Events_PutTargets_Generic

func Mock_Events_PutTargets_Generic() *awsmocker.MockedEndpoint

func Mock_Events_RemoveTargets

func Mock_Events_RemoveTargets(ruleName, busName, targetId string) *awsmocker.MockedEndpoint

func Mock_Logs_CreateLogGroup

func Mock_Logs_CreateLogGroup(logGroupName string) *awsmocker.MockedEndpoint

func Mock_Logs_CreateLogGroup_AllowAny

func Mock_Logs_CreateLogGroup_AllowAny() *awsmocker.MockedEndpoint

func Mock_Logs_CreateLogGroup_AlreadyExists added in v0.3.0

func Mock_Logs_CreateLogGroup_AlreadyExists(logGroupName string) *awsmocker.MockedEndpoint

func Mock_Logs_CreateLogGroup_Deny added in v0.3.0

func Mock_Logs_CreateLogGroup_Deny(logGroupName string) *awsmocker.MockedEndpoint

func Mock_Logs_DeleteRetentionPolicy

func Mock_Logs_DeleteRetentionPolicy(logGroupName string) *awsmocker.MockedEndpoint

func Mock_Logs_DescribeLogGroups

func Mock_Logs_DescribeLogGroups(logGroupRetentions map[string]int32) *awsmocker.MockedEndpoint

func Mock_Logs_DescribeLogGroups_Single added in v0.3.0

func Mock_Logs_DescribeLogGroups_Single(logGroupName string, retention int32) *awsmocker.MockedEndpoint

func Mock_Logs_PutRetentionPolicy

func Mock_Logs_PutRetentionPolicy(logGroupName string, days int32) *awsmocker.MockedEndpoint

func Mock_Logs_PutRetentionPolicy_AllowAny

func Mock_Logs_PutRetentionPolicy_AllowAny() *awsmocker.MockedEndpoint

func Mock_SSM_GetParametersByPath

func Mock_SSM_GetParametersByPath(prefixWithTrailingSlash string, paramNames []string) *awsmocker.MockedEndpoint

func Mock_SSM_GetParametersByPath_Advanced added in v0.3.0

func Mock_SSM_GetParametersByPath_Advanced(optFuncs ...func(*Mock_ECS_GetParametersByPathOpts)) *awsmocker.MockedEndpoint

func Mock_Scheduler_CreateSchedule added in v0.1.0

func Mock_Scheduler_CreateSchedule(groupName, scheduleName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_CreateScheduleGroup added in v0.1.0

func Mock_Scheduler_CreateScheduleGroup(groupName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_DeleteSchedule added in v0.1.0

func Mock_Scheduler_DeleteSchedule(groupName, scheduleName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_GetSchedule added in v0.1.0

func Mock_Scheduler_GetSchedule(groupName, scheduleName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_GetScheduleGroup added in v0.1.0

func Mock_Scheduler_GetScheduleGroup(groupName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_GetScheduleGroup_Missing added in v0.1.0

func Mock_Scheduler_GetScheduleGroup_Missing(groupName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_GetSchedule_Missing added in v0.1.0

func Mock_Scheduler_GetSchedule_Missing(groupName, scheduleName string) *awsmocker.MockedEndpoint

func Mock_Scheduler_ListSchedules added in v0.1.0

func Mock_Scheduler_ListSchedules(groupName string, schedules []MockListScheduleEntry) *awsmocker.MockedEndpoint

func Mock_Scheduler_UpdateSchedule added in v0.1.0

func Mock_Scheduler_UpdateSchedule(groupName, scheduleName string) *awsmocker.MockedEndpoint

func Mock_Tagging_GetResources

func Mock_Tagging_GetResources(typeFilter string, tags map[string]string, resourceArns any) *awsmocker.MockedEndpoint

resourceArns can be either a string array, or a map or key=>map[tagkey]=tagvalue

func RandomHex added in v0.3.0

func RandomHex(n int) string

func RequireObjectSerializationEqual

func RequireObjectSerializationEqual(t *testing.T, expected any, actual any)

func StartMocker

func StartMocker(t *testing.T, opts *awsmocker.MockerOptions) *awsmocker.MockerInfo

func StripIndentation

func StripIndentation(value string) string

func TemplateApply

func TemplateApply(tpl string, fields interface{}) string

Types

type MockListScheduleEntry added in v0.1.0

type MockListScheduleEntry struct {
	Name      string
	TargetArn string
	State     schedulerTypes.ScheduleState
}

type Mock_ECS_GetParametersByPathOpts added in v0.3.0

type Mock_ECS_GetParametersByPathOpts struct {
	MaxCount  int
	Path      string
	Names     []string
	NumParams int
	NextToken bool
}

type SchemaChecker

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

func NewSchemaChecker

func NewSchemaChecker(v any) *SchemaChecker

func (*SchemaChecker) CheckJSON

func (obj *SchemaChecker) CheckJSON(t *testing.T, val string) error

Validates that the JSON provided adheres to the Schema

func (*SchemaChecker) CheckYAML

func (obj *SchemaChecker) CheckYAML(t *testing.T, val string) error

Validates that the YAML provided adheres to the Schema (when converted to json)

Directories

Path Synopsis
mocks

Jump to

Keyboard shortcuts

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