testutils

package
v0.0.0-...-45a9bcf Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testutils holds test utility functions

Package testutils holds test utility functions

Index

Constants

View Source
const (
	// IMDSSecurityCredentialsURL is the URL used by the IMDS tests
	IMDSSecurityCredentialsURL = "/latest/meta-data/iam/security-credentials/test"
	// AWSSecurityCredentialsAccessKeyIDTestValue is the AccessKeyID used by the IMDS tests
	AWSSecurityCredentialsAccessKeyIDTestValue = "ASIAIOSFODNN7EXAMPLE"
	// AWSSecurityCredentialsTypeTestValue is the AWS Credentials Type used by the IMDS tests
	AWSSecurityCredentialsTypeTestValue = "AWS-HMAC"
	// AWSSecurityCredentialsCodeTestValue is the AWS Credentials Code used by the IMDS tests
	AWSSecurityCredentialsCodeTestValue = "Success"
	// AWSSecurityCredentialsLastUpdatedTestValue is the AWS Credentials LastUpdated value used by the IMDS tests
	AWSSecurityCredentialsLastUpdatedTestValue = "2012-04-26T16:39:16Z"
	// AWSSecurityCredentialsExpirationTestValue is the AWS Credentials Expiration value used by the IMDS tests
	AWSSecurityCredentialsExpirationTestValue = "2324-05-01T12:00:00Z"
	// AWSIMDSServerTestValue is the IMDS Server used by the IMDS tests
	AWSIMDSServerTestValue = "EC2ws"
	// IMDSTestServerIP is the IMDS server IP used by the IMDS tests
	IMDSTestServerIP = "169.254.169.254"
	// IMDSTestServerCIDR is the IMDS server CIDR used by the IMDS tests
	IMDSTestServerCIDR = IMDSTestServerIP + "/32"
	// IMDSTestServerPort is the IMDS server port used by the IMDS tests
	IMDSTestServerPort = 8080
)
View Source
const (
	// CSMDummyInterface is the Dummy interface name used by the IMDS tests
	CSMDummyInterface = "dummy_csm"
)

Variables

This section is empty.

Functions

func CreateDummyInterface

func CreateDummyInterface(name string, cidr string) (*netlink.Dummy, error)

CreateDummyInterface creates a dummy interface and attaches it to the provided IP

func CreateIMDSServer

func CreateIMDSServer(addr string) *http.Server

CreateIMDSServer creates a fake IMDS server

func RemoveDummyInterface

func RemoveDummyInterface(link *netlink.Dummy) error

RemoveDummyInterface removes the provided dummy interface

func StopIMDSserver

func StopIMDSserver(server *http.Server) error

StopIMDSserver stops the provided server gracefully

Types

This section is empty.

Jump to

Keyboard shortcuts

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