aws-sdk-go: github.com/aws/aws-sdk-go/awstesting Index | Files | Directories

package awstesting

import "github.com/aws/aws-sdk-go/awstesting"

Index

Package Files

assert.go client.go custom_ca_bundle.go util.go

Variables

var (
    TLSBundleCA = []byte("" /* 942 byte string literal not displayed */)

    TLSBundleCert = []byte("" /* 792 byte string literal not displayed */)

    TLSBundleKey = []byte("" /* 889 byte string literal not displayed */)
)
Cert generation steps

# Create the CA key openssl genrsa -des3 -out ca.key 1024

# Create the CA Cert openssl req -new -sha256 -x509 -days 3650 \

-subj "/C=GO/ST=Gopher/O=Testing ROOT CA" \
-key ca.key -out ca.crt

# Create config cat > csr_details.txt <<-EOF

[req] default_bits = 1024 prompt = no default_md = sha256 req_extensions = SAN distinguished_name = dn

[ dn ] C=GO ST=Gopher O=Testing Certificate OU=Testing IP

[SAN] subjectAltName = IP:127.0.0.1 EOF

# Create certificate signing request openssl req -new -sha256 -nodes -newkey rsa:1024 \

-config <( cat csr_details.txt ) \
-keyout ia.key -out ia.csr

# Create a signed certificate openssl x509 -req -days 3650 \

-CAcreateserial \
-extfile <( cat csr_details.txt ) \
-extensions SAN \
-CA ca.crt -CAkey ca.key -in ia.csr -out ia.crt

# Verify openssl req -noout -text -in ia.csr openssl x509 -noout -text -in ia.crt

func AssertJSON Uses

func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool

AssertJSON verifies that the expect json string matches the actual.

func AssertQuery Uses

func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool

AssertQuery verifies the expect HTTP query string matches the actual.

func AssertURL Uses

func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool

AssertURL verifies the expected URL is matches the actual.

func AssertXML Uses

func AssertXML(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool

AssertXML verifies that the expect xml string matches the actual. Elements in actual must match the order they appear in expect to match equally

func CleanupTLSBundleFiles Uses

func CleanupTLSBundleFiles(files ...string) error

CleanupTLSBundleFiles takes variadic list of files to be deleted.

func CreateTLSBundleFiles Uses

func CreateTLSBundleFiles() (cert, key, ca string, err error)

CreateTLSBundleFiles returns the temporary filenames for the certificate key, and CA PEM content. These files should be deleted when no longer needed. CleanupTLSBundleFiles can be used for this cleanup.

func CreateTLSServer Uses

func CreateTLSServer(cert, key string, mux *http.ServeMux) (string, error)

CreateTLSServer will create the TLS server on an open port using the certificate and key. The address will be returned that the server is running on.

func DidPanic Uses

func DidPanic(fn func()) (bool, interface{})

DidPanic returns if the function paniced and returns true if the function paniced.

func Match Uses

func Match(t *testing.T, regex, expected string)

Match is a testing helper to test for testing error by comparing expected with a regular expression.

func NewClient Uses

func NewClient(cfgs ...*aws.Config) *client.Client

NewClient creates and initializes a generic service client for testing.

func PopEnv Uses

func PopEnv(env []string)

PopEnv takes the list of the environment values and injects them into the process's environment variable data. Clears any existing environment values that may already exist.

Deprecated: PopEnv exists for backward compatibility and may be removed from the future iterations. It is not `internal` so that if you really need to use its functionality, and understand breaking changes will be made, you are able to.

func SortedKeys Uses

func SortedKeys(m map[string]interface{}) []string

SortedKeys returns a sorted slice of keys of a map.

func SprintExpectActual Uses

func SprintExpectActual(expect, actual interface{}) string

SprintExpectActual returns a string for test failure cases when the actual value is not the same as the expected.

func StashEnv Uses

func StashEnv() []string

StashEnv stashes the current environment variables and returns an array of all environment values as key=val strings.

Deprecated: StashEnv exists for backward compatibility and may be removed from the future iterations. It is not `internal` so that if you really need to use its functionality, and understand breaking changes will be made, you are able to.

type FakeContext Uses

type FakeContext struct {
    Error  error
    DoneCh chan struct{}
}

A FakeContext provides a simple stub implementation of a Context

func (*FakeContext) Deadline Uses

func (c *FakeContext) Deadline() (deadline time.Time, ok bool)

Deadline always will return not set

func (*FakeContext) Done Uses

func (c *FakeContext) Done() <-chan struct{}

Done returns a read channel for listening to the Done event

func (*FakeContext) Err Uses

func (c *FakeContext) Err() error

Err returns the error, is nil if not set.

func (*FakeContext) Value Uses

func (c *FakeContext) Value(key interface{}) interface{}

Value ignores the Value and always returns nil

type ReadCloser Uses

type ReadCloser struct {
    Size   int
    Closed bool

    FillData func(bool, []byte, int, int)
    // contains filtered or unexported fields
}

ReadCloser is a io.ReadCloser for unit testing. Designed to test for leaks and whether a handle has been closed

func (*ReadCloser) Close Uses

func (r *ReadCloser) Close() error

Close sets Closed to true and returns no error

func (*ReadCloser) Read Uses

func (r *ReadCloser) Read(b []byte) (int, error)

Read will call FillData and fill it with whatever data needed. Decrements the size until zero, then return io.EOF.

type ZeroReader Uses

type ZeroReader struct{}

ZeroReader is a io.Reader which will always write zeros to the byte slice provided.

func (*ZeroReader) Read Uses

func (r *ZeroReader) Read(b []byte) (int, error)

Read fills the provided byte slice with zeros returning the number of bytes written.

Directories

PathSynopsis
mock
unitPackage unit performs initialization and validation for unit tests

Package awstesting imports 22 packages (graph) and is imported by 15 packages. Updated 2019-09-20. Refresh now. Tools for package owners.