Commit 3f00834f by bergquist

tech: remove unused dependencies

parent 1cb45c34
......@@ -14,7 +14,6 @@ import (
"strings"
"github.com/fatih/color"
"github.com/grafana/grafana-cli/pkg/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
m "github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s "github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
......@@ -94,7 +93,7 @@ func InstallPlugin(pluginName, version string, c CommandLine) error {
res, _ := s.ReadPlugin(pluginFolder, pluginName)
for _, v := range res.Dependencies.Plugins {
InstallPlugin(v.Id, version, c)
log.Infof("Installed dependency: %v ✔\n", v.Id)
logger.Infof("Installed dependency: %v ✔\n", v.Id)
}
return err
......
package awstesting
import (
"encoding/json"
"encoding/xml"
"fmt"
"net/url"
"reflect"
"regexp"
"sort"
"testing"
)
// Match is a testing helper to test for testing error by comparing expected
// with a regular expression.
func Match(t *testing.T, regex, expected string) {
if !regexp.MustCompile(regex).Match([]byte(expected)) {
t.Errorf("%q\n\tdoes not match /%s/", expected, regex)
}
}
// AssertURL verifies the expected URL is matches the actual.
func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool {
expectURL, err := url.Parse(expect)
if err != nil {
t.Errorf(errMsg("unable to parse expected URL", err, msgAndArgs))
return false
}
actualURL, err := url.Parse(actual)
if err != nil {
t.Errorf(errMsg("unable to parse actual URL", err, msgAndArgs))
return false
}
equal(t, expectURL.Host, actualURL.Host, msgAndArgs...)
equal(t, expectURL.Scheme, actualURL.Scheme, msgAndArgs...)
equal(t, expectURL.Path, actualURL.Path, msgAndArgs...)
return AssertQuery(t, expectURL.Query().Encode(), actualURL.Query().Encode(), msgAndArgs...)
}
// AssertQuery verifies the expect HTTP query string matches the actual.
func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool {
expectQ, err := url.ParseQuery(expect)
if err != nil {
t.Errorf(errMsg("unable to parse expected Query", err, msgAndArgs))
return false
}
actualQ, err := url.ParseQuery(expect)
if err != nil {
t.Errorf(errMsg("unable to parse actual Query", err, msgAndArgs))
return false
}
// Make sure the keys are the same
if !equal(t, queryValueKeys(expectQ), queryValueKeys(actualQ), msgAndArgs...) {
return false
}
for k, expectQVals := range expectQ {
sort.Strings(expectQVals)
actualQVals := actualQ[k]
sort.Strings(actualQVals)
equal(t, expectQVals, actualQVals, msgAndArgs...)
}
return true
}
// AssertJSON verifies that the expect json string matches the actual.
func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool {
expectVal := map[string]interface{}{}
if err := json.Unmarshal([]byte(expect), &expectVal); err != nil {
t.Errorf(errMsg("unable to parse expected JSON", err, msgAndArgs...))
return false
}
actualVal := map[string]interface{}{}
if err := json.Unmarshal([]byte(actual), &actualVal); err != nil {
t.Errorf(errMsg("unable to parse actual JSON", err, msgAndArgs...))
return false
}
return equal(t, expectVal, actualVal, msgAndArgs...)
}
// AssertXML verifies that the expect xml string matches the actual.
func AssertXML(t *testing.T, expect, actual string, container interface{}, msgAndArgs ...interface{}) bool {
expectVal := container
if err := xml.Unmarshal([]byte(expect), &expectVal); err != nil {
t.Errorf(errMsg("unable to parse expected XML", err, msgAndArgs...))
}
actualVal := container
if err := xml.Unmarshal([]byte(actual), &actualVal); err != nil {
t.Errorf(errMsg("unable to parse actual XML", err, msgAndArgs...))
}
return equal(t, expectVal, actualVal, msgAndArgs...)
}
// objectsAreEqual determines if two objects are considered equal.
//
// This function does no assertion of any kind.
//
// Based on github.com/stretchr/testify/assert.ObjectsAreEqual
// Copied locally to prevent non-test build dependencies on testify
func objectsAreEqual(expected, actual interface{}) bool {
if expected == nil || actual == nil {
return expected == actual
}
return reflect.DeepEqual(expected, actual)
}
// Equal asserts that two objects are equal.
//
// assert.Equal(t, 123, 123, "123 and 123 should be equal")
//
// Returns whether the assertion was successful (true) or not (false).
//
// Based on github.com/stretchr/testify/assert.Equal
// Copied locally to prevent non-test build dependencies on testify
func equal(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool {
if !objectsAreEqual(expected, actual) {
t.Errorf("Not Equal:\n\t%#v (expected)\n\t%#v (actual), %s",
expected, actual, messageFromMsgAndArgs(msgAndArgs))
return false
}
return true
}
func errMsg(baseMsg string, err error, msgAndArgs ...interface{}) string {
message := messageFromMsgAndArgs(msgAndArgs)
if message != "" {
message += ", "
}
return fmt.Sprintf("%s%s, %v", message, baseMsg, err)
}
// Based on github.com/stretchr/testify/assert.messageFromMsgAndArgs
// Copied locally to prevent non-test build dependencies on testify
func messageFromMsgAndArgs(msgAndArgs []interface{}) string {
if len(msgAndArgs) == 0 || msgAndArgs == nil {
return ""
}
if len(msgAndArgs) == 1 {
return msgAndArgs[0].(string)
}
if len(msgAndArgs) > 1 {
return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)
}
return ""
}
func queryValueKeys(v url.Values) []string {
keys := make([]string, 0, len(v))
for k := range v {
keys = append(keys, k)
}
sort.Strings(keys)
return keys
}
package awstesting_test
import (
"encoding/xml"
"testing"
"github.com/aws/aws-sdk-go/awstesting"
)
func TestAssertJSON(t *testing.T) {
cases := []struct {
e, a string
asserts bool
}{
{
e: `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`,
a: `{"RecursiveStruct":{"RecursiveMap":{"bar":{"NoRecurse":"bar"},"foo":{"NoRecurse":"foo"}}}}`,
asserts: true,
},
}
for i, c := range cases {
mockT := &testing.T{}
if awstesting.AssertJSON(mockT, c.e, c.a) != c.asserts {
t.Error("Assert JSON result was not expected.", i)
}
}
}
func TestAssertXML(t *testing.T) {
cases := []struct {
e, a string
asserts bool
container struct {
XMLName xml.Name `xml:"OperationRequest"`
NS string `xml:"xmlns,attr"`
RecursiveStruct struct {
RecursiveMap struct {
Entries []struct {
XMLName xml.Name `xml:"entries"`
Key string `xml:"key"`
Value struct {
XMLName xml.Name `xml:"value"`
NoRecurse string
}
}
}
}
}
}{
{
e: `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveMap xmlns="https://foo/"><entry xmlns="https://foo/"><key xmlns="https://foo/">foo</key><value xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></value></entry><entry xmlns="https://foo/"><key xmlns="https://foo/">bar</key><value xmlns="https://foo/"><NoRecurse xmlns="https://foo/">bar</NoRecurse></value></entry></RecursiveMap></RecursiveStruct></OperationRequest>`,
a: `<OperationRequest xmlns="https://foo/"><RecursiveStruct xmlns="https://foo/"><RecursiveMap xmlns="https://foo/"><entry xmlns="https://foo/"><key xmlns="https://foo/">bar</key><value xmlns="https://foo/"><NoRecurse xmlns="https://foo/">bar</NoRecurse></value></entry><entry xmlns="https://foo/"><key xmlns="https://foo/">foo</key><value xmlns="https://foo/"><NoRecurse xmlns="https://foo/">foo</NoRecurse></value></entry></RecursiveMap></RecursiveStruct></OperationRequest>`,
asserts: true,
},
}
for i, c := range cases {
// mockT := &testing.T{}
if awstesting.AssertXML(t, c.e, c.a, c.container) != c.asserts {
t.Error("Assert XML result was not expected.", i)
}
}
}
package awstesting
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/defaults"
)
// NewClient creates and initializes a generic service client for testing.
func NewClient(cfgs ...*aws.Config) *client.Client {
info := metadata.ClientInfo{
Endpoint: "http://endpoint",
SigningName: "",
}
def := defaults.Get()
def.Config.MergeIn(cfgs...)
return client.New(*def.Config, info, def.Handlers)
}
// +build integration
// Package s3_test runs integration tests for S3
package s3_test
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/service/s3"
)
var bucketName *string
var svc *s3.S3
func TestMain(m *testing.M) {
setup()
defer teardown() // only called if we panic
result := m.Run()
teardown()
os.Exit(result)
}
// Create a bucket for testing
func setup() {
svc = s3.New(integration.Session)
bucketName = aws.String(
fmt.Sprintf("aws-sdk-go-integration-%d-%s", time.Now().Unix(), integration.UniqueID()))
for i := 0; i < 10; i++ {
_, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName})
if err == nil {
break
}
}
for {
_, err := svc.HeadBucket(&s3.HeadBucketInput{Bucket: bucketName})
if err == nil {
break
}
time.Sleep(1 * time.Second)
}
}
// Delete the bucket
func teardown() {
resp, _ := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName})
for _, o := range resp.Contents {
svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key})
}
svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName})
}
func TestWriteToObject(t *testing.T) {
_, err := svc.PutObject(&s3.PutObjectInput{
Bucket: bucketName,
Key: aws.String("key name"),
Body: bytes.NewReader([]byte("hello world")),
})
assert.NoError(t, err)
resp, err := svc.GetObject(&s3.GetObjectInput{
Bucket: bucketName,
Key: aws.String("key name"),
})
assert.NoError(t, err)
b, _ := ioutil.ReadAll(resp.Body)
assert.Equal(t, []byte("hello world"), b)
}
func TestPresignedGetPut(t *testing.T) {
putreq, _ := svc.PutObjectRequest(&s3.PutObjectInput{
Bucket: bucketName,
Key: aws.String("presigned-key"),
})
var err error
// Presign a PUT request
var puturl string
puturl, err = putreq.Presign(300 * time.Second)
assert.NoError(t, err)
// PUT to the presigned URL with a body
var puthttpreq *http.Request
buf := bytes.NewReader([]byte("hello world"))
puthttpreq, err = http.NewRequest("PUT", puturl, buf)
assert.NoError(t, err)
var putresp *http.Response
putresp, err = http.DefaultClient.Do(puthttpreq)
assert.NoError(t, err)
assert.Equal(t, 200, putresp.StatusCode)
// Presign a GET on the same URL
getreq, _ := svc.GetObjectRequest(&s3.GetObjectInput{
Bucket: bucketName,
Key: aws.String("presigned-key"),
})
var geturl string
geturl, err = getreq.Presign(300 * time.Second)
assert.NoError(t, err)
// Get the body
var getresp *http.Response
getresp, err = http.Get(geturl)
assert.NoError(t, err)
var b []byte
defer getresp.Body.Close()
b, err = ioutil.ReadAll(getresp.Body)
assert.Equal(t, "hello world", string(b))
}
// +build integration
//Package s3crypto provides gucumber integration tests support.
package s3crypto
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3crypto"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@s3crypto", func() {
sess := session.New((&aws.Config{
Region: aws.String("us-west-2"),
}).WithLogLevel(aws.LogDebugWithRequestRetries | aws.LogDebugWithRequestErrors))
encryptionClient := s3crypto.NewEncryptionClient(sess, nil, func(c *s3crypto.EncryptionClient) {
})
gucumber.World["encryptionClient"] = encryptionClient
decryptionClient := s3crypto.NewDecryptionClient(sess)
gucumber.World["decryptionClient"] = decryptionClient
gucumber.World["client"] = s3.New(sess)
})
}
# language: en
@s3crypto @client
Feature: S3 Integration Crypto Tests
Scenario: Get all plaintext fixtures for symmetric masterkey aes cbc
When I get all fixtures for "aes_gcm" from "aws-s3-shared-tests"
Then I decrypt each fixture against "Java" "version_2"
And I compare the decrypted ciphertext to the plaintext
Scenario: Uploading Go's SDK fixtures
When I get all fixtures for "aes_gcm" from "aws-s3-shared-tests"
Then I encrypt each fixture with "kms" "AWS_SDK_TEST_ALIAS" "us-west-2" and "aes_gcm"
And upload "Go" data with folder "version_2"
Scenario: Get all plaintext fixtures for symmetric masterkey aes gcm
When I get all fixtures for "aes_gcm" from "aws-s3-shared-tests"
Then I decrypt each fixture against "Go" "version_2"
And I compare the decrypted ciphertext to the plaintext
// +build integration
// Package s3crypto contains shared step definitions that are used across integration tests
package s3crypto
import (
"bytes"
"encoding/base64"
"errors"
"io/ioutil"
"strings"
"github.com/gucumber/gucumber"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kms"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3crypto"
)
func init() {
gucumber.When(`^I get all fixtures for "(.+?)" from "(.+?)"$`,
func(cekAlg, bucket string) {
prefix := "plaintext_test_case_"
baseFolder := "crypto_tests/" + cekAlg
s3Client := gucumber.World["client"].(*s3.S3)
out, err := s3Client.ListObjects(&s3.ListObjectsInput{
Bucket: aws.String(bucket),
Prefix: aws.String(baseFolder + "/" + prefix),
})
assert.NoError(gucumber.T, err)
plaintexts := make(map[string][]byte)
for _, obj := range out.Contents {
plaintextKey := obj.Key
ptObj, err := s3Client.GetObject(&s3.GetObjectInput{
Bucket: aws.String(bucket),
Key: plaintextKey,
})
assert.NoError(gucumber.T, err)
caseKey := strings.TrimPrefix(*plaintextKey, baseFolder+"/"+prefix)
plaintext, err := ioutil.ReadAll(ptObj.Body)
assert.NoError(gucumber.T, err)
plaintexts[caseKey] = plaintext
}
gucumber.World["baseFolder"] = baseFolder
gucumber.World["bucket"] = bucket
gucumber.World["plaintexts"] = plaintexts
})
gucumber.Then(`^I decrypt each fixture against "(.+?)" "(.+?)"$`, func(lang, version string) {
plaintexts := gucumber.World["plaintexts"].(map[string][]byte)
baseFolder := gucumber.World["baseFolder"].(string)
bucket := gucumber.World["bucket"].(string)
prefix := "ciphertext_test_case_"
s3Client := gucumber.World["client"].(*s3.S3)
s3CryptoClient := gucumber.World["decryptionClient"].(*s3crypto.DecryptionClient)
language := "language_" + lang
ciphertexts := make(map[string][]byte)
for caseKey := range plaintexts {
cipherKey := baseFolder + "/" + version + "/" + language + "/" + prefix + caseKey
// To get metadata for encryption key
ctObj, err := s3Client.GetObject(&s3.GetObjectInput{
Bucket: aws.String(bucket),
Key: &cipherKey,
})
if err != nil {
continue
}
// We don't support wrap, so skip it
if *ctObj.Metadata["X-Amz-Wrap-Alg"] != "kms" {
continue
}
//masterkeyB64 := ctObj.Metadata["Masterkey"]
//masterkey, err := base64.StdEncoding.DecodeString(*masterkeyB64)
//assert.NoError(T, err)
//s3CryptoClient.Config.MasterKey = masterkey
ctObj, err = s3CryptoClient.GetObject(&s3.GetObjectInput{
Bucket: aws.String(bucket),
Key: &cipherKey,
},
)
assert.NoError(gucumber.T, err)
ciphertext, err := ioutil.ReadAll(ctObj.Body)
assert.NoError(gucumber.T, err)
ciphertexts[caseKey] = ciphertext
}
gucumber.World["ciphertexts"] = ciphertexts
})
gucumber.And(`^I compare the decrypted ciphertext to the plaintext$`, func() {
plaintexts := gucumber.World["plaintexts"].(map[string][]byte)
ciphertexts := gucumber.World["ciphertexts"].(map[string][]byte)
for caseKey, ciphertext := range ciphertexts {
assert.Equal(gucumber.T, len(plaintexts[caseKey]), len(ciphertext))
assert.True(gucumber.T, bytes.Equal(plaintexts[caseKey], ciphertext))
}
})
gucumber.Then(`^I encrypt each fixture with "(.+?)" "(.+?)" "(.+?)" and "(.+?)"$`, func(kek, v1, v2, cek string) {
var handler s3crypto.CipherDataGenerator
var builder s3crypto.ContentCipherBuilder
switch kek {
case "kms":
arn, err := getAliasInformation(v1, v2)
assert.Nil(gucumber.T, err)
b64Arn := base64.StdEncoding.EncodeToString([]byte(arn))
assert.Nil(gucumber.T, err)
gucumber.World["Masterkey"] = b64Arn
handler = s3crypto.NewKMSKeyGenerator(kms.New(session.New(&aws.Config{
Region: &v2,
})), arn)
assert.Nil(gucumber.T, err)
default:
gucumber.T.Skip()
}
switch cek {
case "aes_gcm":
builder = s3crypto.AESGCMContentCipherBuilder(handler)
default:
gucumber.T.Skip()
}
sess := session.New(&aws.Config{
Region: aws.String("us-west-2"),
})
c := s3crypto.NewEncryptionClient(sess, builder, func(c *s3crypto.EncryptionClient) {
})
gucumber.World["encryptionClient"] = c
gucumber.World["cek"] = cek
})
gucumber.And(`^upload "(.+?)" data with folder "(.+?)"$`, func(language, folder string) {
c := gucumber.World["encryptionClient"].(*s3crypto.EncryptionClient)
cek := gucumber.World["cek"].(string)
bucket := gucumber.World["bucket"].(string)
plaintexts := gucumber.World["plaintexts"].(map[string][]byte)
key := gucumber.World["Masterkey"].(string)
for caseKey, plaintext := range plaintexts {
input := &s3.PutObjectInput{
Bucket: &bucket,
Key: aws.String("crypto_tests/" + cek + "/" + folder + "/language_" + language + "/ciphertext_test_case_" + caseKey),
Body: bytes.NewReader(plaintext),
Metadata: map[string]*string{
"Masterkey": &key,
},
}
_, err := c.PutObject(input)
assert.Nil(gucumber.T, err)
}
})
}
func getAliasInformation(alias, region string) (string, error) {
arn := ""
svc := kms.New(session.New(&aws.Config{
Region: &region,
}))
truncated := true
var marker *string
for truncated {
out, err := svc.ListAliases(&kms.ListAliasesInput{
Marker: marker,
})
if err != nil {
return arn, err
}
for _, aliasEntry := range out.Aliases {
if *aliasEntry.AliasName == "alias/"+alias {
return *aliasEntry.AliasArn, nil
}
}
truncated = *out.Truncated
marker = out.NextMarker
}
return "", errors.New("The alias " + alias + " does not exist in your account. Please add the proper alias to a key")
}
// +build integration
// Package s3manager provides
package s3manager
import (
"bytes"
"crypto/md5"
"fmt"
"io"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
var integBuf12MB = make([]byte, 1024*1024*12)
var integMD512MB = fmt.Sprintf("%x", md5.Sum(integBuf12MB))
var bucketName *string
func TestMain(m *testing.M) {
setup()
defer teardown() // only called if we panic
result := m.Run()
teardown()
os.Exit(result)
}
func setup() {
// Create a bucket for testing
svc := s3.New(integration.Session)
bucketName = aws.String(
fmt.Sprintf("aws-sdk-go-integration-%d-%s", time.Now().Unix(), integration.UniqueID()))
for i := 0; i < 10; i++ {
_, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName})
if err == nil {
break
}
}
for {
_, err := svc.HeadBucket(&s3.HeadBucketInput{Bucket: bucketName})
if err == nil {
break
}
time.Sleep(1 * time.Second)
}
}
// Delete the bucket
func teardown() {
svc := s3.New(integration.Session)
objs, _ := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName})
for _, o := range objs.Contents {
svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key})
}
uploads, _ := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName})
for _, u := range uploads.Uploads {
svc.AbortMultipartUpload(&s3.AbortMultipartUploadInput{
Bucket: bucketName,
Key: u.Key,
UploadId: u.UploadId,
})
}
svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName})
}
type dlwriter struct {
buf []byte
}
func newDLWriter(size int) *dlwriter {
return &dlwriter{buf: make([]byte, size)}
}
func (d dlwriter) WriteAt(p []byte, pos int64) (n int, err error) {
if pos > int64(len(d.buf)) {
return 0, io.EOF
}
written := 0
for i, b := range p {
if i >= len(d.buf) {
break
}
d.buf[pos+int64(i)] = b
written++
}
return written, nil
}
func validate(t *testing.T, key string, md5value string) {
mgr := s3manager.NewDownloader(integration.Session)
params := &s3.GetObjectInput{Bucket: bucketName, Key: &key}
w := newDLWriter(1024 * 1024 * 20)
n, err := mgr.Download(w, params)
assert.NoError(t, err)
assert.Equal(t, md5value, fmt.Sprintf("%x", md5.Sum(w.buf[0:n])))
}
func TestUploadConcurrently(t *testing.T) {
key := "12mb-1"
mgr := s3manager.NewUploader(integration.Session)
out, err := mgr.Upload(&s3manager.UploadInput{
Bucket: bucketName,
Key: &key,
Body: bytes.NewReader(integBuf12MB),
})
assert.NoError(t, err)
assert.NotEqual(t, "", out.UploadID)
assert.Regexp(t, `^https?://.+/`+key+`$`, out.Location)
validate(t, key, integMD512MB)
}
func TestUploadFailCleanup(t *testing.T) {
svc := s3.New(integration.Session)
// Break checksum on 2nd part so it fails
part := 0
svc.Handlers.Build.PushBack(func(r *request.Request) {
if r.Operation.Name == "UploadPart" {
if part == 1 {
r.HTTPRequest.Header.Set("X-Amz-Content-Sha256", "000")
}
part++
}
})
key := "12mb-leave"
mgr := s3manager.NewUploaderWithClient(svc, func(u *s3manager.Uploader) {
u.LeavePartsOnError = false
})
_, err := mgr.Upload(&s3manager.UploadInput{
Bucket: bucketName,
Key: &key,
Body: bytes.NewReader(integBuf12MB),
})
assert.Error(t, err)
assert.NotContains(t, err.Error(), "MissingRegion")
uploadID := ""
if merr, ok := err.(s3manager.MultiUploadFailure); ok {
uploadID = merr.UploadID()
}
assert.NotEmpty(t, uploadID)
_, err = svc.ListParts(&s3.ListPartsInput{
Bucket: bucketName, Key: &key, UploadId: &uploadID})
assert.Error(t, err)
}
// +build integration
// Package integration performs initialization and validation for integration
// tests.
package integration
import (
"crypto/rand"
"fmt"
"io"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
)
// Session is a shared session for all integration tests to use.
var Session = session.Must(session.NewSession())
func init() {
logLevel := Session.Config.LogLevel
if os.Getenv("DEBUG") != "" {
logLevel = aws.LogLevel(aws.LogDebug)
}
if os.Getenv("DEBUG_SIGNING") != "" {
logLevel = aws.LogLevel(aws.LogDebugWithSigning)
}
if os.Getenv("DEBUG_BODY") != "" {
logLevel = aws.LogLevel(aws.LogDebugWithSigning | aws.LogDebugWithHTTPBody)
}
Session.Config.LogLevel = logLevel
if aws.StringValue(Session.Config.Region) == "" {
panic("AWS_REGION must be configured to run integration tests")
}
}
// UniqueID returns a unique UUID-like identifier for use in generating
// resources for integration tests.
func UniqueID() string {
uuid := make([]byte, 16)
io.ReadFull(rand.Reader, uuid)
return fmt.Sprintf("%x", uuid)
}
#language en
@acm @client
Feature: AWS Certificate Manager
Scenario: Making a request
When I call the "ListCertificates" API
Then the request should be successful
Scenario: Handling errors
When I attempt to call the "GetCertificate" API with:
| CertificateArn | arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message not be empty
// +build integration
//Package acm provides gucumber integration tests support.
package acm
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/acm"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@acm", func() {
gucumber.World["client"] = acm.New(smoke.Session)
})
}
# language: en
@apigateway @client
Feature: Amazon API Gateway
Scenario: Making a request
When I call the "GetAccountRequest" API
Then the request should be successful
Scenario: Handing errors
When I attempt to call the "GetRestApi" API with:
| RestApiId | api123 |
Then I expect the response error code to be "NotFoundException"
And I expect the response error message to include:
"""
Invalid REST API identifier specified
"""
// +build integration
//Package apigateway provides gucumber integration tests support.
package apigateway
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/apigateway"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@apigateway", func() {
gucumber.World["client"] = apigateway.New(smoke.Session)
})
}
#language en
@applicationdiscoveryservice @client
Feature: AWS Application Discovery Service
Scenario: Making a request
When I call the "DescribeAgents" API
Then the request should be successful
// +build integration
//Package applicationdiscoveryservice provides gucumber integration tests support.
package applicationdiscoveryservice
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/applicationdiscoveryservice"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@applicationdiscoveryservice", func() {
gucumber.World["client"] = applicationdiscoveryservice.New(
smoke.Session, &aws.Config{Region: aws.String("us-west-2")},
)
})
}
# language: en
@autoscaling @client
Feature: Auto Scaling
Scenario: Making a request
When I call the "DescribeScalingProcessTypes" API
Then the value at "Processes" should be a list
Scenario: Handing errors
When I attempt to call the "CreateLaunchConfiguration" API with:
| LaunchConfigurationName | |
| ImageId | ami-12345678 |
| InstanceType | m1.small |
Then I expect the response error code to be "InvalidParameter"
And I expect the response error message to include:
"""
LaunchConfigurationName
"""
// +build integration
//Package autoscaling provides gucumber integration tests support.
package autoscaling
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@autoscaling", func() {
gucumber.World["client"] = autoscaling.New(smoke.Session)
})
}
// +build integration
//Package cloudformation provides gucumber integration tests support.
package cloudformation
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudformation", func() {
gucumber.World["client"] = cloudformation.New(smoke.Session)
})
}
# language: en
@cloudformation @client
Feature: AWS CloudFormation
Scenario: Making a request
When I call the "ListStacks" API
Then the value at "StackSummaries" should be a list
Scenario: Handling errors
When I attempt to call the "CreateStack" API with:
| StackName | fakestack |
| TemplateURL | http://s3.amazonaws.com/foo/bar |
Then I expect the response error code to be "ValidationError"
And I expect the response error message to include:
"""
TemplateURL must reference a valid S3 object to which you have access.
"""
// +build integration
//Package cloudfront provides gucumber integration tests support.
package cloudfront
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudfront"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudfront", func() {
gucumber.World["client"] = cloudfront.New(smoke.Session)
})
}
# language: en
@cloudfront @client
Feature: Amazon CloudFront
Scenario: Making a basic request
When I call the "ListDistributions" API with:
| MaxItems | 1 |
Then the value at "DistributionList.Items" should be a list
Scenario: Error handling
When I attempt to call the "GetDistribution" API with:
| Id | fake-id |
Then I expect the response error code to be "NoSuchDistribution"
And I expect the response error message to include:
"""
The specified distribution does not exist.
"""
// +build integration
//Package cloudhsm provides gucumber integration tests support.
package cloudhsm
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudhsm"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudhsm", func() {
gucumber.World["client"] = cloudhsm.New(smoke.Session)
})
}
# language: en
@cloudhsm @client
Feature: Amazon CloudHSM
Scenario: Making a request
When I call the "ListHapgs" API
Then the value at "HapgList" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeHapg" API with:
| HapgArn | bogus-arn |
Then I expect the response error code to be "ValidationException"
And I expect the response error message to include:
"""
Value 'bogus-arn' at 'hapgArn' failed to satisfy constraint
"""
// +build integration
//Package cloudsearch provides gucumber integration tests support.
package cloudsearch
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudsearch"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudsearch", func() {
gucumber.World["client"] = cloudsearch.New(smoke.Session)
})
}
# language: en
@cloudsearch @client
Feature: Amazon CloudSearch
Scenario: Making a request
When I call the "DescribeDomains" API
Then the response should contain a "DomainStatusList"
Scenario: Handling errors
When I attempt to call the "DescribeIndexFields" API with:
| DomainName | fakedomain |
Then I expect the response error code to be "ResourceNotFound"
And I expect the response error message to include:
"""
Domain not found: fakedomain
"""
// +build integration
//Package cloudtrail provides gucumber integration tests support.
package cloudtrail
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudtrail"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudtrail", func() {
gucumber.World["client"] = cloudtrail.New(smoke.Session)
})
}
# language: en
@cloudtrail @client
Feature: AWS CloudTrail
Scenario: Making a request
When I call the "DescribeTrails" API
Then the response should contain a "trailList"
Scenario: Handling errors
When I attempt to call the "DeleteTrail" API with:
| Name | faketrail |
Then I expect the response error code to be "TrailNotFoundException"
And I expect the response error message to include:
"""
Unknown trail
"""
// +build integration
//Package cloudwatch provides gucumber integration tests support.
package cloudwatch
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudwatch", func() {
gucumber.World["client"] = cloudwatch.New(smoke.Session)
})
}
# language: en
@cloudwatch @monitoring @client
Feature: Amazon CloudWatch
Scenario: Making a request
When I call the "ListMetrics" API with:
| Namespace | AWS/EC2 |
Then the value at "Metrics" should be a list
Scenario: Handling errors
When I attempt to call the "SetAlarmState" API with:
| AlarmName | abc |
| StateValue | mno |
| StateReason | xyz |
Then I expect the response error code to be "ValidationError"
And I expect the response error message to include:
"""
failed to satisfy constraint
"""
// +build integration
//Package cloudwatchlogs provides gucumber integration tests support.
package cloudwatchlogs
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cloudwatchlogs", func() {
gucumber.World["client"] = cloudwatchlogs.New(smoke.Session)
})
}
# language: en
@cloudwatchlogs @logs
Feature: Amazon CloudWatch Logs
Scenario: Making a request
When I call the "DescribeLogGroups" API
Then the value at "logGroups" should be a list
Scenario: Handling errors
When I attempt to call the "GetLogEvents" API with:
| logGroupName | fakegroup |
| logStreamName | fakestream |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
The specified log group does not exist.
"""
// +build integration
//Package codecommit provides gucumber integration tests support.
package codecommit
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/codecommit"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@codecommit", func() {
gucumber.World["client"] = codecommit.New(smoke.Session)
})
}
# language: en
@codecommit @client
Feature: Amazon CodeCommit
Scenario: Making a request
When I call the "ListRepositories" API
Then the value at "repositories" should be a list
Scenario: Handling errors
When I attempt to call the "ListBranches" API with:
| repositoryName | fake-repo |
Then I expect the response error code to be "RepositoryDoesNotExistException"
And I expect the response error message to include:
"""
fake-repo does not exist
"""
// +build integration
//Package codedeploy provides gucumber integration tests support.
package codedeploy
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/codedeploy"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@codedeploy", func() {
gucumber.World["client"] = codedeploy.New(smoke.Session)
})
}
# language: en
@codedeploy @client
Feature: Amazon CodeDeploy
Scenario: Making a request
When I call the "ListApplications" API
Then the value at "applications" should be a list
Scenario: Handling errors
When I attempt to call the "GetDeployment" API with:
| deploymentId | d-USUAELQEX |
Then I expect the response error code to be "DeploymentDoesNotExistException"
And I expect the response error message to include:
"""
The deployment d-USUAELQEX could not be found
"""
// +build integration
//Package codepipeline provides gucumber integration tests support.
package codepipeline
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/codepipeline"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@codepipeline", func() {
gucumber.World["client"] = codepipeline.New(smoke.Session)
})
}
# language: en
@codepipeline @client
Feature: Amazon CodePipeline
Scenario: Making a request
When I call the "ListPipelines" API
Then the value at "pipelines" should be a list
Scenario: Handling errors
When I attempt to call the "GetPipeline" API with:
| name | fake-pipeline |
Then I expect the response error code to be "PipelineNotFoundException"
And I expect the response error message to include:
"""
does not have a pipeline with name 'fake-pipeline'
"""
// +build integration
//Package cognitoidentity provides gucumber integration tests support.
package cognitoidentity
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cognitoidentity"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cognitoidentity", func() {
gucumber.World["client"] = cognitoidentity.New(smoke.Session)
})
}
# language: en
@cognitoidentity @client
Feature: Amazon Cognito Idenity
Scenario: Making a request
When I call the "ListIdentityPools" API with JSON:
"""
{"MaxResults": 10}
"""
Then the value at "IdentityPools" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeIdentityPool" API with:
| IdentityPoolId | us-east-1:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
IdentityPool 'us-east-1:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' not found
"""
// +build integration
//Package cognitosync provides gucumber integration tests support.
package cognitosync
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/cognitosync"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@cognitosync", func() {
gucumber.World["client"] = cognitosync.New(smoke.Session)
})
}
# language: en
@cognitosync @client
Feature: Amazon Cognito Sync
Scenario: Making a request
When I call the "ListIdentityPoolUsage" API
Then the value at "IdentityPoolUsages" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeIdentityPoolUsage" API with:
| IdentityPoolId | us-east-1:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
IdentityPool 'us-east-1:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' not found
"""
// +build integration
//Package configservice provides gucumber integration tests support.
package configservice
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/configservice"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@configservice", func() {
gucumber.World["client"] = configservice.New(smoke.Session)
})
}
# language: en
@configservice @config @client
Feature: AWS Config
Scenario: Making a request
When I call the "DescribeConfigurationRecorders" API
Then the value at "ConfigurationRecorders" should be a list
Scenario: Handling errors
When I attempt to call the "GetResourceConfigHistory" API with:
| resourceType | fake-type |
| resourceId | fake-id |
Then I expect the response error code to be "ValidationException"
And I expect the response error message to include:
"""
failed to satisfy constraint
"""
// +build integration
//Package datapipeline provides gucumber integration tests support.
package datapipeline
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/datapipeline"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@datapipeline", func() {
gucumber.World["client"] = datapipeline.New(smoke.Session)
})
}
# language: en
@datapipeline @client
Feature: AWS Data Pipeline
Scenario: Making a request
When I call the "ListPipelines" API
Then the response should contain a "pipelineIdList"
Scenario: Handling errors
When I attempt to call the "GetPipelineDefinition" API with:
| pipelineId | fake-id |
Then I expect the response error code to be "PipelineNotFoundException"
And I expect the response error message to include:
"""
does not exist
"""
// +build integration
//Package devicefarm provides gucumber integration tests support.
package devicefarm
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/devicefarm"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@devicefarm", func() {
// FIXME remove custom region
gucumber.World["client"] = devicefarm.New(smoke.Session,
aws.NewConfig().WithRegion("us-west-2"))
})
}
# language: en
@devicefarm @client
Feature: AWS Device Farm
Scenario: Making a request
When I call the "ListDevices" API
Then the value at "devices" should be a list
Scenario: Handling errors
When I attempt to call the "GetDevice" API with:
| arn | arn:aws:devicefarm:us-west-2::device:000000000000000000000000fake-arn |
Then I expect the response error code to be "NotFoundException"
And I expect the response error message to include:
"""
No device was found for arn
"""
// +build integration
//Package directconnect provides gucumber integration tests support.
package directconnect
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/directconnect"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@directconnect", func() {
gucumber.World["client"] = directconnect.New(smoke.Session)
})
}
# language: en
@directconnect @client
Feature: AWS Direct Connect
Scenario: Making a request
When I call the "DescribeConnections" API
Then the value at "connections" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeConnections" API with:
| connectionId | fake-connection |
Then I expect the response error code to be "DirectConnectClientException"
And I expect the response error message to include:
"""
Connection ID fake-connection has an invalid format
"""
// +build integration
//Package directoryservice provides gucumber integration tests support.
package directoryservice
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/directoryservice"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@directoryservice", func() {
gucumber.World["client"] = directoryservice.New(smoke.Session)
})
}
# language: en
@directoryservice @ds @client
Feature: AWS Directory Service
I want to use AWS Directory Service
Scenario: Making a request
When I call the "DescribeDirectories" API
Then the value at "DirectoryDescriptions" should be a list
Scenario: Handling errors
When I attempt to call the "CreateDirectory" API with:
| Name | |
| Password | |
| Size | |
Then I expect the response error code to be "ValidationException"
// +build integration
//Package dynamodb provides gucumber integration tests support.
package dynamodb
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@dynamodb", func() {
gucumber.World["client"] = dynamodb.New(smoke.Session)
})
}
# language: en
@dynamodb @client
Feature: Amazon DynamoDB
Scenario: Making a request
When I call the "ListTables" API with JSON:
"""
{"Limit": 1}
"""
Then the value at "TableNames" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeTable" API with:
| TableName | fake-table |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
Requested resource not found: Table: fake-table not found
"""
// +build integration
//Package dynamodbstreams provides gucumber integration tests support.
package dynamodbstreams
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/dynamodbstreams"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@dynamodbstreams", func() {
gucumber.World["client"] = dynamodbstreams.New(smoke.Session)
})
}
# language: en
@dynamodbstreams @client
Feature: Amazon DynamoDB Streams
Scenario: Making a request
When I call the "ListStreams" API
Then the value at "Streams" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeStream" API with:
| StreamArn | fake-stream |
Then I expect the response error code to be "InvalidParameter"
And I expect the response error message to include:
"""
StreamArn
"""
// +build integration
//Package ec2 provides gucumber integration tests support.
package ec2
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@ec2", func() {
gucumber.World["client"] = ec2.New(smoke.Session)
})
}
# language: en
@ec2 @client
Feature: Amazon Elastic Compute Cloud
Scenario: Making a request
When I call the "DescribeRegions" API
Then the value at "Regions" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeInstances" API with JSON:
"""
{"InstanceIds": ["i-12345678"]}
"""
Then I expect the response error code to be "InvalidInstanceID.NotFound"
And I expect the response error message to include:
"""
The instance ID 'i-12345678' does not exist
"""
// +build integration
//Package ecs provides gucumber integration tests support.
package ecs
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/ecs"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@ecs", func() {
// FIXME remove custom region
gucumber.World["client"] = ecs.New(smoke.Session,
aws.NewConfig().WithRegion("us-west-2"))
})
}
# language: en
@ecs @client
Feature: Amazon ECS
I want to use Amazon ECS
Scenario: Making a request
When I call the "ListClusters" API
Then the value at "clusterArns" should be a list
Scenario: Handling errors
When I attempt to call the "StopTask" API with:
| task | xxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxx |
Then the error code should be "ClusterNotFoundException"
// +build integration
//Package efs provides gucumber integration tests support.
package efs
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/efs"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@efs", func() {
// FIXME remove custom region
gucumber.World["client"] = efs.New(smoke.Session,
aws.NewConfig().WithRegion("us-west-2"))
})
}
# language: en
@efs @elasticfilesystem @client
Feature: Amazon Elastic File System
I want to use Amazon Elastic File System
Scenario: Making a request
When I call the "DescribeFileSystems" API
Then the value at "FileSystems" should be a list
Scenario: Handling errors
When I attempt to call the "DeleteFileSystem" API with:
| FileSystemId | fake-id |
Then the error code should be "BadRequest"
// +build integration
//Package elasticache provides gucumber integration tests support.
package elasticache
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/elasticache"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@elasticache", func() {
gucumber.World["client"] = elasticache.New(smoke.Session)
})
}
# language: en
@elasticache @client
Feature: ElastiCache
Scenario: Making a request
When I call the "DescribeEvents" API
Then the value at "Events" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeCacheClusters" API with:
| CacheClusterId | fake_cluster |
Then I expect the response error code to be "InvalidParameterValue"
And I expect the response error message to include:
"""
The parameter CacheClusterIdentifier is not a valid identifier.
"""
// +build integration
//Package elasticbeanstalk provides gucumber integration tests support.
package elasticbeanstalk
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/elasticbeanstalk"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@elasticbeanstalk", func() {
gucumber.World["client"] = elasticbeanstalk.New(smoke.Session)
})
}
# language: en
@elasticbeanstalk @client
Feature: AWS Elastic Beanstalk
Scenario: Making a request
When I call the "ListAvailableSolutionStacks" API
Then the value at "SolutionStacks" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeEnvironmentResources" API with:
| EnvironmentId | fake_environment |
Then I expect the response error code to be "InvalidParameterValue"
And I expect the response error message to include:
"""
No Environment found for EnvironmentId = 'fake_environment'.
"""
// +build integration
//Package elasticloadbalancing provides gucumber integration tests support.
package elasticloadbalancing
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@elasticloadbalancing", func() {
gucumber.World["client"] = elb.New(smoke.Session)
})
}
# language: en
@elasticloadbalancing @client
Feature: Elastic Load Balancing
Scenario: Making a request
When I call the "DescribeLoadBalancers" API
Then the value at "LoadBalancerDescriptions" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeLoadBalancers" API with JSON:
"""
{"LoadBalancerNames": ["fake_load_balancer"]}
"""
Then I expect the response error code to be "ValidationError"
And I expect the response error message to include:
"""
LoadBalancer name cannot contain characters that are not letters, or digits or the dash.
"""
// +build integration
//Package elastictranscoder provides gucumber integration tests support.
package elastictranscoder
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/elastictranscoder"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@elastictranscoder", func() {
gucumber.World["client"] = elastictranscoder.New(smoke.Session)
})
}
# language: en
@elastictranscoder @client
Feature: Amazon Elastic Transcoder
Scenario: Making a request
When I call the "ListPresets" API
Then the value at "Presets" should be a list
Scenario: Handling errors
When I attempt to call the "ReadJob" API with:
| Id | fake_job |
Then I expect the response error code to be "ValidationException"
And I expect the response error message to include:
"""
Value 'fake_job' at 'id' failed to satisfy constraint
"""
// +build integration
//Package emr provides gucumber integration tests support.
package emr
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/emr"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@emr", func() {
gucumber.World["client"] = emr.New(smoke.Session)
})
}
# language: en
@emr @client @elasticmapreduce
Feature: Amazon EMR
Scenario: Making a request
When I call the "ListClusters" API
Then the value at "Clusters" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeCluster" API with:
| ClusterId | fake_cluster |
Then I expect the response error code to be "InvalidRequestException"
And I expect the response error message to include:
"""
Cluster id 'fake_cluster' is not valid.
"""
// +build integration
//Package es provides gucumber integration tests support.
package es
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/elasticsearchservice"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@es", func() {
gucumber.World["client"] = elasticsearchservice.New(smoke.Session)
})
}
# language: en
@es @elasticsearchservice
Feature: Amazon ElasticsearchService
Scenario: Making a request
When I call the "ListDomainNames" API
Then the value at "DomainNames" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeElasticsearchDomain" API with:
| DomainName | not-a-domain |
Then the error code should be "ResourceNotFoundException"
And I expect the response error message to include:
"""
Domain not found: not-a-domain
"""
\ No newline at end of file
// +build integration
//Package glacier provides gucumber integration tests support.
package glacier
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/glacier"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@glacier", func() {
gucumber.World["client"] = glacier.New(smoke.Session)
})
}
# language: en
@glacier @client
Feature: Amazon Glacier
Scenario: Making a request
When I call the "ListVaults" API
Then the response should contain a "VaultList"
Scenario: Handling errors
When I attempt to call the "ListVaults" API with:
| accountId | abcmnoxyz |
Then I expect the response error code to be "UnrecognizedClientException"
And I expect the response error message to include:
"""
No account found for the given parameters
"""
// +build integration
//Package iam provides gucumber integration tests support.
package iam
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@iam", func() {
gucumber.World["client"] = iam.New(smoke.Session)
})
}
# language: en
@iam @client
Feature: AWS Identity and Access Management
Scenario: Making a request
When I call the "ListUsers" API
Then the value at "Users" should be a list
Scenario: Handling errors
When I attempt to call the "GetUser" API with:
| UserName | fake_user |
Then I expect the response error code to be "NoSuchEntity"
And I expect the response error message to include:
"""
The user with name fake_user cannot be found.
"""
// +build integration
//Package iotdataplane provides gucumber integration tests support.
package iotdataplane
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/iot"
"github.com/aws/aws-sdk-go/service/iotdataplane"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@iotdataplane", func() {
svc := iot.New(smoke.Session)
result, err := svc.DescribeEndpoint(&iot.DescribeEndpointInput{})
if err != nil {
gucumber.World["error"] = err
return
}
gucumber.World["client"] = iotdataplane.New(smoke.Session, aws.NewConfig().
WithEndpoint(*result.EndpointAddress))
})
}
# language: en
@iotdataplane @client
Feature: AWS IoT Data Plane
Scenario: Handling errors
When I attempt to call the "GetThingShadow" API with:
| ThingName | "fakeThing" |
Then I expect the response error code to be "InvalidRequestException"
And I expect the response error message to include:
"""
Invalid thing name
"""
// +build integration
//Package kinesis provides gucumber integration tests support.
package kinesis
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/kinesis"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@kinesis", func() {
gucumber.World["client"] = kinesis.New(smoke.Session)
})
}
# language: en
@kinesis @client
Feature: AWS Kinesis
Scenario: Making a request
When I call the "ListStreams" API
Then the value at "StreamNames" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeStream" API with:
| StreamName | bogus-stream-name |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
Stream bogus-stream-name under account
"""
// +build integration
//Package kms provides gucumber integration tests support.
package kms
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/kms"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@kms", func() {
gucumber.World["client"] = kms.New(smoke.Session)
})
}
# language: en
@kms @client
Feature: Amazon Key Management Service
Scenario: Making a request
When I call the "ListAliases" API
Then the value at "Aliases" should be a list
Scenario: Handling errors
When I attempt to call the "GetKeyPolicy" API with:
| KeyId | fake-key |
| PolicyName | fakepolicy |
Then I expect the response error code to be "NotFoundException"
// +build integration
//Package lambda provides gucumber integration tests support.
package lambda
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@lambda", func() {
gucumber.World["client"] = lambda.New(smoke.Session)
})
}
# language: en
@lambda @client
Feature: Amazon Lambda
Scenario: Making a request
When I call the "ListFunctions" API
Then the value at "Functions" should be a list
Scenario: Handling errors
When I attempt to call the "Invoke" API with:
| FunctionName | bogus-function |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
Function not found
"""
// +build integration
//Package machinelearning provides gucumber integration tests support.
package machinelearning
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/machinelearning"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@machinelearning", func() {
gucumber.World["client"] = machinelearning.New(smoke.Session)
})
}
# language: en
@machinelearning @client
Feature: Amazon Machine Learning
I want to use Amazon Machine Learning
Scenario: Making a request
When I call the "DescribeMLModels" API
Then the value at "Results" should be a list
Scenario: Error handling
When I attempt to call the "GetBatchPrediction" API with:
| BatchPredictionId | fake-id |
Then the error code should be "ResourceNotFoundException"
And the error message should contain:
"""
No BatchPrediction with id fake-id exists
"""
// +build integration
//Package opsworks provides gucumber integration tests support.
package opsworks
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/opsworks"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@opsworks", func() {
gucumber.World["client"] = opsworks.New(smoke.Session)
})
}
# language: en
@opsworks @client
Feature: AWS OpsWorks
Scenario: Making a request
When I call the "DescribeStacks" API
Then the value at "Stacks" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeLayers" API with:
| StackId | fake_stack |
Then I expect the response error code to be "ResourceNotFoundException"
And I expect the response error message to include:
"""
Unable to find stack with ID fake_stack
"""
// +build integration
//Package rds provides gucumber integration tests support.
package rds
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/rds"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@rds", func() {
gucumber.World["client"] = rds.New(smoke.Session)
})
}
# language: en
@rds @client
Feature: Amazon RDS
Scenario: Making a request
When I call the "DescribeDBEngineVersions" API
Then the value at "DBEngineVersions" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeDBInstances" API with:
| DBInstanceIdentifier | fake-id |
Then I expect the response error code to be "DBInstanceNotFound"
And I expect the response error message to include:
"""
DBInstance fake-id not found.
"""
// +build integration
//Package redshift provides gucumber integration tests support.
package redshift
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/redshift"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@redshift", func() {
gucumber.World["client"] = redshift.New(smoke.Session)
})
}
# language: en
@redshift @client
Feature: Amazon Redshift
Scenario: Making a request
When I call the "DescribeClusterVersions" API
Then the value at "ClusterVersions" should be a list
Scenario: Handling errors
When I attempt to call the "DescribeClusters" API with:
| ClusterIdentifier | fake-cluster |
Then I expect the response error code to be "ClusterNotFound"
And I expect the response error message to include:
"""
Cluster fake-cluster not found.
"""
// +build integration
//Package route53 provides gucumber integration tests support.
package route53
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/route53"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@route53", func() {
gucumber.World["client"] = route53.New(smoke.Session)
})
}
# language: en
@route53 @client
Feature: Amazon Route 53
Scenario: Making a request
When I call the "ListHostedZones" API
Then the value at "HostedZones" should be a list
Scenario: Handling errors
When I attempt to call the "GetHostedZone" API with:
| Id | fake-zone |
Then I expect the response error code to be "NoSuchHostedZone"
And I expect the response error message to include:
"""
No hosted zone found with ID: fake-zone
"""
// +build integration
//Package route53domains provides gucumber integration tests support.
package route53domains
import (
"github.com/aws/aws-sdk-go/awstesting/integration/smoke"
"github.com/aws/aws-sdk-go/service/route53domains"
"github.com/gucumber/gucumber"
)
func init() {
gucumber.Before("@route53domains", func() {
gucumber.World["client"] = route53domains.New(smoke.Session)
})
}
# language: en
@route53domains @client
Feature: Amazon Route53 Domains
Scenario: Making a request
When I call the "ListDomains" API
Then the value at "Domains" should be a list
Scenario: Handling errors
When I attempt to call the "GetDomainDetail" API with:
| DomainName | fake-domain-name |
Then I expect the response error code to be "InvalidInput"
And I expect the response error message to include:
"""
domain name must contain more than 1 label
"""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment