Package awstesting
Overview ▹
Index ▹
Variables
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
var ( // TLSBundleCA ca.crt TLSBundleCA = []byte(`-----BEGIN CERTIFICATE----- MIICiTCCAfKgAwIBAgIJAJ5X1olt05XjMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD QTAeFw0xNzAzMDkwMDAyMDZaFw0yNzAzMDcwMDAyMDZaMDgxCzAJBgNVBAYTAkdP MQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBDQTCBnzAN BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw/8DN+t9XQR60jx42rsQ2WE2Dx85rb3n GQxnKZZLNddsT8rDyxJNP18aFalbRbFlyln5fxWxZIblu9Xkm/HRhOpbSimSqo1y uDx21NVZ1YsOvXpHby71jx3gPrrhSc/t/zikhi++6D/C6m1CiIGuiJ0GBiJxtrub UBMXT0QtI2ECAwEAAaOBmjCBlzAdBgNVHQ4EFgQU8XG3X/YHBA6T04kdEkq6+4GV Yykw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ibAB+S zssmrkdYYvn9aUhjc3XK3tjAoDpsPpeBeTBamuUKDHoH/dNRXxerZ8vu6uPR3Pgs 5v/KCV6IAEcvNyOXMPo= -----END CERTIFICATE----- `) // TLSBundleKey ai.key TLSBundleKey = []byte(`-----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQDdYVh3oqKP5wEr2648AkM1wolohMxpMN+dzcbAAeePzagy9y1z QE7YkibvJCQa5gIddiBS7Vixl4xo42JR20FpzkemsL3nl50GbpCckVoe5v0JbfR6 NAoGRNVPvN9mnORllZXTcVtS8+CPlvf3oc6nvCPNEUunixCn1BVxolvvUQIDAQAB AoGBAMISrcirddGrlLZLLrKC1ULS2T0cdkqdQtwHYn4+7S5+/z42vMx1iumHLsSk rVY7X41OWkX4trFxhvEIrc/O48bo2zw78P7flTxHy14uxXnllU8cLThE29SlUU7j AVBNxJZMsXMlS/DowwD4CjFe+x4Pu9wZcReF2Z9ntzMpySABAkEA+iWoJCPE2JpS y78q3HYYgpNY3gF3JqQ0SI/zTNkb3YyEIUffEYq0Y9pK13HjKtdsSuX4osTIhQkS +UgRp6tCAQJBAOKPYTfQ2FX8ijgUpHZRuEAVaxASAS0UATiLgzXxLvOh/VC2at5x wjOX6sD65pPz/0D8Qj52Cq6Q1TQ+377SDVECQAIy0od+yPweXxvrUjUd1JlRMjbB TIrKZqs8mKbUQapw0bh5KTy+O1elU4MRPS3jNtBxtP25PQnuSnxmZcFTgAECQFzg DiiFcsn9FuRagfkHExMiNJuH5feGxeFaP9WzI144v9GAllrOI6Bm3JNzx2ZLlg4b 20Qju8lIEj6yr6JYFaECQHM1VSojGRKpOl9Ox/R4yYSA9RV5Gyn00/aJNxVYyPD5 i3acL2joQm2kLD/LO8paJ4+iQdRXCOMMIpjxSNjGQjQ= -----END RSA PRIVATE KEY----- `) )
func AssertJSON ¶
func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool
AssertJSON verifies that the expect json string matches the actual.
func AssertQuery ¶
func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool
AssertQuery verifies the expect HTTP query string matches the actual.
func AssertURL ¶
func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool
AssertURL verifies the expected URL is matches the actual.
func AssertXML ¶
func AssertXML(t *testing.T, expect, actual string, container interface{}, msgAndArgs ...interface{}) bool
AssertXML verifies that the expect xml string matches the actual.
func CleanupTLSBundleFiles ¶
func CleanupTLSBundleFiles(files ...string) error
CleanupTLSBundleFiles takes variadic list of files to be deleted.
func CreateTLSBundleFiles ¶
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 ¶
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 Match ¶
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 ¶
func NewClient(cfgs ...*aws.Config) *client.Client
NewClient creates and initializes a generic service client for testing.
func PopEnv ¶
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.
func SortedKeys ¶
func SortedKeys(m map[string]interface{}) []string
SortedKeys returns a sorted slice of keys of a map.
func SprintExpectActual ¶
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 ¶
func StashEnv() []string
StashEnv stashes the current environment variables and returns an array of all environment values as key=val strings.
type FakeContext ¶
A FakeContext provides a simple stub implementation of a Context
type FakeContext struct { Error error DoneCh chan struct{} }
func (*FakeContext) Deadline ¶
func (c *FakeContext) Deadline() (deadline time.Time, ok bool)
Deadline always will return not set
func (*FakeContext) Done ¶
func (c *FakeContext) Done() <-chan struct{}
Done returns a read channel for listening to the Done event
func (*FakeContext) Err ¶
func (c *FakeContext) Err() error
Err returns the error, is nil if not set.
func (*FakeContext) Value ¶
func (c *FakeContext) Value(key interface{}) interface{}
Value ignores the Value and always returns nil
type ReadCloser ¶
ReadCloser is a io.ReadCloser for unit testing. Designed to test for leaks and whether a handle has been closed
type ReadCloser struct {
Size int
Closed bool
FillData func(bool, []byte, int, int)
// contains filtered or unexported fields
}
func (*ReadCloser) Close ¶
func (r *ReadCloser) Close() error
Close sets Closed to true and returns no error
func (*ReadCloser) Read ¶
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 ¶
ZeroReader is a io.Reader which will always write zeros to the byte slice provided.
type ZeroReader struct{}
func (*ZeroReader) Read ¶
func (r *ZeroReader) Read(b []byte) (int, error)
Read fills the provided byte slice with zeros returning the number of bytes written.
Subdirectories
Name | Synopsis |
---|---|
.. | |
cmd | |
bucket_cleanup | |
integration | Package integration performs initialization and validation for integration tests. |
customizations | |
s3 | |
s3crypto | Package s3crypto provides gucumber integration tests support. |
s3manager | |
smoke | Package smoke contains shared step definitions that are used across integration tests |
acm | Package acm provides gucumber integration tests support. |
apigateway | Package apigateway provides gucumber integration tests support. |
applicationdiscoveryservice | Package applicationdiscoveryservice provides gucumber integration tests support. |
autoscaling | Package autoscaling provides gucumber integration tests support. |
cloudformation | Package cloudformation provides gucumber integration tests support. |
cloudfront | Package cloudfront provides gucumber integration tests support. |
cloudhsm | Package cloudhsm provides gucumber integration tests support. |
cloudsearch | Package cloudsearch provides gucumber integration tests support. |
cloudtrail | Package cloudtrail provides gucumber integration tests support. |
cloudwatch | Package cloudwatch provides gucumber integration tests support. |
cloudwatchlogs | Package cloudwatchlogs provides gucumber integration tests support. |
codecommit | Package codecommit provides gucumber integration tests support. |
codedeploy | Package codedeploy provides gucumber integration tests support. |
codepipeline | Package codepipeline provides gucumber integration tests support. |
cognitoidentity | Package cognitoidentity provides gucumber integration tests support. |
cognitosync | Package cognitosync provides gucumber integration tests support. |
configservice | Package configservice provides gucumber integration tests support. |
datapipeline | Package datapipeline provides gucumber integration tests support. |
devicefarm | Package devicefarm provides gucumber integration tests support. |
directconnect | Package directconnect provides gucumber integration tests support. |
directoryservice | Package directoryservice provides gucumber integration tests support. |
dynamodb | Package dynamodb provides gucumber integration tests support. |
dynamodbstreams | Package dynamodbstreams provides gucumber integration tests support. |
ec2 | Package ec2 provides gucumber integration tests support. |
ecs | Package ecs provides gucumber integration tests support. |
efs | Package efs provides gucumber integration tests support. |
elasticache | Package elasticache provides gucumber integration tests support. |
elasticbeanstalk | Package elasticbeanstalk provides gucumber integration tests support. |
elasticloadbalancing | Package elasticloadbalancing provides gucumber integration tests support. |
elastictranscoder | Package elastictranscoder provides gucumber integration tests support. |
emr | Package emr provides gucumber integration tests support. |
es | Package es provides gucumber integration tests support. |
glacier | Package glacier provides gucumber integration tests support. |
iam | Package iam provides gucumber integration tests support. |
iotdataplane | Package iotdataplane provides gucumber integration tests support. |
kinesis | Package kinesis provides gucumber integration tests support. |
kms | Package kms provides gucumber integration tests support. |
lambda | Package lambda provides gucumber integration tests support. |
machinelearning | Package machinelearning provides gucumber integration tests support. |
opsworks | Package opsworks provides gucumber integration tests support. |
rds | Package rds provides gucumber integration tests support. |
redshift | Package redshift provides gucumber integration tests support. |
route53 | Package route53 provides gucumber integration tests support. |
route53domains | Package route53domains provides gucumber integration tests support. |
ses | Package ses provides gucumber integration tests support. |
simpledb | Package simpledb provides gucumber integration tests support. |
sns | Package sns provides gucumber integration tests support. |
sqs | Package sqs provides gucumber integration tests support. |
ssm | Package ssm provides gucumber integration tests support. |
storagegateway | Package storagegateway provides gucumber integration tests support. |
sts | Package sts provides gucumber integration tests support. |
support | Package support provides gucumber integration tests support. |
swf | Package swf provides gucumber integration tests support. |
waf | Package waf provides gucumber integration tests support. |
workspaces | Package workspaces provides gucumber integration tests support. |
mock | |
performance | Package performance provides gucumber integration tests support. |
unit | Package unit performs initialization and validation for unit tests |