From 3f00834f2550e45e3cd2fec42a412362c26f91f4 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 19 Sep 2016 15:12:30 +0200 Subject: [PATCH] tech: remove unused dependencies --- .../grafana-cli/commands/install_command.go | 3 +- .../aws/aws-sdk-go/awstesting/assert.go | 163 --- .../aws/aws-sdk-go/awstesting/assert_test.go | 64 - .../aws/aws-sdk-go/awstesting/client.go | 20 - .../customizations/s3/integration_test.go | 124 -- .../customizations/s3/s3crypto/client.go | 29 - .../s3/s3crypto/s3_crypto.feature | 18 - .../customizations/s3/s3crypto/stepdef.go | 192 --- .../s3/s3manager/integration_test.go | 163 --- .../customizations/s3/s3manager/stub.go | 1 - .../integration/customizations/s3/stub.go | 1 - .../awstesting/integration/integration.go | 44 - .../integration/smoke/acm/acm.feature | 14 - .../integration/smoke/acm/client.go | 16 - .../smoke/apigateway/apigateway.feature | 16 - .../integration/smoke/apigateway/client.go | 16 - .../applicationdiscoveryservice.feature | 8 - .../applicationdiscoveryservice/client.go | 19 - .../smoke/autoscaling/autoscaling.feature | 18 - .../integration/smoke/autoscaling/client.go | 16 - .../smoke/cloudformation/client.go | 16 - .../cloudformation/cloudformation.feature | 17 - .../integration/smoke/cloudfront/client.go | 16 - .../smoke/cloudfront/cloudfront.feature | 17 - .../integration/smoke/cloudhsm/client.go | 16 - .../smoke/cloudhsm/cloudhsm.feature | 16 - .../integration/smoke/cloudsearch/client.go | 16 - .../smoke/cloudsearch/cloudsearch.feature | 16 - .../integration/smoke/cloudtrail/client.go | 16 - .../smoke/cloudtrail/cloudtrail.feature | 16 - .../integration/smoke/cloudwatch/client.go | 16 - .../smoke/cloudwatch/cloudwatch.feature | 19 - .../smoke/cloudwatchlogs/client.go | 16 - .../cloudwatchlogs/cloudwatchlogs.feature | 17 - .../integration/smoke/codecommit/client.go | 16 - .../smoke/codecommit/codecommit.feature | 16 - .../integration/smoke/codedeploy/client.go | 16 - .../smoke/codedeploy/codedeploy.feature | 16 - .../integration/smoke/codepipeline/client.go | 16 - .../smoke/codepipeline/codepipeline.feature | 16 - .../smoke/cognitoidentity/client.go | 16 - .../cognitoidentity/cognitoidentity.feature | 19 - .../integration/smoke/cognitosync/client.go | 16 - .../smoke/cognitosync/cognitosync.feature | 16 - .../integration/smoke/configservice/client.go | 16 - .../smoke/configservice/configservice.feature | 17 - .../integration/smoke/datapipeline/client.go | 16 - .../smoke/datapipeline/datapipeline.feature | 16 - .../integration/smoke/devicefarm/client.go | 19 - .../smoke/devicefarm/devicefarm.feature | 16 - .../integration/smoke/directconnect/client.go | 16 - .../smoke/directconnect/directconnect.feature | 16 - .../smoke/directoryservice/client.go | 16 - .../directoryservice/directoryservice.feature | 17 - .../integration/smoke/dynamodb/client.go | 16 - .../smoke/dynamodb/dynamodb.feature | 19 - .../smoke/dynamodbstreams/client.go | 16 - .../dynamodbstreams/dynamodbstreams.feature | 16 - .../integration/smoke/ec2/client.go | 16 - .../integration/smoke/ec2/ec2.feature | 18 - .../integration/smoke/ecs/client.go | 19 - .../integration/smoke/ecs/ecs.feature | 14 - .../integration/smoke/efs/client.go | 19 - .../integration/smoke/efs/efs.feature | 14 - .../integration/smoke/elasticache/client.go | 16 - .../smoke/elasticache/elasticache.feature | 16 - .../smoke/elasticbeanstalk/client.go | 16 - .../elasticbeanstalk/elasticbeanstalk.feature | 16 - .../smoke/elasticloadbalancing/client.go | 16 - .../elasticloadbalancing.feature | 18 - .../smoke/elastictranscoder/client.go | 16 - .../elastictranscoder.feature | 16 - .../integration/smoke/emr/client.go | 16 - .../integration/smoke/emr/emr.feature | 16 - .../awstesting/integration/smoke/es/client.go | 16 - .../integration/smoke/es/es.feature | 16 - .../integration/smoke/glacier/client.go | 16 - .../integration/smoke/glacier/glacier.feature | 16 - .../integration/smoke/iam/client.go | 16 - .../integration/smoke/iam/iam.feature | 16 - .../integration/smoke/iotdataplane/client.go | 26 - .../smoke/iotdataplane/iotdataplane.feature | 12 - .../integration/smoke/kinesis/client.go | 16 - .../integration/smoke/kinesis/kinesis.feature | 16 - .../integration/smoke/kms/client.go | 16 - .../integration/smoke/kms/kms.feature | 13 - .../integration/smoke/lambda/client.go | 16 - .../integration/smoke/lambda/lambda.feature | 16 - .../smoke/machinelearning/client.go | 16 - .../machinelearning/machinelearning.feature | 18 - .../integration/smoke/opsworks/client.go | 16 - .../smoke/opsworks/opsworks.feature | 16 - .../integration/smoke/rds/client.go | 16 - .../integration/smoke/rds/rds.feature | 16 - .../integration/smoke/redshift/client.go | 16 - .../smoke/redshift/redshift.feature | 16 - .../integration/smoke/route53/client.go | 16 - .../integration/smoke/route53/route53.feature | 16 - .../smoke/route53domains/client.go | 16 - .../route53domains/route53domains.feature | 16 - .../integration/smoke/ses/client.go | 16 - .../integration/smoke/ses/ses.feature | 16 - .../awstesting/integration/smoke/shared.go | 230 ---- .../integration/smoke/simpledb/client.go | 16 - .../smoke/simpledb/simpledb.feature | 24 - .../integration/smoke/sns/client.go | 16 - .../integration/smoke/sns/sns.feature | 14 - .../integration/smoke/sqs/client.go | 16 - .../integration/smoke/sqs/sqs.feature | 16 - .../integration/smoke/ssm/client.go | 16 - .../integration/smoke/ssm/ssm.feature | 16 - .../smoke/storagegateway/client.go | 16 - .../storagegateway/storagegateway.feature | 16 - .../integration/smoke/sts/client.go | 16 - .../integration/smoke/sts/sts.feature | 17 - .../integration/smoke/support/client.go | 16 - .../integration/smoke/support/support.feature | 22 - .../integration/smoke/swf/client.go | 16 - .../integration/smoke/swf/swf.feature | 17 - .../integration/smoke/waf/client.go | 16 - .../integration/smoke/waf/waf.feature | 20 - .../integration/smoke/workspaces/client.go | 16 - .../smoke/workspaces/workspaces.feature | 18 - .../aws/aws-sdk-go/awstesting/mock/mock.go | 43 - .../awstesting/performance/benchmarks.go | 122 -- .../awstesting/performance/client.go | 13 - .../awstesting/performance/clients.feature | 17 - .../awstesting/performance/clients.go | 137 -- .../aws-sdk-go/awstesting/performance/init.go | 93 -- .../awstesting/performance/logging.go | 122 -- .../awstesting/performance/streaming.feature | 26 - .../awstesting/sandbox/Dockerfile.golang-tip | 42 - .../awstesting/sandbox/Dockerfile.test.go1.4 | 7 - .../awstesting/sandbox/Dockerfile.test.go1.5 | 9 - .../sandbox/Dockerfile.test.go1.5-novendorexp | 7 - .../awstesting/sandbox/Dockerfile.test.go1.6 | 7 - .../awstesting/sandbox/Dockerfile.test.go1.7 | 7 - .../awstesting/sandbox/Dockerfile.test.gotip | 7 - .../aws/aws-sdk-go/awstesting/unit/unit.go | 13 - .../aws/aws-sdk-go/awstesting/util.go | 67 - .../aws/aws-sdk-go/awstesting/util_test.go | 49 - vendor/github.com/go-ini/ini/.gitignore | 4 - vendor/github.com/go-ini/ini/LICENSE | 191 --- vendor/github.com/go-ini/ini/README.md | 560 -------- vendor/github.com/go-ini/ini/README_ZH.md | 547 -------- vendor/github.com/go-ini/ini/ini.go | 1226 ----------------- vendor/github.com/go-ini/ini/ini_test.go | 512 ------- vendor/github.com/go-ini/ini/struct.go | 350 ----- vendor/github.com/go-ini/ini/struct_test.go | 239 ---- .../github.com/go-ini/ini/testdata/conf.ini | 2 - vendor/github.com/gopherjs/gopherjs/LICENSE | 24 - vendor/github.com/grafana/grafana-cli/LICENSE | 201 --- .../grafana-cli/pkg/commands/command_line.go | 35 - .../grafana-cli/pkg/commands/commands.go | 48 - .../commands/commandstest/fake_commandLine.go | 95 -- .../pkg/commands/commandstest/fake_ioutil.go | 55 - .../pkg/commands/install_command.go | 146 -- .../pkg/commands/listremote_command.go | 20 - .../grafana-cli/pkg/commands/ls_command.go | 49 - .../pkg/commands/remove_command.go | 35 - .../pkg/commands/upgrade_all_command.go | 61 - .../pkg/commands/upgrade_command.go | 9 - .../grafana/grafana-cli/pkg/log/log.go | 49 - .../grafana/grafana-cli/pkg/models/model.go | 48 - .../grafana-cli/pkg/services/io_util.go | 28 - .../grafana-cli/pkg/services/services.go | 70 - .../grafana-cli/pkg/version/version.go | 5 - vendor/github.com/influxdata/influxdb/LICENSE | 20 - .../influxdb/LICENSE_OF_DEPENDENCIES.md | 27 - .../smartystreets/goconvey/LICENSE.md | 23 - .../goconvey/convey/assertions.go | 65 - .../convey/assertions/assertions.goconvey | 3 - .../goconvey/convey/assertions/collections.go | 140 -- .../goconvey/convey/assertions/doc.go | 43 - .../goconvey/convey/assertions/equality.go | 279 ---- .../goconvey/convey/assertions/filter.go | 22 - .../goconvey/convey/assertions/init.go | 6 - .../goconvey/convey/assertions/messages.go | 87 -- .../convey/assertions/oglematchers/.gitignore | 5 - .../convey/assertions/oglematchers/LICENSE | 202 --- .../assertions/oglematchers/README.markdown | 56 - .../convey/assertions/oglematchers/all_of.go | 70 - .../convey/assertions/oglematchers/any.go | 32 - .../convey/assertions/oglematchers/any_of.go | 93 -- .../assertions/oglematchers/contains.go | 61 - .../assertions/oglematchers/deep_equals.go | 88 -- .../assertions/oglematchers/elements_are.go | 91 -- .../convey/assertions/oglematchers/equals.go | 529 ------- .../convey/assertions/oglematchers/error.go | 51 - .../oglematchers/greater_or_equal.go | 39 - .../assertions/oglematchers/greater_than.go | 39 - .../assertions/oglematchers/has_substr.go | 52 - .../assertions/oglematchers/identical_to.go | 134 -- .../assertions/oglematchers/less_or_equal.go | 41 - .../assertions/oglematchers/less_than.go | 152 -- .../convey/assertions/oglematchers/matcher.go | 82 -- .../assertions/oglematchers/matches_regexp.go | 69 - .../convey/assertions/oglematchers/not.go | 53 - .../oglematchers/oglematchers.goconvey | 2 - .../convey/assertions/oglematchers/panics.go | 74 - .../convey/assertions/oglematchers/pointee.go | 65 - .../oglematchers/transform_description.go | 36 - .../goconvey/convey/assertions/panic.go | 115 -- .../goconvey/convey/assertions/quantity.go | 141 -- .../goconvey/convey/assertions/serializer.go | 59 - .../goconvey/convey/assertions/strings.go | 183 --- .../goconvey/convey/assertions/time.go | 202 --- .../goconvey/convey/assertions/type.go | 112 -- .../smartystreets/goconvey/convey/context.go | 272 ---- .../goconvey/convey/convey.goconvey | 4 - .../goconvey/convey/discovery.go | 103 -- .../smartystreets/goconvey/convey/doc.go | 193 --- .../goconvey/convey/focused_execution_test.go | 72 - .../goconvey/convey/gotest/utils.go | 37 - .../smartystreets/goconvey/convey/init.go | 73 - .../convey/isolated_execution_test.go | 774 ----------- .../goconvey/convey/nilReporter.go | 15 - .../goconvey/convey/reporting/console.go | 16 - .../goconvey/convey/reporting/doc.go | 5 - .../goconvey/convey/reporting/dot.go | 40 - .../goconvey/convey/reporting/dot_test.go | 40 - .../goconvey/convey/reporting/gotest.go | 33 - .../goconvey/convey/reporting/gotest_test.go | 66 - .../goconvey/convey/reporting/init.go | 94 -- .../goconvey/convey/reporting/json.go | 88 -- .../goconvey/convey/reporting/printer.go | 57 - .../goconvey/convey/reporting/printer_test.go | 181 --- .../goconvey/convey/reporting/problems.go | 68 - .../convey/reporting/problems_test.go | 51 - .../goconvey/convey/reporting/reporter.go | 39 - .../convey/reporting/reporter_test.go | 94 -- .../convey/reporting/reporting.goconvey | 2 - .../goconvey/convey/reporting/reports.go | 177 --- .../goconvey/convey/reporting/statistics.go | 79 -- .../goconvey/convey/reporting/story.go | 73 - .../goconvey/convey/reporting_hooks_test.go | 317 ----- .../goconvey/convey/story_conventions_test.go | 184 --- 237 files changed, 1 insertion(+), 15141 deletions(-) delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/assert.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/assert_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/integration_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/stub.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/stub.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/acm.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/apigateway.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/applicationdiscoveryservice.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/autoscaling.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/cloudformation.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/cloudfront.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/cloudhsm.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/cloudsearch.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/cloudwatch.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/cloudwatchlogs.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/codecommit.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/codedeploy.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/codepipeline.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/cognitoidentity.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/cognitosync.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/configservice.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/datapipeline.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/devicefarm.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/directconnect.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/directoryservice.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/dynamodb.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/dynamodbstreams.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/ec2.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/ecs.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/efs.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/elasticache.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/elasticbeanstalk.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/elasticloadbalancing.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/elastictranscoder.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/emr.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/es.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/glacier.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/iam.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/kinesis.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/kms.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/lambda.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/machinelearning.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/opsworks.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/rds.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/redshift.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/route53.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/route53domains.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/ses.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/simpledb.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/sns.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/sqs.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/ssm.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/storagegateway.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/sts.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/support.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/swf.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/waf.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/workspaces.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/performance/streaming.feature delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.4 delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5 delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5-novendorexp delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.6 delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.7 delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.gotip delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/util.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/util_test.go delete mode 100644 vendor/github.com/go-ini/ini/.gitignore delete mode 100644 vendor/github.com/go-ini/ini/LICENSE delete mode 100644 vendor/github.com/go-ini/ini/README.md delete mode 100644 vendor/github.com/go-ini/ini/README_ZH.md delete mode 100644 vendor/github.com/go-ini/ini/ini.go delete mode 100644 vendor/github.com/go-ini/ini/ini_test.go delete mode 100644 vendor/github.com/go-ini/ini/struct.go delete mode 100644 vendor/github.com/go-ini/ini/struct_test.go delete mode 100644 vendor/github.com/go-ini/ini/testdata/conf.ini delete mode 100644 vendor/github.com/gopherjs/gopherjs/LICENSE delete mode 100644 vendor/github.com/grafana/grafana-cli/LICENSE delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/command_line.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/commands.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_commandLine.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_ioutil.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/install_command.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/listremote_command.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/ls_command.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/remove_command.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_all_command.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_command.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/log/log.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/models/model.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/services/io_util.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/services/services.go delete mode 100644 vendor/github.com/grafana/grafana-cli/pkg/version/version.go delete mode 100644 vendor/github.com/influxdata/influxdb/LICENSE delete mode 100644 vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md delete mode 100644 vendor/github.com/smartystreets/goconvey/LICENSE.md delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/assertions.goconvey delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/doc.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/equality.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/init.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/.gitignore delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/LICENSE delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/all_of.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/deep_equals.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/elements_are.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/error.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_or_equal.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_than.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/identical_to.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_or_equal.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_than.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/not.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/oglematchers.goconvey delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/panics.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/pointee.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/transform_description.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/panic.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/time.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/assertions/type.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/context.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/convey.goconvey delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/discovery.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/doc.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/init.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/nilReporter.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/console.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/init.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/json.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting/story.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go delete mode 100644 vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go index 451b61a2de3..1f391ea10b3 100644 --- a/pkg/cmd/grafana-cli/commands/install_command.go +++ b/pkg/cmd/grafana-cli/commands/install_command.go @@ -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 diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go b/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go deleted file mode 100644 index 10ad72767ba..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go +++ /dev/null @@ -1,163 +0,0 @@ -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 -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/assert_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/assert_test.go deleted file mode 100644 index 45903a5d35c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/assert_test.go +++ /dev/null @@ -1,64 +0,0 @@ -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: `foofoobarbar`, - a: `barbarfoofoo`, - 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) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/client.go deleted file mode 100644 index ca64a447815..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/client.go +++ /dev/null @@ -1,20 +0,0 @@ -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) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/integration_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/integration_test.go deleted file mode 100644 index 93d5ff60f51..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/integration_test.go +++ /dev/null @@ -1,124 +0,0 @@ -// +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)) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go deleted file mode 100644 index 83632d1a36b..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go +++ /dev/null @@ -1,29 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature deleted file mode 100644 index a7d433a9da7..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature +++ /dev/null @@ -1,18 +0,0 @@ -# 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 diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go deleted file mode 100644 index b558d8a715e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go +++ /dev/null @@ -1,192 +0,0 @@ -// +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: ®ion, - })) - - 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") -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go deleted file mode 100644 index 3a0dd600e1f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go +++ /dev/null @@ -1,163 +0,0 @@ -// +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) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/stub.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/stub.go deleted file mode 100644 index 9434ae97095..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/stub.go +++ /dev/null @@ -1 +0,0 @@ -package s3manager diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/stub.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/stub.go deleted file mode 100644 index 3ed7f97237d..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/stub.go +++ /dev/null @@ -1 +0,0 @@ -package s3 diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go deleted file mode 100644 index 88bcf1636a7..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go +++ /dev/null @@ -1,44 +0,0 @@ -// +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) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/acm.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/acm.feature deleted file mode 100644 index dc28b553381..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/acm.feature +++ /dev/null @@ -1,14 +0,0 @@ -#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 - diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go deleted file mode 100644 index fdb6438273a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/apigateway.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/apigateway.feature deleted file mode 100644 index 4286b81304a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/apigateway.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go deleted file mode 100644 index 10ee2de8777..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/applicationdiscoveryservice.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/applicationdiscoveryservice.feature deleted file mode 100644 index 02ae2874e7f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/applicationdiscoveryservice.feature +++ /dev/null @@ -1,8 +0,0 @@ -#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 - diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go deleted file mode 100644 index 85a4dab86c9..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go +++ /dev/null @@ -1,19 +0,0 @@ -// +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")}, - ) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/autoscaling.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/autoscaling.feature deleted file mode 100644 index 7c2bdf6cf1b..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/autoscaling.feature +++ /dev/null @@ -1,18 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go deleted file mode 100644 index 55c68d1cc9b..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go deleted file mode 100644 index 079fde7881f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/cloudformation.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/cloudformation.feature deleted file mode 100644 index 3eafaf6082e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/cloudformation.feature +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go deleted file mode 100644 index c958362e121..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/cloudfront.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/cloudfront.feature deleted file mode 100644 index bbb2a8d2ac1..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/cloudfront.feature +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go deleted file mode 100644 index 23f24beb169..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/cloudhsm.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/cloudhsm.feature deleted file mode 100644 index 545ca4efefc..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/cloudhsm.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go deleted file mode 100644 index c346b28217c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/cloudsearch.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/cloudsearch.feature deleted file mode 100644 index 160e916d242..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/cloudsearch.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go deleted file mode 100644 index 97c7bfa47cd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature deleted file mode 100644 index 7b5166a76cd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go deleted file mode 100644 index ebc339d2ddd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/cloudwatch.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/cloudwatch.feature deleted file mode 100644 index 84307ef2ac0..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/cloudwatch.feature +++ /dev/null @@ -1,19 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go deleted file mode 100644 index 75fa2c55651..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/cloudwatchlogs.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/cloudwatchlogs.feature deleted file mode 100644 index 5711c4e85fe..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/cloudwatchlogs.feature +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go deleted file mode 100644 index 2f9da3419ab..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/codecommit.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/codecommit.feature deleted file mode 100644 index c5c019055f8..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/codecommit.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go deleted file mode 100644 index 29587b9e61e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/codedeploy.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/codedeploy.feature deleted file mode 100644 index 45dfd2fa256..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/codedeploy.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go deleted file mode 100644 index edc34f61c27..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/codepipeline.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/codepipeline.feature deleted file mode 100644 index cb962cc89b1..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/codepipeline.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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' - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go deleted file mode 100644 index 476169f5bb4..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/cognitoidentity.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/cognitoidentity.feature deleted file mode 100644 index 12abcc8b8fb..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/cognitoidentity.feature +++ /dev/null @@ -1,19 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go deleted file mode 100644 index 585e47c64dd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/cognitosync.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/cognitosync.feature deleted file mode 100644 index 3cdf84ec1b4..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/cognitosync.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go deleted file mode 100644 index fed62290a7c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/configservice.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/configservice.feature deleted file mode 100644 index ccc3af6f86a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/configservice.feature +++ /dev/null @@ -1,17 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go deleted file mode 100644 index 10bb6f1d8e6..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/datapipeline.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/datapipeline.feature deleted file mode 100644 index db315184abd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/datapipeline.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go deleted file mode 100644 index f1bcbf71b1f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go +++ /dev/null @@ -1,19 +0,0 @@ -// +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")) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/devicefarm.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/devicefarm.feature deleted file mode 100644 index 1d200a9d798..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/devicefarm.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go deleted file mode 100644 index c86e5d8cf88..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/directconnect.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/directconnect.feature deleted file mode 100644 index 3efd9c7dcdd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/directconnect.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go deleted file mode 100644 index ae2fbbac169..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/directoryservice.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/directoryservice.feature deleted file mode 100644 index 315839b66fa..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/directoryservice.feature +++ /dev/null @@ -1,17 +0,0 @@ -# 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" - diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go deleted file mode 100644 index 5e3d3fb5f75..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/dynamodb.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/dynamodb.feature deleted file mode 100644 index 1df6b3ccb6f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/dynamodb.feature +++ /dev/null @@ -1,19 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go deleted file mode 100644 index 64cedf27414..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/dynamodbstreams.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/dynamodbstreams.feature deleted file mode 100644 index 6e35e29eb9f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/dynamodbstreams.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go deleted file mode 100644 index 68201536c2c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/ec2.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/ec2.feature deleted file mode 100644 index e238c2cd67e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/ec2.feature +++ /dev/null @@ -1,18 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go deleted file mode 100644 index 0db822495b2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go +++ /dev/null @@ -1,19 +0,0 @@ -// +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")) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/ecs.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/ecs.feature deleted file mode 100644 index 69421378581..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/ecs.feature +++ /dev/null @@ -1,14 +0,0 @@ -# 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" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go deleted file mode 100644 index fba6a32aa8a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go +++ /dev/null @@ -1,19 +0,0 @@ -// +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")) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/efs.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/efs.feature deleted file mode 100644 index 113dd350115..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/efs.feature +++ /dev/null @@ -1,14 +0,0 @@ -# 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" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go deleted file mode 100644 index 386237fcf39..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/elasticache.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/elasticache.feature deleted file mode 100644 index 48828ca2d3f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/elasticache.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go deleted file mode 100644 index 61cb2e1e74f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/elasticbeanstalk.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/elasticbeanstalk.feature deleted file mode 100644 index 35b1ad884ab..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/elasticbeanstalk.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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'. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go deleted file mode 100644 index 6682a779c48..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/elasticloadbalancing.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/elasticloadbalancing.feature deleted file mode 100644 index a8c72090849..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/elasticloadbalancing.feature +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go deleted file mode 100644 index 7e29b473636..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/elastictranscoder.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/elastictranscoder.feature deleted file mode 100644 index 77658e66836..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/elastictranscoder.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go deleted file mode 100644 index 41295c77ac1..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/emr.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/emr.feature deleted file mode 100644 index 133c17412d2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/emr.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go deleted file mode 100644 index 33e59c4cb03..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/es.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/es.feature deleted file mode 100644 index 8bd1f1e4967..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/es.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go deleted file mode 100644 index 26235abd11e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/glacier.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/glacier.feature deleted file mode 100644 index 0e1a113a3b6..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/glacier.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go deleted file mode 100644 index d551c73fb46..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/iam.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/iam.feature deleted file mode 100644 index 0da6463ae01..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/iam.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go deleted file mode 100644 index 30921c332d3..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go +++ /dev/null @@ -1,26 +0,0 @@ -// +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)) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature deleted file mode 100644 index a6ced14d7b9..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature +++ /dev/null @@ -1,12 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go deleted file mode 100644 index 5081bfe0f37..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/kinesis.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/kinesis.feature deleted file mode 100644 index 570505cd275..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/kinesis.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go deleted file mode 100644 index e9498b30048..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/kms.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/kms.feature deleted file mode 100644 index ee428abb86c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/kms.feature +++ /dev/null @@ -1,13 +0,0 @@ -# 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" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go deleted file mode 100644 index 257bc264bcc..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/lambda.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/lambda.feature deleted file mode 100644 index 6ff9cf4a304..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/lambda.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go deleted file mode 100644 index a8ba24c9c99..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/machinelearning.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/machinelearning.feature deleted file mode 100644 index 2d9b0649ada..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/machinelearning.feature +++ /dev/null @@ -1,18 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go deleted file mode 100644 index 8f3f537a3cf..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/opsworks.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/opsworks.feature deleted file mode 100644 index a9cfe52b56f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/opsworks.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go deleted file mode 100644 index a12c73bf3bb..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/rds.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/rds.feature deleted file mode 100644 index 547d76db845..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/rds.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go deleted file mode 100644 index 9e6da95427a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/redshift.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/redshift.feature deleted file mode 100644 index 8cb45b14cda..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/redshift.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go deleted file mode 100644 index a55a14ee224..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/route53.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/route53.feature deleted file mode 100644 index 51463c5245f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/route53.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go deleted file mode 100644 index c47de45f0f1..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +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) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/route53domains.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/route53domains.feature deleted file mode 100644 index f18dcc4e14c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/route53domains.feature +++ /dev/null @@ -1,16 +0,0 @@ -# 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 - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go deleted file mode 100644 index f81947ac68a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package ses provides gucumber integration tests support. -package ses - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/ses" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@ses", func() { - gucumber.World["client"] = ses.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/ses.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/ses.feature deleted file mode 100644 index 6b67fa7f3d9..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/ses.feature +++ /dev/null @@ -1,16 +0,0 @@ -# language: en -@ses @email @client -Feature: Amazon Simple Email Service - - Scenario: Making a request - When I call the "ListIdentities" API - Then the value at "Identities" should be a list - - Scenario: Handling errors - When I attempt to call the "VerifyEmailIdentity" API with: - | EmailAddress | fake_email | - Then I expect the response error code to be "InvalidParameterValue" - And I expect the response error message to include: - """ - Invalid email address. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go deleted file mode 100644 index dbb1338f9b0..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go +++ /dev/null @@ -1,230 +0,0 @@ -// +build integration - -// Package smoke contains shared step definitions that are used across integration tests -package smoke - -import ( - "encoding/json" - "fmt" - "os" - "reflect" - "regexp" - "strconv" - "strings" - - "github.com/gucumber/gucumber" - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/session" -) - -// Session is a shared session for all integration smoke 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.LogDebugWithHTTPBody) - } - Session.Config.LogLevel = logLevel - - gucumber.When(`^I call the "(.+?)" API$`, func(op string) { - call(op, nil, false) - }) - - gucumber.When(`^I call the "(.+?)" API with:$`, func(op string, args [][]string) { - call(op, args, false) - }) - - gucumber.Then(`^the value at "(.+?)" should be a list$`, func(member string) { - vals, _ := awsutil.ValuesAtPath(gucumber.World["response"], member) - assert.NotNil(gucumber.T, vals) - }) - - gucumber.Then(`^the response should contain a "(.+?)"$`, func(member string) { - vals, _ := awsutil.ValuesAtPath(gucumber.World["response"], member) - assert.NotEmpty(gucumber.T, vals) - }) - - gucumber.When(`^I attempt to call the "(.+?)" API with:$`, func(op string, args [][]string) { - call(op, args, true) - }) - - gucumber.Then(`^I expect the response error code to be "(.+?)"$`, func(code string) { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - if ok { - assert.Equal(gucumber.T, code, err.Code(), "Error: %v", err) - } - }) - - gucumber.And(`^I expect the response error message to include:$`, func(data string) { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - if ok { - assert.Contains(gucumber.T, err.Error(), data) - } - }) - - gucumber.And(`^I expect the response error message to include one of:$`, func(table [][]string) { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - if ok { - found := false - for _, row := range table { - if strings.Contains(err.Error(), row[0]) { - found = true - break - } - } - - assert.True(gucumber.T, found, fmt.Sprintf("no error messages matched: \"%s\"", err.Error())) - } - }) - - gucumber.And(`^I expect the response error message not be empty$`, func() { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - assert.NotEmpty(gucumber.T, err.Message()) - }) - - gucumber.When(`^I call the "(.+?)" API with JSON:$`, func(s1 string, data string) { - callWithJSON(s1, data, false) - }) - - gucumber.When(`^I attempt to call the "(.+?)" API with JSON:$`, func(s1 string, data string) { - callWithJSON(s1, data, true) - }) - - gucumber.Then(`^the error code should be "(.+?)"$`, func(s1 string) { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - assert.Equal(gucumber.T, s1, err.Code()) - }) - - gucumber.And(`^the error message should contain:$`, func(data string) { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - assert.Contains(gucumber.T, err.Error(), data) - }) - - gucumber.Then(`^the request should fail$`, func() { - err, ok := gucumber.World["error"].(awserr.Error) - assert.True(gucumber.T, ok, "no error returned") - assert.Error(gucumber.T, err) - }) - - gucumber.Then(`^the request should be successful$`, func() { - err, ok := gucumber.World["error"].(awserr.Error) - assert.False(gucumber.T, ok, "error returned") - assert.NoError(gucumber.T, err) - }) -} - -// findMethod finds the op operation on the v structure using a case-insensitive -// lookup. Returns nil if no method is found. -func findMethod(v reflect.Value, op string) *reflect.Value { - t := v.Type() - op = strings.ToLower(op) - for i := 0; i < t.NumMethod(); i++ { - name := t.Method(i).Name - if strings.ToLower(name) == op { - m := v.MethodByName(name) - return &m - } - } - return nil -} - -// call calls an operation on gucumber.World["client"] by the name op using the args -// table of arguments to set. -func call(op string, args [][]string, allowError bool) { - v := reflect.ValueOf(gucumber.World["client"]) - if m := findMethod(v, op); m != nil { - t := m.Type() - in := reflect.New(t.In(0).Elem()) - fillArgs(in, args) - - resps := m.Call([]reflect.Value{in}) - gucumber.World["response"] = resps[0].Interface() - gucumber.World["error"] = resps[1].Interface() - - if !allowError { - err, _ := gucumber.World["error"].(error) - assert.NoError(gucumber.T, err) - } - } else { - assert.Fail(gucumber.T, "failed to find operation "+op) - } -} - -// reIsNum is a regular expression matching a numeric input (integer) -var reIsNum = regexp.MustCompile(`^\d+$`) - -// reIsArray is a regular expression matching a list -var reIsArray = regexp.MustCompile(`^\['.*?'\]$`) -var reArrayElem = regexp.MustCompile(`'(.+?)'`) - -// fillArgs fills arguments on the input structure using the args table of -// arguments. -func fillArgs(in reflect.Value, args [][]string) { - if args == nil { - return - } - - for _, row := range args { - path := row[0] - var val interface{} = row[1] - if reIsArray.MatchString(row[1]) { - quotedStrs := reArrayElem.FindAllString(row[1], -1) - strs := make([]*string, len(quotedStrs)) - for i, e := range quotedStrs { - str := e[1 : len(e)-1] - strs[i] = &str - } - val = strs - } else if reIsNum.MatchString(row[1]) { // handle integer values - num, err := strconv.ParseInt(row[1], 10, 64) - if err == nil { - val = num - } - } - awsutil.SetValueAtPath(in.Interface(), path, val) - } -} - -func callWithJSON(op, j string, allowError bool) { - v := reflect.ValueOf(gucumber.World["client"]) - if m := findMethod(v, op); m != nil { - t := m.Type() - in := reflect.New(t.In(0).Elem()) - fillJSON(in, j) - - resps := m.Call([]reflect.Value{in}) - gucumber.World["response"] = resps[0].Interface() - gucumber.World["error"] = resps[1].Interface() - - if !allowError { - err, _ := gucumber.World["error"].(error) - assert.NoError(gucumber.T, err) - } - } else { - assert.Fail(gucumber.T, "failed to find operation "+op) - } -} - -func fillJSON(in reflect.Value, j string) { - d := json.NewDecoder(strings.NewReader(j)) - if err := d.Decode(in.Interface()); err != nil { - panic(err) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go deleted file mode 100644 index e8d9ec269a2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package simpledb provides gucumber integration tests support. -package simpledb - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/simpledb" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@simpledb", func() { - gucumber.World["client"] = simpledb.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/simpledb.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/simpledb.feature deleted file mode 100644 index ddc03d83185..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/simpledb.feature +++ /dev/null @@ -1,24 +0,0 @@ -# language: en -@simpledb @sdb -Feature: Amazon SimpleDB - - I want to use Amazon SimpleDB - - Scenario: Making a request - When I call the "CreateDomain" API with: - | DomainName | sample-domain | - Then the request should be successful - And I call the "ListDomains" API - Then the value at "DomainNames" should be a list - And I call the "DeleteDomain" API with: - | DomainName | sample-domain | - Then the request should be successful - - Scenario: Handling errors - When I attempt to call the "CreateDomain" API with: - | DomainName | | - Then I expect the response error code to be "InvalidParameterValue" - And I expect the response error message to include: - """ - DomainName is invalid - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go deleted file mode 100644 index cbf990c0eef..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package sns provides gucumber integration tests support. -package sns - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/sns" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@sns", func() { - gucumber.World["client"] = sns.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/sns.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/sns.feature deleted file mode 100644 index 76f6a16daf2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/sns.feature +++ /dev/null @@ -1,14 +0,0 @@ -# language: en -@sns @client -Feature: Amazon Simple Notification Service - - Scenario: Making a request - When I call the "ListTopics" API - Then the value at "Topics" should be a list - - Scenario: Handling errors - When I attempt to call the "Publish" API with: - | Message | hello | - | TopicArn | fake_topic | - Then I expect the response error code to be "InvalidParameter" - And I expect the response error message not be empty diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go deleted file mode 100644 index 884dbbdbd9d..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package sqs provides gucumber integration tests support. -package sqs - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/sqs" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@sqs", func() { - gucumber.World["client"] = sqs.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/sqs.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/sqs.feature deleted file mode 100644 index 1413820c018..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/sqs.feature +++ /dev/null @@ -1,16 +0,0 @@ -# language: en -@sqs @client -Feature: Amazon Simple Queue Service - - Scenario: Making a request - When I call the "ListQueues" API - Then the value at "QueueUrls" should be a list - - Scenario: Handling errors - When I attempt to call the "GetQueueUrl" API with: - | QueueName | fake_queue | - Then I expect the response error code to be "AWS.SimpleQueueService.NonExistentQueue" - And I expect the response error message to include: - """ - The specified queue does not exist for this wsdl version. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go deleted file mode 100644 index af5e2aa50c4..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package ssm provides gucumber integration tests support. -package ssm - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/ssm" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@ssm", func() { - gucumber.World["client"] = ssm.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/ssm.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/ssm.feature deleted file mode 100644 index 3e2230ed0b2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/ssm.feature +++ /dev/null @@ -1,16 +0,0 @@ -# language: en -@ssm @client -Feature: Amazon SSM - - Scenario: Making a request - When I call the "ListDocuments" API - Then the value at "DocumentIdentifiers" should be a list - - Scenario: Handling errors - When I attempt to call the "GetDocument" API with: - | Name | 'fake-name' | - Then I expect the response error code to be "ValidationException" - And I expect the response error message to include: - """ - validation error detected - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go deleted file mode 100644 index 44d37317a1b..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package storagegateway provides gucumber integration tests support. -package storagegateway - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/storagegateway" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@storagegateway", func() { - gucumber.World["client"] = storagegateway.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/storagegateway.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/storagegateway.feature deleted file mode 100644 index ef96eed9814..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/storagegateway.feature +++ /dev/null @@ -1,16 +0,0 @@ -# language: en -@storagegateway @client -Feature: AWS Storage Gateway - - Scenario: Making a request - When I call the "ListGateways" API - Then the value at "Gateways" should be a list - - Scenario: Handling errors - When I attempt to call the "ListVolumes" API with: - | GatewayARN | fake_gateway | - Then I expect the response error code to be "InvalidParameter" - And I expect the response error message to include: - """ - GatewayARN - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go deleted file mode 100644 index ed61e1b25e2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package sts provides gucumber integration tests support. -package sts - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@sts", func() { - gucumber.World["client"] = sts.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/sts.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/sts.feature deleted file mode 100644 index 9caf1fa020e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/sts.feature +++ /dev/null @@ -1,17 +0,0 @@ -# language: en -@sts @client -Feature: AWS STS - - Scenario: Making a request - When I call the "GetSessionToken" API - Then the response should contain a "Credentials" - - Scenario: Handling errors - When I attempt to call the "GetFederationToken" API with: - | Name | temp | - | Policy | | - Then I expect the response error code to be "InvalidParameter" - And I expect the response error message to include: - """ - Policy - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go deleted file mode 100644 index 9322d578835..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package support provides gucumber integration tests support. -package support - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/support" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@support", func() { - gucumber.World["client"] = support.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/support.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/support.feature deleted file mode 100644 index 2f91ff8965a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/support.feature +++ /dev/null @@ -1,22 +0,0 @@ -# language: en -@support @client -Feature: AWS Support - - I want to use AWS Support - - Scenario: Making a request - When I call the "DescribeServices" API - Then the value at "services" should be a list - - Scenario: Handling errors - When I attempt to call the "CreateCase" API with: - | subject | subject | - | communicationBody | communication | - | categoryCode | category | - | serviceCode | amazon-dynamodb | - | severityCode | low | - Then I expect the response error code to be "InvalidParameterValueException" - And the error message should contain: - """ - Invalid category code - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go deleted file mode 100644 index 09020a2f30c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package swf provides gucumber integration tests support. -package swf - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/swf" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@swf", func() { - gucumber.World["client"] = swf.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/swf.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/swf.feature deleted file mode 100644 index 1349c813306..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/swf.feature +++ /dev/null @@ -1,17 +0,0 @@ -# language: en -@swf @client -Feature: Amazon Simple Workflow Service - - Scenario: Making a request - When I call the "ListDomains" API with: - | registrationStatus | REGISTERED | - Then the value at "domainInfos" should be a list - - Scenario: Handling errors - When I attempt to call the "DescribeDomain" API with: - | name | fake_domain | - Then I expect the response error code to be "UnknownResourceFault" - And I expect the response error message to include: - """ - Unknown domain: fake_domain - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go deleted file mode 100644 index 898f848faf6..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package waf provides gucumber integration tests support. -package waf - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/waf" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@waf", func() { - gucumber.World["client"] = waf.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/waf.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/waf.feature deleted file mode 100644 index bf76fb661a9..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/waf.feature +++ /dev/null @@ -1,20 +0,0 @@ -# language: en -@waf -Feature: AWS WAF - - Scenario: Making a request - When I call the "ListRules" API with JSON: - """ - {"Limit":20} - """ - Then the value at "Rules" should be a list - - Scenario: Handling errors - When I attempt to call the "CreateSqlInjectionMatchSet" API with: - | Name | fake_name | - | ChangeToken | fake_token | - Then I expect the response error code to be "WAFStaleDataException" - And I expect the response error message to include: - """ - The input token is no longer current - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go deleted file mode 100644 index 320fb1adc59..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build integration - -//Package workspaces provides gucumber integration tests support. -package workspaces - -import ( - "github.com/aws/aws-sdk-go/awstesting/integration/smoke" - "github.com/aws/aws-sdk-go/service/workspaces" - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@workspaces", func() { - gucumber.World["client"] = workspaces.New(smoke.Session) - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/workspaces.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/workspaces.feature deleted file mode 100644 index 09ca8849177..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/workspaces.feature +++ /dev/null @@ -1,18 +0,0 @@ -# language: en -@workspaces @client -Feature: Amazon WorkSpaces - - I want to use Amazon WorkSpaces - - Scenario: Making a request - When I call the "DescribeWorkspaces" API - Then the value at "Workspaces" should be a list - - Scenario: Handling errors - When I attempt to call the "DescribeWorkspaces" API with: - | DirectoryId | fake-id | - Then I expect the response error code to be "ValidationException" - And I expect the response error message to include: - """ - The Directory ID fake-id in the request is invalid. - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go b/vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go deleted file mode 100644 index 9f180074523..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go +++ /dev/null @@ -1,43 +0,0 @@ -package mock - -import ( - "net/http" - "net/http/httptest" - - "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/session" -) - -// Session is a mock session which is used to hit the mock server -var Session = session.Must(session.NewSession(&aws.Config{ - DisableSSL: aws.Bool(true), - Endpoint: aws.String(server.URL[7:]), -})) - -// server is the mock server that simply writes a 200 status back to the client -var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) -})) - -// NewMockClient creates and initializes a client that will connect to the -// mock server -func NewMockClient(cfgs ...*aws.Config) *client.Client { - c := Session.ClientConfig("Mock", cfgs...) - - svc := client.New( - *c.Config, - metadata.ClientInfo{ - ServiceName: "Mock", - SigningRegion: c.SigningRegion, - Endpoint: c.Endpoint, - APIVersion: "2015-12-08", - JSONVersion: "1.1", - TargetPrefix: "MockServer", - }, - c.Handlers, - ) - - return svc -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go deleted file mode 100644 index de136582ec9..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go +++ /dev/null @@ -1,122 +0,0 @@ -// +build integration - -package performance - -import ( - "errors" - "fmt" - "os" - "reflect" - "runtime" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/mock" - "github.com/gucumber/gucumber" -) - -// mapCreateClients allows for the creation of clients -func mapCreateClients() { - clientFns := []func(){} - for _, c := range clients { - clientFns = append(clientFns, func() { c.Call([]reflect.Value{reflect.ValueOf(mock.Session)}) }) - } - - gucumber.World["services"] = clientFns -} - -func buildAnArrayOfClients() { - methods := []reflect.Value{} - params := [][]reflect.Value{} - - for _, c := range clients { - method, param, err := findAndGetMethod(c.Call([]reflect.Value{reflect.ValueOf(mock.Session)})) - if err == nil { - methods = append(methods, method) - params = append(params, param) - } - } - - fns := []func(){} - for i := 0; i < len(methods); i++ { - m := methods[i] - p := params[i] - f := func() { - reqs := m.Call(p) - resp := reqs[0].Interface().(*request.Request).Send() - fmt.Println(resp) - } - fns = append(fns, f) - } - gucumber.World["clientFns"] = fns -} - -// findAndGetMethod will grab the method, params to be passed to the method, and an error. -// The method that is found, is a method that doesn't have any required input -func findAndGetMethod(client interface{}) (reflect.Value, []reflect.Value, error) { - v := reflect.ValueOf(client).Type() - n := v.NumMethod() - -outer: - for i := 0; i < n; i++ { - method := v.Method(i) - if method.Type.NumIn() != 2 || strings.HasSuffix(method.Name, "Request") { - continue - } - param := reflect.New(method.Type.In(1).Elem()) - for j := 0; j < param.Elem().NumField(); j++ { - field := param.Elem().Type().Field(j) - req := field.Tag.Get("required") - - if req == "true" { - continue outer - } - } - - params := []reflect.Value{reflect.ValueOf(client), param} - return method.Func, params, nil - } - - return reflect.Value{}, nil, errors.New("No method found") -} - -// benchmarkTask takes a unique key to write to the logger with the benchmark -// result's data -func benchmarkTask(key string, fns []func(), i1 int) error { - gucumber.World["error"] = nil - memStatStart := &runtime.MemStats{} - runtime.ReadMemStats(memStatStart) - - results := testing.Benchmark(func(b *testing.B) { - for _, f := range fns { - for i := 0; i < i1; i++ { - f() - } - } - }) - - results.N = i1 - memStatEnd := &runtime.MemStats{} - runtime.ReadMemStats(memStatEnd) - l, err := newBenchmarkLogger("stdout") - if err != nil { - return err - } - l.log(key, results) - - toDynamodb := os.Getenv("AWS_TESTING_LOG_RESULTS") == "true" - if toDynamodb { - l, err := newBenchmarkLogger("dynamodb") - if err != nil { - return err - } - l.log(key+"_start_benchmarks", memStatStart) - l.log(key+"_end_benchmarks", memStatEnd) - } - - if memStatStart.Alloc < memStatEnd.Alloc { - return errors.New("Leaked memory") - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go deleted file mode 100644 index 00c2e8122e4..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build integration - -//Package performance provides gucumber integration tests support. -package performance - -import ( - "github.com/gucumber/gucumber" -) - -func init() { - gucumber.Before("@performance", func() { - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.feature deleted file mode 100644 index c248329e094..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.feature +++ /dev/null @@ -1,17 +0,0 @@ -# language: en -@performance @clients -Feature: Client Performance - Background: - Given I have loaded my SDK and its dependencies - And I have a list of services - And I take a snapshot of my resources - - Scenario: Creating and then cleaning up clients doesn't leak resources - When I create and discard 100 clients for each service - Then I should not have leaked any resources - - Scenario: Sending requests doesn't leak resources - When I create a client for each service - And I execute 100 command(s) on each client - And I destroy all the clients - Then I should not have leaked any resources diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.go deleted file mode 100644 index 6baa4444bfd..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/clients.go +++ /dev/null @@ -1,137 +0,0 @@ -// +build integration - -package performance - -import ( - "reflect" - - "github.com/aws/aws-sdk-go/service/acm" - "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/aws/aws-sdk-go/service/autoscaling" - "github.com/aws/aws-sdk-go/service/cloudformation" - "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/aws/aws-sdk-go/service/cloudhsm" - "github.com/aws/aws-sdk-go/service/cloudsearch" - "github.com/aws/aws-sdk-go/service/cloudsearchdomain" - "github.com/aws/aws-sdk-go/service/cloudtrail" - "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/aws/aws-sdk-go/service/cloudwatchevents" - "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - "github.com/aws/aws-sdk-go/service/codecommit" - "github.com/aws/aws-sdk-go/service/codedeploy" - "github.com/aws/aws-sdk-go/service/codepipeline" - "github.com/aws/aws-sdk-go/service/cognitoidentity" - "github.com/aws/aws-sdk-go/service/cognitosync" - "github.com/aws/aws-sdk-go/service/configservice" - "github.com/aws/aws-sdk-go/service/datapipeline" - "github.com/aws/aws-sdk-go/service/devicefarm" - "github.com/aws/aws-sdk-go/service/directconnect" - "github.com/aws/aws-sdk-go/service/directoryservice" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/dynamodbstreams" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/ecr" - "github.com/aws/aws-sdk-go/service/ecs" - "github.com/aws/aws-sdk-go/service/efs" - "github.com/aws/aws-sdk-go/service/elasticache" - "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - "github.com/aws/aws-sdk-go/service/elasticsearchservice" - "github.com/aws/aws-sdk-go/service/elastictranscoder" - "github.com/aws/aws-sdk-go/service/elb" - "github.com/aws/aws-sdk-go/service/emr" - "github.com/aws/aws-sdk-go/service/firehose" - "github.com/aws/aws-sdk-go/service/glacier" - "github.com/aws/aws-sdk-go/service/iam" - "github.com/aws/aws-sdk-go/service/inspector" - "github.com/aws/aws-sdk-go/service/iot" - "github.com/aws/aws-sdk-go/service/iotdataplane" - "github.com/aws/aws-sdk-go/service/kinesis" - "github.com/aws/aws-sdk-go/service/kms" - "github.com/aws/aws-sdk-go/service/lambda" - "github.com/aws/aws-sdk-go/service/machinelearning" - "github.com/aws/aws-sdk-go/service/marketplacecommerceanalytics" - "github.com/aws/aws-sdk-go/service/mobileanalytics" - "github.com/aws/aws-sdk-go/service/opsworks" - "github.com/aws/aws-sdk-go/service/rds" - "github.com/aws/aws-sdk-go/service/redshift" - "github.com/aws/aws-sdk-go/service/route53" - "github.com/aws/aws-sdk-go/service/route53domains" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/service/ses" - "github.com/aws/aws-sdk-go/service/simpledb" - "github.com/aws/aws-sdk-go/service/sns" - "github.com/aws/aws-sdk-go/service/sqs" - "github.com/aws/aws-sdk-go/service/ssm" - "github.com/aws/aws-sdk-go/service/storagegateway" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/aws/aws-sdk-go/service/support" - "github.com/aws/aws-sdk-go/service/swf" - "github.com/aws/aws-sdk-go/service/waf" - "github.com/aws/aws-sdk-go/service/workspaces" -) - -var clients = []reflect.Value{ - reflect.ValueOf(acm.New), - reflect.ValueOf(apigateway.New), - reflect.ValueOf(autoscaling.New), - reflect.ValueOf(cloudformation.New), - reflect.ValueOf(cloudfront.New), - reflect.ValueOf(cloudhsm.New), - reflect.ValueOf(cloudsearch.New), - reflect.ValueOf(cloudsearchdomain.New), - reflect.ValueOf(cloudtrail.New), - reflect.ValueOf(cloudwatch.New), - reflect.ValueOf(cloudwatchevents.New), - reflect.ValueOf(cloudwatchlogs.New), - reflect.ValueOf(codecommit.New), - reflect.ValueOf(codedeploy.New), - reflect.ValueOf(codepipeline.New), - reflect.ValueOf(cognitoidentity.New), - reflect.ValueOf(cognitosync.New), - reflect.ValueOf(configservice.New), - reflect.ValueOf(datapipeline.New), - reflect.ValueOf(devicefarm.New), - reflect.ValueOf(directconnect.New), - reflect.ValueOf(directoryservice.New), - reflect.ValueOf(dynamodb.New), - reflect.ValueOf(dynamodbstreams.New), - reflect.ValueOf(ec2.New), - reflect.ValueOf(ecr.New), - reflect.ValueOf(ecs.New), - reflect.ValueOf(efs.New), - reflect.ValueOf(elasticache.New), - reflect.ValueOf(elasticbeanstalk.New), - reflect.ValueOf(elasticsearchservice.New), - reflect.ValueOf(elastictranscoder.New), - reflect.ValueOf(elb.New), - reflect.ValueOf(emr.New), - reflect.ValueOf(firehose.New), - reflect.ValueOf(glacier.New), - reflect.ValueOf(iam.New), - reflect.ValueOf(inspector.New), - reflect.ValueOf(iot.New), - reflect.ValueOf(iotdataplane.New), - reflect.ValueOf(kinesis.New), - reflect.ValueOf(kms.New), - reflect.ValueOf(lambda.New), - reflect.ValueOf(machinelearning.New), - reflect.ValueOf(marketplacecommerceanalytics.New), - reflect.ValueOf(mobileanalytics.New), - reflect.ValueOf(opsworks.New), - reflect.ValueOf(rds.New), - reflect.ValueOf(redshift.New), - reflect.ValueOf(route53.New), - reflect.ValueOf(route53domains.New), - reflect.ValueOf(s3.New), - reflect.ValueOf(ses.New), - reflect.ValueOf(simpledb.New), - reflect.ValueOf(sns.New), - reflect.ValueOf(sqs.New), - reflect.ValueOf(ssm.New), - reflect.ValueOf(storagegateway.New), - reflect.ValueOf(sts.New), - reflect.ValueOf(support.New), - reflect.ValueOf(swf.New), - reflect.ValueOf(waf.New), - reflect.ValueOf(workspaces.New), -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go deleted file mode 100644 index 81596d1c882..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go +++ /dev/null @@ -1,93 +0,0 @@ -// +build integration - -package performance - -import ( - "bytes" - "errors" - "fmt" - "runtime" - - "github.com/gucumber/gucumber" - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/awstesting/mock" - "github.com/aws/aws-sdk-go/service/s3" -) - -func init() { - // Go loads all of its dependecies on compile - gucumber.Given(`^I have loaded my SDK and its dependencies$`, func() { - }) - - // Performance - gucumber.When(`^I create and discard (\d+) clients for each service$`, func(i1 int) { - services := gucumber.World["services"].([]func()) - err := benchmarkTask(fmt.Sprintf("%d_create_and_discard_clients", i1), services, i1) - gucumber.World["error"] = err - }) - - gucumber.Then(`^I should not have leaked any resources$`, func() { - runtime.GC() - err, ok := gucumber.World["error"].(awserr.Error) - assert.False(gucumber.T, ok, "error returned") - assert.NoError(gucumber.T, err) - }) - - gucumber.And(`^I have a list of services$`, func() { - mapCreateClients() - }) - - gucumber.And(`^I take a snapshot of my resources$`, func() { - // Can't take a memory snapshot here, because gucumber does some - // allocation between each instruction leading to unreliable numbers - }) - - gucumber.When(`^I create a client for each service$`, func() { - buildAnArrayOfClients() - }) - - gucumber.And("^I execute (\\d+) command\\(s\\) on each client$", func(i1 int) { - clientFns := gucumber.World["clientFns"].([]func()) - err := benchmarkTask(fmt.Sprintf("%d_commands_on_clients", i1), clientFns, i1) - gucumber.World["error"] = err - }) - - gucumber.And(`^I destroy all the clients$`, func() { - delete(gucumber.World, "clientFns") - runtime.GC() - }) - - gucumber.Given(`^I have a (\d+) byte file$`, func(i1 int) { - gucumber.World["file"] = make([]byte, i1) - }) - - gucumber.When(`^I upload the file$`, func() { - svc := s3.New(mock.Session) - memStatStart := &runtime.MemStats{} - runtime.ReadMemStats(memStatStart) - gucumber.World["start"] = memStatStart - - svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucketmesilly"), - Key: aws.String("testKey"), - Body: bytes.NewReader(gucumber.World["file"].([]byte)), - }) - }) - - gucumber.And(`then download the file$`, func() { - svc := s3.New(mock.Session) - svc.GetObjectRequest(&s3.GetObjectInput{ - Bucket: aws.String("bucketmesilly"), - Key: aws.String("testKey"), - }) - memStatEnd := &runtime.MemStats{} - runtime.ReadMemStats(memStatEnd) - memStatStart := gucumber.World["start"].(*runtime.MemStats) - if memStatStart.Alloc < memStatEnd.Alloc { - gucumber.World["error"] = errors.New("Leaked memory") - } - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go deleted file mode 100644 index 03c885fd9bf..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go +++ /dev/null @@ -1,122 +0,0 @@ -// +build integration - -// Package performance contains shared step definitions that are used for performance testing -package performance - -import ( - "errors" - "fmt" - "os" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" -) - -// benchmarkLogger handles all benchmark logging -type benchmarkLogger struct { - outputer -} - -// logger interface that handles any logging to an output -type logger interface { - log(key string, data map[string]interface{}) error -} - -// init initializes the logger and uses dependency injection for the -// outputer -func newBenchmarkLogger(output string) (*benchmarkLogger, error) { - b := &benchmarkLogger{} - switch output { - case "dynamodb": - region := os.Getenv("AWS_TESTING_REGION") - if region == "" { - return b, errors.New("No region specified. Please export AWS_TESTING_REGION") - } - - table := os.Getenv("AWS_TESTING_DB_TABLE") - if table == "" { - return b, errors.New("No table specified. Please export AWS_TESTING_DB_TABLE") - } - b.outputer = newDynamodbOut(table, region) - case "stdout": - b.outputer = stdout{} - default: - return b, errors.New("Unsupported outputer") - } - return b, nil -} - -type record struct { - Key string - Data interface{} -} - -// log calls the output command and building a data structure -// to pass into its output formatter -func (b benchmarkLogger) log(key, data interface{}) error { - formatData := record{ - Key: fmt.Sprintf("%d-%v", time.Now().Unix(), key.(string)), - Data: data, - } - - return b.output(formatData) -} - -// outputer is a simple interface that'll handle output -// to whatever system like dynamodb or stdout -type outputer interface { - output(record) error -} - -// dyanmodbOut handles simple writes to dynamodb -type dynamodbOut struct { - table string // table to write to in dynamodb - region string - db *dynamodb.DynamoDB // the dynamodb -} - -// init initializes dynamodbOut -func newDynamodbOut(table, region string) *dynamodbOut { - out := dynamodbOut{ - table: table, - region: region, - } - - out.db = dynamodb.New( - unit.Session, - &aws.Config{Region: &out.region}, - ) - return &out -} - -// output just writes to dynamodb -func (out dynamodbOut) output(data record) error { - input := &dynamodb.PutItemInput{ - TableName: aws.String(out.table), - } - - item, err := dynamodbattribute.ConvertToMap(data) - if err != nil { - return err - } - - input.Item = item - _, err = out.db.PutItem(input) - return err -} - -// stdout handles writes to stdout -type stdout struct{} - -// output expects key value data to print to stdout -func (out stdout) output(data record) error { - item, err := dynamodbattribute.ConvertToMap(data.Data) - if err != nil { - return err - } - fmt.Println(item) - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/streaming.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/streaming.feature deleted file mode 100644 index cd24cb7db8a..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/streaming.feature +++ /dev/null @@ -1,26 +0,0 @@ -# language: en -@performance @streaming -Feature: Streaming transfers consume a fixed amount of memory - - Scenario Outline: Streaming uploads are O(1) in memory usage - Given I have a byte file - And I take a snapshot of my resources - When I upload the file - Then I should not have leaked any resources - - Examples: - | bytes | - | 2097152 | - | 209715200 | - - Scenario Outline: Streaming download are O(1) in memory usage - Given I have a byte file - And I take a snapshot of my resources - When I upload the file - And then download the file - Then I should not have leaked any resources - - Examples: - | bytes | - | 2097152 | - | 209715200 | diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip deleted file mode 100644 index 70148d532db..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip +++ /dev/null @@ -1,42 +0,0 @@ -# Based on docker-library's golang 1.6 alpine and wheezy docker files. -# https://github.com/docker-library/golang/blob/master/1.6/alpine/Dockerfile -# https://github.com/docker-library/golang/blob/master/1.6/wheezy/Dockerfile -FROM buildpack-deps:wheezy-scm - -ENV GOLANG_VERSION tip -ENV GOLANG_SRC_REPO_URL https://go.googlesource.com/go - -ENV GOLANG_BOOTSTRAP_URL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz -ENV GOLANG_BOOTSTRAP_SHA256 ce3140662f45356eb78bc16a88fc7cfb29fb00e18d7c632608245b789b2086d2 -ENV GOLANG_BOOTSTRAP_PATH /usr/local/bootstrap - -# gcc for cgo -RUN apt-get update && apt-get install -y --no-install-recommends \ - g++ \ - gcc \ - libc6-dev \ - make \ - git \ - && rm -rf /var/lib/apt/lists/* - -# Setup the Bootstrap -RUN mkdir -p "$GOLANG_BOOTSTRAP_PATH" \ - && curl -fsSL "$GOLANG_BOOTSTRAP_URL" -o golang.tar.gz \ - && echo "$GOLANG_BOOTSTRAP_SHA256 golang.tar.gz" | sha256sum -c - \ - && tar -C "$GOLANG_BOOTSTRAP_PATH" -xzf golang.tar.gz \ - && rm golang.tar.gz - -# Get and build Go tip -RUN export GOROOT_BOOTSTRAP=$GOLANG_BOOTSTRAP_PATH/go \ - && git clone "$GOLANG_SRC_REPO_URL" /usr/local/go \ - && cd /usr/local/go/src \ - && ./make.bash \ - && rm -rf "$GOLANG_BOOTSTRAP_PATH" /usr/local/go/pkg/bootstrap - -# Build Go workspace and environment -ENV GOPATH /go -ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \ - && chmod -R 777 "$GOPATH" - -WORKDIR $GOPATH diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.4 b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.4 deleted file mode 100644 index e048ed56767..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.4 +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:12.04 -FROM golang:1.4 - -ADD . /go/src/github.com/aws/aws-sdk-go - -WORKDIR /go/src/github.com/aws/aws-sdk-go -CMD ["make", "get-deps", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5 b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5 deleted file mode 100644 index 010381c7939..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5 +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:12.04 -FROM golang:1.5 - -ADD . /go/src/github.com/aws/aws-sdk-go - -ENV GO15VENDOREXPERIMENT="1" - -WORKDIR /go/src/github.com/aws/aws-sdk-go -CMD ["make", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5-novendorexp b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5-novendorexp deleted file mode 100644 index 9ec9f169d72..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.5-novendorexp +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:12.04 -FROM golang:1.5 - -ADD . /go/src/github.com/aws/aws-sdk-go - -WORKDIR /go/src/github.com/aws/aws-sdk-go -CMD ["make", "get-deps", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.6 b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.6 deleted file mode 100644 index 541a8373565..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.6 +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:12.04 -FROM golang:1.6 - -ADD . /go/src/github.com/aws/aws-sdk-go - -WORKDIR /go/src/github.com/aws/aws-sdk-go -CMD ["make", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.7 b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.7 deleted file mode 100644 index aed4408a85e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.7 +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:12.04 -FROM golang:1.7 - -ADD . /go/src/github.com/aws/aws-sdk-go - -WORKDIR /go/src/github.com/aws/aws-sdk-go -CMD ["make", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.gotip b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.gotip deleted file mode 100644 index 9758279f99e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.gotip +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:12.04 -FROM aws-golang:tip - -ADD . /go/src/github.com/aws/aws-sdk-go - -WORKDIR /go/src/github.com/aws/aws-sdk-go -CMD ["make", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go b/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go deleted file mode 100644 index 1c6e6054684..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go +++ /dev/null @@ -1,13 +0,0 @@ -// Package unit performs initialization and validation for unit tests -package unit - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/session" -) - -// Session is a shared session for unit tests to use. -var Session = session.Must(session.NewSession(aws.NewConfig(). - WithCredentials(credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")). - WithRegion("mock-region"))) diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go deleted file mode 100644 index 77c296e99d8..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go +++ /dev/null @@ -1,67 +0,0 @@ -package awstesting - -import ( - "io" - - "github.com/aws/aws-sdk-go/private/util" -) - -// ZeroReader is a io.Reader which will always write zeros to the byte slice provided. -type ZeroReader struct{} - -// Read fills the provided byte slice with zeros returning the number of bytes written. -func (r *ZeroReader) Read(b []byte) (int, error) { - for i := 0; i < len(b); i++ { - b[i] = 0 - } - return len(b), nil -} - -// 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 - set bool - FillData func(bool, []byte, int, int) -} - -// Read will call FillData and fill it with whatever data needed. -// Decrements the size until zero, then return io.EOF. -func (r *ReadCloser) Read(b []byte) (int, error) { - if r.Closed { - return 0, io.EOF - } - - delta := len(b) - if delta > r.Size { - delta = r.Size - } - r.Size -= delta - - for i := 0; i < delta; i++ { - b[i] = 'a' - } - - if r.FillData != nil { - r.FillData(r.set, b, r.Size, delta) - } - r.set = true - - if r.Size > 0 { - return delta, nil - } - return delta, io.EOF -} - -// Close sets Closed to true and returns no error -func (r *ReadCloser) Close() error { - r.Closed = true - return nil -} - -// SortedKeys returns a sorted slice of keys of a map. -func SortedKeys(m map[string]interface{}) []string { - return util.SortedKeys(m) -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/util_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/util_test.go deleted file mode 100644 index 4b03db019d6..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/util_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package awstesting_test - -import ( - "io" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestReadCloserClose(t *testing.T) { - rc := awstesting.ReadCloser{Size: 1} - err := rc.Close() - - assert.Nil(t, err) - assert.True(t, rc.Closed) - assert.Equal(t, rc.Size, 1) -} - -func TestReadCloserRead(t *testing.T) { - rc := awstesting.ReadCloser{Size: 5} - b := make([]byte, 2) - - n, err := rc.Read(b) - - assert.Nil(t, err) - assert.Equal(t, n, 2) - assert.False(t, rc.Closed) - assert.Equal(t, rc.Size, 3) - - err = rc.Close() - assert.Nil(t, err) - n, err = rc.Read(b) - assert.Equal(t, err, io.EOF) - assert.Equal(t, n, 0) -} - -func TestReadCloserReadAll(t *testing.T) { - rc := awstesting.ReadCloser{Size: 5} - b := make([]byte, 5) - - n, err := rc.Read(b) - - assert.Equal(t, err, io.EOF) - assert.Equal(t, n, 5) - assert.False(t, rc.Closed) - assert.Equal(t, rc.Size, 0) -} diff --git a/vendor/github.com/go-ini/ini/.gitignore b/vendor/github.com/go-ini/ini/.gitignore deleted file mode 100644 index 7adca9439c5..00000000000 --- a/vendor/github.com/go-ini/ini/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -testdata/conf_out.ini -ini.sublime-project -ini.sublime-workspace -testdata/conf_reflect.ini diff --git a/vendor/github.com/go-ini/ini/LICENSE b/vendor/github.com/go-ini/ini/LICENSE deleted file mode 100644 index 37ec93a14fd..00000000000 --- a/vendor/github.com/go-ini/ini/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/go-ini/ini/README.md b/vendor/github.com/go-ini/ini/README.md deleted file mode 100644 index 1272038a9e3..00000000000 --- a/vendor/github.com/go-ini/ini/README.md +++ /dev/null @@ -1,560 +0,0 @@ -ini [![Build Status](https://drone.io/github.com/go-ini/ini/status.png)](https://drone.io/github.com/go-ini/ini/latest) [![](http://gocover.io/_badge/github.com/go-ini/ini)](http://gocover.io/github.com/go-ini/ini) -=== - -![](https://avatars0.githubusercontent.com/u/10216035?v=3&s=200) - -Package ini provides INI file read and write functionality in Go. - -[简体中文](README_ZH.md) - -## Feature - -- Load multiple data sources(`[]byte` or file) with overwrites. -- Read with recursion values. -- Read with parent-child sections. -- Read with auto-increment key names. -- Read with multiple-line values. -- Read with tons of helper methods. -- Read and convert values to Go types. -- Read and **WRITE** comments of sections and keys. -- Manipulate sections, keys and comments with ease. -- Keep sections and keys in order as you parse and save. - -## Installation - - go get gopkg.in/ini.v1 - -## Getting Started - -### Loading from data sources - -A **Data Source** is either raw data in type `[]byte` or a file name with type `string` and you can load **as many as** data sources you want. Passing other types will simply return an error. - -```go -cfg, err := ini.Load([]byte("raw data"), "filename") -``` - -Or start with an empty object: - -```go -cfg := ini.Empty() -``` - -When you cannot decide how many data sources to load at the beginning, you still able to **Append()** them later. - -```go -err := cfg.Append("other file", []byte("other raw data")) -``` - -### Working with sections - -To get a section, you would need to: - -```go -section, err := cfg.GetSection("section name") -``` - -For a shortcut for default section, just give an empty string as name: - -```go -section, err := cfg.GetSection("") -``` - -When you're pretty sure the section exists, following code could make your life easier: - -```go -section := cfg.Section("") -``` - -What happens when the section somehow does not exist? Don't panic, it automatically creates and returns a new section to you. - -To create a new section: - -```go -err := cfg.NewSection("new section") -``` - -To get a list of sections or section names: - -```go -sections := cfg.Sections() -names := cfg.SectionStrings() -``` - -### Working with keys - -To get a key under a section: - -```go -key, err := cfg.Section("").GetKey("key name") -``` - -Same rule applies to key operations: - -```go -key := cfg.Section("").Key("key name") -``` - -To create a new key: - -```go -err := cfg.Section("").NewKey("name", "value") -``` - -To get a list of keys or key names: - -```go -keys := cfg.Section("").Keys() -names := cfg.Section("").KeyStrings() -``` - -To get a clone hash of keys and corresponding values: - -```go -hash := cfg.GetSection("").KeysHash() -``` - -### Working with values - -To get a string value: - -```go -val := cfg.Section("").Key("key name").String() -``` - -To validate key value on the fly: - -```go -val := cfg.Section("").Key("key name").Validate(func(in string) string { - if len(in) == 0 { - return "default" - } - return in -}) -``` - -To get value with types: - -```go -// For boolean values: -// true when value is: 1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On -// false when value is: 0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off -v, err = cfg.Section("").Key("BOOL").Bool() -v, err = cfg.Section("").Key("FLOAT64").Float64() -v, err = cfg.Section("").Key("INT").Int() -v, err = cfg.Section("").Key("INT64").Int64() -v, err = cfg.Section("").Key("UINT").Uint() -v, err = cfg.Section("").Key("UINT64").Uint64() -v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339) -v, err = cfg.Section("").Key("TIME").Time() // RFC3339 - -v = cfg.Section("").Key("BOOL").MustBool() -v = cfg.Section("").Key("FLOAT64").MustFloat64() -v = cfg.Section("").Key("INT").MustInt() -v = cfg.Section("").Key("INT64").MustInt64() -v = cfg.Section("").Key("UINT").MustUint() -v = cfg.Section("").Key("UINT64").MustUint64() -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339) -v = cfg.Section("").Key("TIME").MustTime() // RFC3339 - -// Methods start with Must also accept one argument for default value -// when key not found or fail to parse value to given type. -// Except method MustString, which you have to pass a default value. - -v = cfg.Section("").Key("String").MustString("default") -v = cfg.Section("").Key("BOOL").MustBool(true) -v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25) -v = cfg.Section("").Key("INT").MustInt(10) -v = cfg.Section("").Key("INT64").MustInt64(99) -v = cfg.Section("").Key("UINT").MustUint(3) -v = cfg.Section("").Key("UINT64").MustUint64(6) -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now()) -v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339 -``` - -What if my value is three-line long? - -```ini -[advance] -ADDRESS = """404 road, -NotFound, State, 5000 -Earth""" -``` - -Not a problem! - -```go -cfg.Section("advance").Key("ADDRESS").String() - -/* --- start --- -404 road, -NotFound, State, 5000 -Earth ------- end --- */ -``` - -That's cool, how about continuation lines? - -```ini -[advance] -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 -``` - -Piece of cake! - -```go -cfg.Section("advance").Key("two_lines").String() // how about continuation lines? -cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4 -``` - -Note that single quotes around values will be stripped: - -```ini -foo = "some value" // foo: some value -bar = 'some value' // bar: some value -``` - -That's all? Hmm, no. - -#### Helper methods of working with values - -To get value with given candidates: - -```go -v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"}) -v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75}) -v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30}) -v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30}) -v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9}) -v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9}) -v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3}) -v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339 -``` - -Default value will be presented if value of key is not in candidates you given, and default value does not need be one of candidates. - -To validate value in a given range: - -```go -vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2) -vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20) -vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20) -vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9) -vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9) -vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime) -vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339 -``` - -To auto-split value into slice: - -```go -vals = cfg.Section("").Key("STRINGS").Strings(",") -vals = cfg.Section("").Key("FLOAT64S").Float64s(",") -vals = cfg.Section("").Key("INTS").Ints(",") -vals = cfg.Section("").Key("INT64S").Int64s(",") -vals = cfg.Section("").Key("UINTS").Uints(",") -vals = cfg.Section("").Key("UINT64S").Uint64s(",") -vals = cfg.Section("").Key("TIMES").Times(",") -``` - -### Save your configuration - -Finally, it's time to save your configuration to somewhere. - -A typical way to save configuration is writing it to a file: - -```go -// ... -err = cfg.SaveTo("my.ini") -err = cfg.SaveToIndent("my.ini", "\t") -``` - -Another way to save is writing to a `io.Writer` interface: - -```go -// ... -cfg.WriteTo(writer) -cfg.WriteToIndent(writer, "\t") -``` - -## Advanced Usage - -### Recursive Values - -For all value of keys, there is a special syntax `%()s`, where `` is the key name in same section or default section, and `%()s` will be replaced by corresponding value(empty string if key not found). You can use this syntax at most 99 level of recursions. - -```ini -NAME = ini - -[author] -NAME = Unknwon -GITHUB = https://github.com/%(NAME)s - -[package] -FULL_NAME = github.com/go-ini/%(NAME)s -``` - -```go -cfg.Section("author").Key("GITHUB").String() // https://github.com/Unknwon -cfg.Section("package").Key("FULL_NAME").String() // github.com/go-ini/ini -``` - -### Parent-child Sections - -You can use `.` in section name to indicate parent-child relationship between two or more sections. If the key not found in the child section, library will try again on its parent section until there is no parent section. - -```ini -NAME = ini -VERSION = v1 -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -``` - -```go -cfg.Section("package.sub").Key("CLONE_URL").String() // https://gopkg.in/ini.v1 -``` - -### Auto-increment Key Names - -If key name is `-` in data source, then it would be seen as special syntax for auto-increment key name start from 1, and every section is independent on counter. - -```ini -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values -``` - -```go -cfg.Section("features").KeyStrings() // []{"#1", "#2", "#3"} -``` - -### Map To Struct - -Want more objective way to play with INI? Cool. - -```ini -Name = Unknwon -age = 21 -Male = true -Born = 1993-01-01T20:17:05Z - -[Note] -Content = Hi is a good man! -Cities = HangZhou, Boston -``` - -```go -type Note struct { - Content string - Cities []string -} - -type Person struct { - Name string - Age int `ini:"age"` - Male bool - Born time.Time - Note - Created time.Time `ini:"-"` -} - -func main() { - cfg, err := ini.Load("path/to/ini") - // ... - p := new(Person) - err = cfg.MapTo(p) - // ... - - // Things can be simpler. - err = ini.MapTo(p, "path/to/ini") - // ... - - // Just map a section? Fine. - n := new(Note) - err = cfg.Section("Note").MapTo(n) - // ... -} -``` - -Can I have default value for field? Absolutely. - -Assign it before you map to struct. It will keep the value as it is if the key is not presented or got wrong type. - -```go -// ... -p := &Person{ - Name: "Joe", -} -// ... -``` - -It's really cool, but what's the point if you can't give me my file back from struct? - -### Reflect From Struct - -Why not? - -```go -type Embeded struct { - Dates []time.Time `delim:"|"` - Places []string - None []int -} - -type Author struct { - Name string `ini:"NAME"` - Male bool - Age int - GPA float64 - NeverMind string `ini:"-"` - *Embeded -} - -func main() { - a := &Author{"Unknwon", true, 21, 2.8, "", - &Embeded{ - []time.Time{time.Now(), time.Now()}, - []string{"HangZhou", "Boston"}, - []int{}, - }} - cfg := ini.Empty() - err = ini.ReflectFrom(cfg, a) - // ... -} -``` - -So, what do I get? - -```ini -NAME = Unknwon -Male = true -Age = 21 -GPA = 2.8 - -[Embeded] -Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00 -Places = HangZhou,Boston -None = -``` - -#### Name Mapper - -To save your time and make your code cleaner, this library supports [`NameMapper`](https://gowalker.org/gopkg.in/ini.v1#NameMapper) between struct field and actual section and key name. - -There are 2 built-in name mappers: - -- `AllCapsUnderscore`: it converts to format `ALL_CAPS_UNDERSCORE` then match section or key. -- `TitleUnderscore`: it converts to format `title_underscore` then match section or key. - -To use them: - -```go -type Info struct { - PackageName string -} - -func main() { - err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("packag_name=ini")) - // ... - - cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) - // ... - info := new(Info) - cfg.NameMapper = ini.AllCapsUnderscore - err = cfg.MapTo(info) - // ... -} -``` - -Same rules of name mapper apply to `ini.ReflectFromWithMapper` function. - -#### Other Notes On Map/Reflect - -Any embedded struct is treated as a section by default, and there is no automatic parent-child relations in map/reflect feature: - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child -} - -type Config struct { - City string - Parent -} -``` - -Example configuration: - -```ini -City = Boston - -[Parent] -Name = Unknwon - -[Child] -Age = 21 -``` - -What if, yes, I'm paranoid, I want embedded struct to be in the same section. Well, all roads lead to Rome. - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child `ini:"Parent"` -} - -type Config struct { - City string - Parent -} -``` - -Example configuration: - -```ini -City = Boston - -[Parent] -Name = Unknwon -Age = 21 -``` - -## Getting Help - -- [API Documentation](https://gowalker.org/gopkg.in/ini.v1) -- [File An Issue](https://github.com/go-ini/ini/issues/new) - -## FAQs - -### What does `BlockMode` field do? - -By default, library lets you read and write values so we need a locker to make sure your data is safe. But in cases that you are very sure about only reading data through the library, you can set `cfg.BlockMode = false` to speed up read operations about **50-70%** faster. - -### Why another INI library? - -Many people are using my another INI library [goconfig](https://github.com/Unknwon/goconfig), so the reason for this one is I would like to make more Go style code. Also when you set `cfg.BlockMode = false`, this one is about **10-30%** faster. - -To make those changes I have to confirm API broken, so it's safer to keep it in another place and start using `gopkg.in` to version my package at this time.(PS: shorter import path) - -## License - -This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text. diff --git a/vendor/github.com/go-ini/ini/README_ZH.md b/vendor/github.com/go-ini/ini/README_ZH.md deleted file mode 100644 index 45e19edddff..00000000000 --- a/vendor/github.com/go-ini/ini/README_ZH.md +++ /dev/null @@ -1,547 +0,0 @@ -本包提供了 Go 语言中读写 INI 文件的功能。 - -## 功能特性 - -- 支持覆盖加载多个数据源(`[]byte` 或文件) -- 支持递归读取键值 -- 支持读取父子分区 -- 支持读取自增键名 -- 支持读取多行的键值 -- 支持大量辅助方法 -- 支持在读取时直接转换为 Go 语言类型 -- 支持读取和 **写入** 分区和键的注释 -- 轻松操作分区、键值和注释 -- 在保存文件时分区和键值会保持原有的顺序 - -## 下载安装 - - go get gopkg.in/ini.v1 - -## 开始使用 - -### 从数据源加载 - -一个 **数据源** 可以是 `[]byte` 类型的原始数据,或 `string` 类型的文件路径。您可以加载 **任意多个** 数据源。如果您传递其它类型的数据源,则会直接返回错误。 - -```go -cfg, err := ini.Load([]byte("raw data"), "filename") -``` - -或者从一个空白的文件开始: - -```go -cfg := ini.Empty() -``` - -当您在一开始无法决定需要加载哪些数据源时,仍可以使用 **Append()** 在需要的时候加载它们。 - -```go -err := cfg.Append("other file", []byte("other raw data")) -``` - -### 操作分区(Section) - -获取指定分区: - -```go -section, err := cfg.GetSection("section name") -``` - -如果您想要获取默认分区,则可以用空字符串代替分区名: - -```go -section, err := cfg.GetSection("") -``` - -当您非常确定某个分区是存在的,可以使用以下简便方法: - -```go -section := cfg.Section("") -``` - -如果不小心判断错了,要获取的分区其实是不存在的,那会发生什么呢?没事的,它会自动创建并返回一个对应的分区对象给您。 - -创建一个分区: - -```go -err := cfg.NewSection("new section") -``` - -获取所有分区对象或名称: - -```go -sections := cfg.Sections() -names := cfg.SectionStrings() -``` - -### 操作键(Key) - -获取某个分区下的键: - -```go -key, err := cfg.Section("").GetKey("key name") -``` - -和分区一样,您也可以直接获取键而忽略错误处理: - -```go -key := cfg.Section("").Key("key name") -``` - -创建一个新的键: - -```go -err := cfg.Section("").NewKey("name", "value") -``` - -获取分区下的所有键或键名: - -```go -keys := cfg.Section("").Keys() -names := cfg.Section("").KeyStrings() -``` - -获取分区下的所有键值对的克隆: - -```go -hash := cfg.GetSection("").KeysHash() -``` - -### 操作键值(Value) - -获取一个类型为字符串(string)的值: - -```go -val := cfg.Section("").Key("key name").String() -``` - -获取值的同时通过自定义函数进行处理验证: - -```go -val := cfg.Section("").Key("key name").Validate(func(in string) string { - if len(in) == 0 { - return "default" - } - return in -}) -``` - -获取其它类型的值: - -```go -// 布尔值的规则: -// true 当值为:1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On -// false 当值为:0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off -v, err = cfg.Section("").Key("BOOL").Bool() -v, err = cfg.Section("").Key("FLOAT64").Float64() -v, err = cfg.Section("").Key("INT").Int() -v, err = cfg.Section("").Key("INT64").Int64() -v, err = cfg.Section("").Key("UINT").Uint() -v, err = cfg.Section("").Key("UINT64").Uint64() -v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339) -v, err = cfg.Section("").Key("TIME").Time() // RFC3339 - -v = cfg.Section("").Key("BOOL").MustBool() -v = cfg.Section("").Key("FLOAT64").MustFloat64() -v = cfg.Section("").Key("INT").MustInt() -v = cfg.Section("").Key("INT64").MustInt64() -v = cfg.Section("").Key("UINT").MustUint() -v = cfg.Section("").Key("UINT64").MustUint64() -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339) -v = cfg.Section("").Key("TIME").MustTime() // RFC3339 - -// 由 Must 开头的方法名允许接收一个相同类型的参数来作为默认值, -// 当键不存在或者转换失败时,则会直接返回该默认值。 -// 但是,MustString 方法必须传递一个默认值。 - -v = cfg.Seciont("").Key("String").MustString("default") -v = cfg.Section("").Key("BOOL").MustBool(true) -v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25) -v = cfg.Section("").Key("INT").MustInt(10) -v = cfg.Section("").Key("INT64").MustInt64(99) -v = cfg.Section("").Key("UINT").MustUint(3) -v = cfg.Section("").Key("UINT64").MustUint64(6) -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now()) -v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339 -``` - -如果我的值有好多行怎么办? - -```ini -[advance] -ADDRESS = """404 road, -NotFound, State, 5000 -Earth""" -``` - -嗯哼?小 case! - -```go -cfg.Section("advance").Key("ADDRESS").String() - -/* --- start --- -404 road, -NotFound, State, 5000 -Earth ------- end --- */ -``` - -赞爆了!那要是我属于一行的内容写不下想要写到第二行怎么办? - -```ini -[advance] -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 -``` - -简直是小菜一碟! - -```go -cfg.Section("advance").Key("two_lines").String() // how about continuation lines? -cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4 -``` - -需要注意的是,值两侧的单引号会被自动剔除: - -```ini -foo = "some value" // foo: some value -bar = 'some value' // bar: some value -``` - -这就是全部了?哈哈,当然不是。 - -#### 操作键值的辅助方法 - -获取键值时设定候选值: - -```go -v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"}) -v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75}) -v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30}) -v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30}) -v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9}) -v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9}) -v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3}) -v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339 -``` - -如果获取到的值不是候选值的任意一个,则会返回默认值,而默认值不需要是候选值中的一员。 - -验证获取的值是否在指定范围内: - -```go -vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2) -vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20) -vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20) -vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9) -vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9) -vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime) -vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339 -``` - -自动分割键值为切片(slice): - -```go -vals = cfg.Section("").Key("STRINGS").Strings(",") -vals = cfg.Section("").Key("FLOAT64S").Float64s(",") -vals = cfg.Section("").Key("INTS").Ints(",") -vals = cfg.Section("").Key("INT64S").Int64s(",") -vals = cfg.Section("").Key("UINTS").Uints(",") -vals = cfg.Section("").Key("UINT64S").Uint64s(",") -vals = cfg.Section("").Key("TIMES").Times(",") -``` - -### 保存配置 - -终于到了这个时刻,是时候保存一下配置了。 - -比较原始的做法是输出配置到某个文件: - -```go -// ... -err = cfg.SaveTo("my.ini") -err = cfg.SaveToIndent("my.ini", "\t") -``` - -另一个比较高级的做法是写入到任何实现 `io.Writer` 接口的对象中: - -```go -// ... -cfg.WriteTo(writer) -cfg.WriteToIndent(writer, "\t") -``` - -### 高级用法 - -#### 递归读取键值 - -在获取所有键值的过程中,特殊语法 `%()s` 会被应用,其中 `` 可以是相同分区或者默认分区下的键名。字符串 `%()s` 会被相应的键值所替代,如果指定的键不存在,则会用空字符串替代。您可以最多使用 99 层的递归嵌套。 - -```ini -NAME = ini - -[author] -NAME = Unknwon -GITHUB = https://github.com/%(NAME)s - -[package] -FULL_NAME = github.com/go-ini/%(NAME)s -``` - -```go -cfg.Section("author").Key("GITHUB").String() // https://github.com/Unknwon -cfg.Section("package").Key("FULL_NAME").String() // github.com/go-ini/ini -``` - -#### 读取父子分区 - -您可以在分区名称中使用 `.` 来表示两个或多个分区之间的父子关系。如果某个键在子分区中不存在,则会去它的父分区中再次寻找,直到没有父分区为止。 - -```ini -NAME = ini -VERSION = v1 -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -``` - -```go -cfg.Section("package.sub").Key("CLONE_URL").String() // https://gopkg.in/ini.v1 -``` - -#### 读取自增键名 - -如果数据源中的键名为 `-`,则认为该键使用了自增键名的特殊语法。计数器从 1 开始,并且分区之间是相互独立的。 - -```ini -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values -``` - -```go -cfg.Section("features").KeyStrings() // []{"#1", "#2", "#3"} -``` - -### 映射到结构 - -想要使用更加面向对象的方式玩转 INI 吗?好主意。 - -```ini -Name = Unknwon -age = 21 -Male = true -Born = 1993-01-01T20:17:05Z - -[Note] -Content = Hi is a good man! -Cities = HangZhou, Boston -``` - -```go -type Note struct { - Content string - Cities []string -} - -type Person struct { - Name string - Age int `ini:"age"` - Male bool - Born time.Time - Note - Created time.Time `ini:"-"` -} - -func main() { - cfg, err := ini.Load("path/to/ini") - // ... - p := new(Person) - err = cfg.MapTo(p) - // ... - - // 一切竟可以如此的简单。 - err = ini.MapTo(p, "path/to/ini") - // ... - - // 嗯哼?只需要映射一个分区吗? - n := new(Note) - err = cfg.Section("Note").MapTo(n) - // ... -} -``` - -结构的字段怎么设置默认值呢?很简单,只要在映射之前对指定字段进行赋值就可以了。如果键未找到或者类型错误,该值不会发生改变。 - -```go -// ... -p := &Person{ - Name: "Joe", -} -// ... -``` - -这样玩 INI 真的好酷啊!然而,如果不能还给我原来的配置文件,有什么卵用? - -### 从结构反射 - -可是,我有说不能吗? - -```go -type Embeded struct { - Dates []time.Time `delim:"|"` - Places []string - None []int -} - -type Author struct { - Name string `ini:"NAME"` - Male bool - Age int - GPA float64 - NeverMind string `ini:"-"` - *Embeded -} - -func main() { - a := &Author{"Unknwon", true, 21, 2.8, "", - &Embeded{ - []time.Time{time.Now(), time.Now()}, - []string{"HangZhou", "Boston"}, - []int{}, - }} - cfg := ini.Empty() - err = ini.ReflectFrom(cfg, a) - // ... -} -``` - -瞧瞧,奇迹发生了。 - -```ini -NAME = Unknwon -Male = true -Age = 21 -GPA = 2.8 - -[Embeded] -Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00 -Places = HangZhou,Boston -None = -``` - -#### 名称映射器(Name Mapper) - -为了节省您的时间并简化代码,本库支持类型为 [`NameMapper`](https://gowalker.org/gopkg.in/ini.v1#NameMapper) 的名称映射器,该映射器负责结构字段名与分区名和键名之间的映射。 - -目前有 2 款内置的映射器: - -- `AllCapsUnderscore`:该映射器将字段名转换至格式 `ALL_CAPS_UNDERSCORE` 后再去匹配分区名和键名。 -- `TitleUnderscore`:该映射器将字段名转换至格式 `title_underscore` 后再去匹配分区名和键名。 - -使用方法: - -```go -type Info struct{ - PackageName string -} - -func main() { - err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("packag_name=ini")) - // ... - - cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) - // ... - info := new(Info) - cfg.NameMapper = ini.AllCapsUnderscore - err = cfg.MapTo(info) - // ... -} -``` - -使用函数 `ini.ReflectFromWithMapper` 时也可应用相同的规则。 - -#### 映射/反射的其它说明 - -任何嵌入的结构都会被默认认作一个不同的分区,并且不会自动产生所谓的父子分区关联: - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child -} - -type Config struct { - City string - Parent -} -``` - -示例配置文件: - -```ini -City = Boston - -[Parent] -Name = Unknwon - -[Child] -Age = 21 -``` - -很好,但是,我就是要嵌入结构也在同一个分区。好吧,你爹是李刚! - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child `ini:"Parent"` -} - -type Config struct { - City string - Parent -} -``` - -示例配置文件: - -```ini -City = Boston - -[Parent] -Name = Unknwon -Age = 21 -``` - -## 获取帮助 - -- [API 文档](https://gowalker.org/gopkg.in/ini.v1) -- [创建工单](https://github.com/go-ini/ini/issues/new) - -## 常见问题 - -### 字段 `BlockMode` 是什么? - -默认情况下,本库会在您进行读写操作时采用锁机制来确保数据时间。但在某些情况下,您非常确定只进行读操作。此时,您可以通过设置 `cfg.BlockMode = false` 来将读操作提升大约 **50-70%** 的性能。 - -### 为什么要写另一个 INI 解析库? - -许多人都在使用我的 [goconfig](https://github.com/Unknwon/goconfig) 来完成对 INI 文件的操作,但我希望使用更加 Go 风格的代码。并且当您设置 `cfg.BlockMode = false` 时,会有大约 **10-30%** 的性能提升。 - -为了做出这些改变,我必须对 API 进行破坏,所以新开一个仓库是最安全的做法。除此之外,本库直接使用 `gopkg.in` 来进行版本化发布。(其实真相是导入路径更短了) diff --git a/vendor/github.com/go-ini/ini/ini.go b/vendor/github.com/go-ini/ini/ini.go deleted file mode 100644 index 1fee789a1d6..00000000000 --- a/vendor/github.com/go-ini/ini/ini.go +++ /dev/null @@ -1,1226 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -// Package ini provides INI file read and write functionality in Go. -package ini - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io" - "os" - "regexp" - "runtime" - "strconv" - "strings" - "sync" - "time" -) - -const ( - DEFAULT_SECTION = "DEFAULT" - // Maximum allowed depth when recursively substituing variable names. - _DEPTH_VALUES = 99 - - _VERSION = "1.6.0" -) - -func Version() string { - return _VERSION -} - -var ( - LineBreak = "\n" - - // Variable regexp pattern: %(variable)s - varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`) - - // Write spaces around "=" to look better. - PrettyFormat = true -) - -func init() { - if runtime.GOOS == "windows" { - LineBreak = "\r\n" - } -} - -func inSlice(str string, s []string) bool { - for _, v := range s { - if str == v { - return true - } - } - return false -} - -// dataSource is a interface that returns file content. -type dataSource interface { - ReadCloser() (io.ReadCloser, error) -} - -type sourceFile struct { - name string -} - -func (s sourceFile) ReadCloser() (_ io.ReadCloser, err error) { - return os.Open(s.name) -} - -type bytesReadCloser struct { - reader io.Reader -} - -func (rc *bytesReadCloser) Read(p []byte) (n int, err error) { - return rc.reader.Read(p) -} - -func (rc *bytesReadCloser) Close() error { - return nil -} - -type sourceData struct { - data []byte -} - -func (s *sourceData) ReadCloser() (io.ReadCloser, error) { - return &bytesReadCloser{bytes.NewReader(s.data)}, nil -} - -// ____ __. -// | |/ _|____ ___.__. -// | <_/ __ < | | -// | | \ ___/\___ | -// |____|__ \___ > ____| -// \/ \/\/ - -// Key represents a key under a section. -type Key struct { - s *Section - Comment string - name string - value string - isAutoIncr bool -} - -// Name returns name of key. -func (k *Key) Name() string { - return k.name -} - -// Value returns raw value of key for performance purpose. -func (k *Key) Value() string { - return k.value -} - -// String returns string representation of value. -func (k *Key) String() string { - val := k.value - if strings.Index(val, "%") == -1 { - return val - } - - for i := 0; i < _DEPTH_VALUES; i++ { - vr := varPattern.FindString(val) - if len(vr) == 0 { - break - } - - // Take off leading '%(' and trailing ')s'. - noption := strings.TrimLeft(vr, "%(") - noption = strings.TrimRight(noption, ")s") - - // Search in the same section. - nk, err := k.s.GetKey(noption) - if err != nil { - // Search again in default section. - nk, _ = k.s.f.Section("").GetKey(noption) - } - - // Substitute by new value and take off leading '%(' and trailing ')s'. - val = strings.Replace(val, vr, nk.value, -1) - } - return val -} - -// Validate accepts a validate function which can -// return modifed result as key value. -func (k *Key) Validate(fn func(string) string) string { - return fn(k.String()) -} - -// parseBool returns the boolean value represented by the string. -// -// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On, -// 0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off. -// Any other value returns an error. -func parseBool(str string) (value bool, err error) { - switch str { - case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "ON", "on", "On": - return true, nil - case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "OFF", "off", "Off": - return false, nil - } - return false, fmt.Errorf("parsing \"%s\": invalid syntax", str) -} - -// Bool returns bool type value. -func (k *Key) Bool() (bool, error) { - return parseBool(k.String()) -} - -// Float64 returns float64 type value. -func (k *Key) Float64() (float64, error) { - return strconv.ParseFloat(k.String(), 64) -} - -// Int returns int type value. -func (k *Key) Int() (int, error) { - return strconv.Atoi(k.String()) -} - -// Int64 returns int64 type value. -func (k *Key) Int64() (int64, error) { - return strconv.ParseInt(k.String(), 10, 64) -} - -// Uint returns uint type valued. -func (k *Key) Uint() (uint, error) { - u, e := strconv.ParseUint(k.String(), 10, 64) - return uint(u), e -} - -// Uint64 returns uint64 type value. -func (k *Key) Uint64() (uint64, error) { - return strconv.ParseUint(k.String(), 10, 64) -} - -// Duration returns time.Duration type value. -func (k *Key) Duration() (time.Duration, error) { - return time.ParseDuration(k.String()) -} - -// TimeFormat parses with given format and returns time.Time type value. -func (k *Key) TimeFormat(format string) (time.Time, error) { - return time.Parse(format, k.String()) -} - -// Time parses with RFC3339 format and returns time.Time type value. -func (k *Key) Time() (time.Time, error) { - return k.TimeFormat(time.RFC3339) -} - -// MustString returns default value if key value is empty. -func (k *Key) MustString(defaultVal string) string { - val := k.String() - if len(val) == 0 { - return defaultVal - } - return val -} - -// MustBool always returns value without error, -// it returns false if error occurs. -func (k *Key) MustBool(defaultVal ...bool) bool { - val, err := k.Bool() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustFloat64 always returns value without error, -// it returns 0.0 if error occurs. -func (k *Key) MustFloat64(defaultVal ...float64) float64 { - val, err := k.Float64() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustInt always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustInt(defaultVal ...int) int { - val, err := k.Int() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustInt64 always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustInt64(defaultVal ...int64) int64 { - val, err := k.Int64() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustUint always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustUint(defaultVal ...uint) uint { - val, err := k.Uint() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustUint64 always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustUint64(defaultVal ...uint64) uint64 { - val, err := k.Uint64() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustDuration always returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration { - val, err := k.Duration() - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustTimeFormat always parses with given format and returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time { - val, err := k.TimeFormat(format) - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustTime always parses with RFC3339 format and returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustTime(defaultVal ...time.Time) time.Time { - return k.MustTimeFormat(time.RFC3339, defaultVal...) -} - -// In always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) In(defaultVal string, candidates []string) string { - val := k.String() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InFloat64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 { - val := k.MustFloat64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InInt always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InInt(defaultVal int, candidates []int) int { - val := k.MustInt() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InInt64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 { - val := k.MustInt64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InUint always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InUint(defaultVal uint, candidates []uint) uint { - val := k.MustUint() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InUint64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 { - val := k.MustUint64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InTimeFormat always parses with given format and returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time { - val := k.MustTimeFormat(format) - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InTime always parses with RFC3339 format and returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time { - return k.InTimeFormat(time.RFC3339, defaultVal, candidates) -} - -// RangeFloat64 checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 { - val := k.MustFloat64() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeInt checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeInt(defaultVal, min, max int) int { - val := k.MustInt() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeInt64 checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeInt64(defaultVal, min, max int64) int64 { - val := k.MustInt64() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeTimeFormat checks if value with given format is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time { - val := k.MustTimeFormat(format) - if val.Unix() < min.Unix() || val.Unix() > max.Unix() { - return defaultVal - } - return val -} - -// RangeTime checks if value with RFC3339 format is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time { - return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max) -} - -// Strings returns list of string devide by given delimiter. -func (k *Key) Strings(delim string) []string { - str := k.String() - if len(str) == 0 { - return []string{} - } - - vals := strings.Split(str, delim) - for i := range vals { - vals[i] = strings.TrimSpace(vals[i]) - } - return vals -} - -// Float64s returns list of float64 devide by given delimiter. -func (k *Key) Float64s(delim string) []float64 { - strs := k.Strings(delim) - vals := make([]float64, len(strs)) - for i := range strs { - vals[i], _ = strconv.ParseFloat(strs[i], 64) - } - return vals -} - -// Ints returns list of int devide by given delimiter. -func (k *Key) Ints(delim string) []int { - strs := k.Strings(delim) - vals := make([]int, len(strs)) - for i := range strs { - vals[i], _ = strconv.Atoi(strs[i]) - } - return vals -} - -// Int64s returns list of int64 devide by given delimiter. -func (k *Key) Int64s(delim string) []int64 { - strs := k.Strings(delim) - vals := make([]int64, len(strs)) - for i := range strs { - vals[i], _ = strconv.ParseInt(strs[i], 10, 64) - } - return vals -} - -// Uints returns list of uint devide by given delimiter. -func (k *Key) Uints(delim string) []uint { - strs := k.Strings(delim) - vals := make([]uint, len(strs)) - for i := range strs { - u, _ := strconv.ParseUint(strs[i], 10, 64) - vals[i] = uint(u) - } - return vals -} - -// Uint64s returns list of uint64 devide by given delimiter. -func (k *Key) Uint64s(delim string) []uint64 { - strs := k.Strings(delim) - vals := make([]uint64, len(strs)) - for i := range strs { - vals[i], _ = strconv.ParseUint(strs[i], 10, 64) - } - return vals -} - -// TimesFormat parses with given format and returns list of time.Time devide by given delimiter. -func (k *Key) TimesFormat(format, delim string) []time.Time { - strs := k.Strings(delim) - vals := make([]time.Time, len(strs)) - for i := range strs { - vals[i], _ = time.Parse(format, strs[i]) - } - return vals -} - -// Times parses with RFC3339 format and returns list of time.Time devide by given delimiter. -func (k *Key) Times(delim string) []time.Time { - return k.TimesFormat(time.RFC3339, delim) -} - -// SetValue changes key value. -func (k *Key) SetValue(v string) { - k.value = v -} - -// _________ __ .__ -// / _____/ ____ _____/ |_|__| ____ ____ -// \_____ \_/ __ \_/ ___\ __\ |/ _ \ / \ -// / \ ___/\ \___| | | ( <_> ) | \ -// /_______ /\___ >\___ >__| |__|\____/|___| / -// \/ \/ \/ \/ - -// Section represents a config section. -type Section struct { - f *File - Comment string - name string - keys map[string]*Key - keyList []string - keysHash map[string]string -} - -func newSection(f *File, name string) *Section { - return &Section{f, "", name, make(map[string]*Key), make([]string, 0, 10), make(map[string]string)} -} - -// Name returns name of Section. -func (s *Section) Name() string { - return s.name -} - -// NewKey creates a new key to given section. -func (s *Section) NewKey(name, val string) (*Key, error) { - if len(name) == 0 { - return nil, errors.New("error creating new key: empty key name") - } - - if s.f.BlockMode { - s.f.lock.Lock() - defer s.f.lock.Unlock() - } - - if inSlice(name, s.keyList) { - s.keys[name].value = val - return s.keys[name], nil - } - - s.keyList = append(s.keyList, name) - s.keys[name] = &Key{s, "", name, val, false} - s.keysHash[name] = val - return s.keys[name], nil -} - -// GetKey returns key in section by given name. -func (s *Section) GetKey(name string) (*Key, error) { - // FIXME: change to section level lock? - if s.f.BlockMode { - s.f.lock.RLock() - } - key := s.keys[name] - if s.f.BlockMode { - s.f.lock.RUnlock() - } - - if key == nil { - // Check if it is a child-section. - sname := s.name - for { - if i := strings.LastIndex(sname, "."); i > -1 { - sname = sname[:i] - sec, err := s.f.GetSection(sname) - if err != nil { - continue - } - return sec.GetKey(name) - } else { - break - } - } - return nil, fmt.Errorf("error when getting key of section '%s': key '%s' not exists", s.name, name) - } - return key, nil -} - -// Key assumes named Key exists in section and returns a zero-value when not. -func (s *Section) Key(name string) *Key { - key, err := s.GetKey(name) - if err != nil { - // It's OK here because the only possible error is empty key name, - // but if it's empty, this piece of code won't be executed. - key, _ = s.NewKey(name, "") - return key - } - return key -} - -// Keys returns list of keys of section. -func (s *Section) Keys() []*Key { - keys := make([]*Key, len(s.keyList)) - for i := range s.keyList { - keys[i] = s.Key(s.keyList[i]) - } - return keys -} - -// KeyStrings returns list of key names of section. -func (s *Section) KeyStrings() []string { - list := make([]string, len(s.keyList)) - copy(list, s.keyList) - return list -} - -// KeysHash returns keys hash consisting of names and values. -func (s *Section) KeysHash() map[string]string { - if s.f.BlockMode { - s.f.lock.RLock() - defer s.f.lock.RUnlock() - } - - hash := map[string]string{} - for key, value := range s.keysHash { - hash[key] = value - } - return hash -} - -// DeleteKey deletes a key from section. -func (s *Section) DeleteKey(name string) { - if s.f.BlockMode { - s.f.lock.Lock() - defer s.f.lock.Unlock() - } - - for i, k := range s.keyList { - if k == name { - s.keyList = append(s.keyList[:i], s.keyList[i+1:]...) - delete(s.keys, name) - return - } - } -} - -// ___________.__.__ -// \_ _____/|__| | ____ -// | __) | | | _/ __ \ -// | \ | | |_\ ___/ -// \___ / |__|____/\___ > -// \/ \/ - -// File represents a combination of a or more INI file(s) in memory. -type File struct { - // Should make things safe, but sometimes doesn't matter. - BlockMode bool - // Make sure data is safe in multiple goroutines. - lock sync.RWMutex - - // Allow combination of multiple data sources. - dataSources []dataSource - // Actual data is stored here. - sections map[string]*Section - - // To keep data in order. - sectionList []string - - NameMapper -} - -// newFile initializes File object with given data sources. -func newFile(dataSources []dataSource) *File { - return &File{ - BlockMode: true, - dataSources: dataSources, - sections: make(map[string]*Section), - sectionList: make([]string, 0, 10), - } -} - -func parseDataSource(source interface{}) (dataSource, error) { - switch s := source.(type) { - case string: - return sourceFile{s}, nil - case []byte: - return &sourceData{s}, nil - default: - return nil, fmt.Errorf("error parsing data source: unknown type '%s'", s) - } -} - -// Load loads and parses from INI data sources. -// Arguments can be mixed of file name with string type, or raw data in []byte. -func Load(source interface{}, others ...interface{}) (_ *File, err error) { - sources := make([]dataSource, len(others)+1) - sources[0], err = parseDataSource(source) - if err != nil { - return nil, err - } - for i := range others { - sources[i+1], err = parseDataSource(others[i]) - if err != nil { - return nil, err - } - } - f := newFile(sources) - return f, f.Reload() -} - -// Empty returns an empty file object. -func Empty() *File { - // Ignore error here, we sure our data is good. - f, _ := Load([]byte("")) - return f -} - -// NewSection creates a new section. -func (f *File) NewSection(name string) (*Section, error) { - if len(name) == 0 { - return nil, errors.New("error creating new section: empty section name") - } - - if f.BlockMode { - f.lock.Lock() - defer f.lock.Unlock() - } - - if inSlice(name, f.sectionList) { - return f.sections[name], nil - } - - f.sectionList = append(f.sectionList, name) - f.sections[name] = newSection(f, name) - return f.sections[name], nil -} - -// NewSections creates a list of sections. -func (f *File) NewSections(names ...string) (err error) { - for _, name := range names { - if _, err = f.NewSection(name); err != nil { - return err - } - } - return nil -} - -// GetSection returns section by given name. -func (f *File) GetSection(name string) (*Section, error) { - if len(name) == 0 { - name = DEFAULT_SECTION - } - - if f.BlockMode { - f.lock.RLock() - defer f.lock.RUnlock() - } - - sec := f.sections[name] - if sec == nil { - return nil, fmt.Errorf("error when getting section: section '%s' not exists", name) - } - return sec, nil -} - -// Section assumes named section exists and returns a zero-value when not. -func (f *File) Section(name string) *Section { - sec, err := f.GetSection(name) - if err != nil { - // Note: It's OK here because the only possible error is empty section name, - // but if it's empty, this piece of code won't be executed. - sec, _ = f.NewSection(name) - return sec - } - return sec -} - -// Section returns list of Section. -func (f *File) Sections() []*Section { - sections := make([]*Section, len(f.sectionList)) - for i := range f.sectionList { - sections[i] = f.Section(f.sectionList[i]) - } - return sections -} - -// SectionStrings returns list of section names. -func (f *File) SectionStrings() []string { - list := make([]string, len(f.sectionList)) - copy(list, f.sectionList) - return list -} - -// DeleteSection deletes a section. -func (f *File) DeleteSection(name string) { - if f.BlockMode { - f.lock.Lock() - defer f.lock.Unlock() - } - - if len(name) == 0 { - name = DEFAULT_SECTION - } - - for i, s := range f.sectionList { - if s == name { - f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...) - delete(f.sections, name) - return - } - } -} - -func cutComment(str string) string { - i := strings.Index(str, "#") - if i == -1 { - return str - } - return str[:i] -} - -func checkMultipleLines(buf *bufio.Reader, line, val, valQuote string) (string, error) { - isEnd := false - for { - next, err := buf.ReadString('\n') - if err != nil { - if err != io.EOF { - return "", err - } - isEnd = true - } - pos := strings.LastIndex(next, valQuote) - if pos > -1 { - val += next[:pos] - break - } - val += next - if isEnd { - return "", fmt.Errorf("error parsing line: missing closing key quote from '%s' to '%s'", line, next) - } - } - return val, nil -} - -func checkContinuationLines(buf *bufio.Reader, val string) (string, bool, error) { - isEnd := false - for { - valLen := len(val) - if valLen == 0 || val[valLen-1] != '\\' { - break - } - val = val[:valLen-1] - - next, err := buf.ReadString('\n') - if err != nil { - if err != io.EOF { - return "", isEnd, err - } - isEnd = true - } - - next = strings.TrimSpace(next) - if len(next) == 0 { - break - } - val += next - } - return val, isEnd, nil -} - -// parse parses data through an io.Reader. -func (f *File) parse(reader io.Reader) error { - buf := bufio.NewReader(reader) - - // Handle BOM-UTF8. - // http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding - mask, err := buf.Peek(3) - if err == nil && len(mask) >= 3 && mask[0] == 239 && mask[1] == 187 && mask[2] == 191 { - buf.Read(mask) - } - - count := 1 - comments := "" - isEnd := false - - section, err := f.NewSection(DEFAULT_SECTION) - if err != nil { - return err - } - - for { - line, err := buf.ReadString('\n') - line = strings.TrimSpace(line) - length := len(line) - - // Check error and ignore io.EOF just for a moment. - if err != nil { - if err != io.EOF { - return fmt.Errorf("error reading next line: %v", err) - } - // The last line of file could be an empty line. - if length == 0 { - break - } - isEnd = true - } - - // Skip empty lines. - if length == 0 { - continue - } - - switch { - case line[0] == '#' || line[0] == ';': // Comments. - if len(comments) == 0 { - comments = line - } else { - comments += LineBreak + line - } - continue - case line[0] == '[' && line[length-1] == ']': // New sction. - section, err = f.NewSection(strings.TrimSpace(line[1 : length-1])) - if err != nil { - return err - } - - if len(comments) > 0 { - section.Comment = comments - comments = "" - } - // Reset counter. - count = 1 - continue - } - - // Other possibilities. - var ( - i int - keyQuote string - kname string - valQuote string - val string - ) - - // Key name surrounded by quotes. - if line[0] == '"' { - if length > 6 && line[0:3] == `"""` { - keyQuote = `"""` - } else { - keyQuote = `"` - } - } else if line[0] == '`' { - keyQuote = "`" - } - if len(keyQuote) > 0 { - qLen := len(keyQuote) - pos := strings.Index(line[qLen:], keyQuote) - if pos == -1 { - return fmt.Errorf("error parsing line: missing closing key quote: %s", line) - } - pos = pos + qLen - i = strings.IndexAny(line[pos:], "=:") - if i < 0 { - return fmt.Errorf("error parsing line: key-value delimiter not found: %s", line) - } else if i == pos { - return fmt.Errorf("error parsing line: key is empty: %s", line) - } - i = i + pos - kname = line[qLen:pos] // Just keep spaces inside quotes. - } else { - i = strings.IndexAny(line, "=:") - if i < 0 { - return fmt.Errorf("error parsing line: key-value delimiter not found: %s", line) - } else if i == 0 { - return fmt.Errorf("error parsing line: key is empty: %s", line) - } - kname = strings.TrimSpace(line[0:i]) - } - - isAutoIncr := false - // Auto increment. - if kname == "-" { - isAutoIncr = true - kname = "#" + fmt.Sprint(count) - count++ - } - - lineRight := strings.TrimSpace(line[i+1:]) - lineRightLength := len(lineRight) - firstChar := "" - if lineRightLength >= 2 { - firstChar = lineRight[0:1] - } - if firstChar == "`" { - valQuote = "`" - } else if firstChar == `"` { - if lineRightLength >= 3 && lineRight[0:3] == `"""` { - valQuote = `"""` - } else { - valQuote = `"` - } - } else if firstChar == `'` { - valQuote = `'` - } - - if len(valQuote) > 0 { - qLen := len(valQuote) - pos := strings.LastIndex(lineRight[qLen:], valQuote) - // For multiple-line value check. - if pos == -1 { - if valQuote == `"` || valQuote == `'` { - return fmt.Errorf("error parsing line: single quote does not allow multiple-line value: %s", line) - } - - val = lineRight[qLen:] + "\n" - val, err = checkMultipleLines(buf, line, val, valQuote) - if err != nil { - return err - } - } else { - val = lineRight[qLen : pos+qLen] - } - } else { - val = strings.TrimSpace(cutComment(lineRight)) - val, isEnd, err = checkContinuationLines(buf, val) - if err != nil { - return err - } - } - - k, err := section.NewKey(kname, val) - if err != nil { - return err - } - k.isAutoIncr = isAutoIncr - if len(comments) > 0 { - k.Comment = comments - comments = "" - } - - if isEnd { - break - } - } - return nil -} - -func (f *File) reload(s dataSource) error { - r, err := s.ReadCloser() - if err != nil { - return err - } - defer r.Close() - - return f.parse(r) -} - -// Reload reloads and parses all data sources. -func (f *File) Reload() (err error) { - for _, s := range f.dataSources { - if err = f.reload(s); err != nil { - return err - } - } - return nil -} - -// Append appends one or more data sources and reloads automatically. -func (f *File) Append(source interface{}, others ...interface{}) error { - ds, err := parseDataSource(source) - if err != nil { - return err - } - f.dataSources = append(f.dataSources, ds) - for _, s := range others { - ds, err = parseDataSource(s) - if err != nil { - return err - } - f.dataSources = append(f.dataSources, ds) - } - return f.Reload() -} - -// WriteToIndent writes file content into io.Writer with given value indention. -func (f *File) WriteToIndent(w io.Writer, indent string) (n int64, err error) { - equalSign := "=" - if PrettyFormat { - equalSign = " = " - } - - // Use buffer to make sure target is safe until finish encoding. - buf := bytes.NewBuffer(nil) - for i, sname := range f.sectionList { - sec := f.Section(sname) - if len(sec.Comment) > 0 { - if sec.Comment[0] != '#' && sec.Comment[0] != ';' { - sec.Comment = "; " + sec.Comment - } - if _, err = buf.WriteString(sec.Comment + LineBreak); err != nil { - return 0, err - } - } - - if i > 0 { - if _, err = buf.WriteString("[" + sname + "]" + LineBreak); err != nil { - return 0, err - } - } else { - // Write nothing if default section is empty. - if len(sec.keyList) == 0 { - continue - } - } - - for _, kname := range sec.keyList { - key := sec.Key(kname) - if len(key.Comment) > 0 { - if len(indent) > 0 && sname != DEFAULT_SECTION { - buf.WriteString(indent) - } - if key.Comment[0] != '#' && key.Comment[0] != ';' { - key.Comment = "; " + key.Comment - } - if _, err = buf.WriteString(key.Comment + LineBreak); err != nil { - return 0, err - } - } - - if len(indent) > 0 && sname != DEFAULT_SECTION { - buf.WriteString(indent) - } - - switch { - case key.isAutoIncr: - kname = "-" - case strings.Contains(kname, "`") || strings.Contains(kname, `"`): - kname = `"""` + kname + `"""` - case strings.Contains(kname, `=`) || strings.Contains(kname, `:`): - kname = "`" + kname + "`" - } - - val := key.value - // In case key value contains "\n", "`" or "\"". - if strings.Contains(val, "\n") || strings.Contains(val, "`") || strings.Contains(val, `"`) || - strings.Contains(val, "#") { - val = `"""` + val + `"""` - } - if _, err = buf.WriteString(kname + equalSign + val + LineBreak); err != nil { - return 0, err - } - } - - // Put a line between sections. - if _, err = buf.WriteString(LineBreak); err != nil { - return 0, err - } - } - - return buf.WriteTo(w) -} - -// WriteTo writes file content into io.Writer. -func (f *File) WriteTo(w io.Writer) (int64, error) { - return f.WriteToIndent(w, "") -} - -// SaveToIndent writes content to file system with given value indention. -func (f *File) SaveToIndent(filename, indent string) error { - // Note: Because we are truncating with os.Create, - // so it's safer to save to a temporary file location and rename afte done. - tmpPath := filename + "." + strconv.Itoa(time.Now().Nanosecond()) + ".tmp" - defer os.Remove(tmpPath) - - fw, err := os.Create(tmpPath) - if err != nil { - return err - } - - if _, err = f.WriteToIndent(fw, indent); err != nil { - fw.Close() - return err - } - fw.Close() - - // Remove old file and rename the new one. - os.Remove(filename) - return os.Rename(tmpPath, filename) -} - -// SaveTo writes content to file system. -func (f *File) SaveTo(filename string) error { - return f.SaveToIndent(filename, "") -} diff --git a/vendor/github.com/go-ini/ini/ini_test.go b/vendor/github.com/go-ini/ini/ini_test.go deleted file mode 100644 index 82ff36dd236..00000000000 --- a/vendor/github.com/go-ini/ini/ini_test.go +++ /dev/null @@ -1,512 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "fmt" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -func Test_Version(t *testing.T) { - Convey("Get version", t, func() { - So(Version(), ShouldEqual, _VERSION) - }) -} - -const _CONF_DATA = ` -; Package name -NAME = ini -; Package version -VERSION = v1 -; Package import path -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -# Information about package author -# Bio can be written in multiple lines. -[author] -NAME = Unknwon # Succeeding comment -E-MAIL = fake@localhost -GITHUB = https://github.com/%(NAME)s -BIO = """Gopher. -Coding addict. -Good man. -""" # Succeeding comment - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -UNUSED_KEY = should be deleted - -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values - -[types] -STRING = str -BOOL = true -BOOL_FALSE = false -FLOAT64 = 1.25 -INT = 10 -TIME = 2015-01-01T20:17:05Z -DURATION = 2h45m -UINT = 3 - -[array] -STRINGS = en, zh, de -FLOAT64S = 1.1, 2.2, 3.3 -INTS = 1, 2, 3 -UINTS = 1, 2, 3 -TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z - -[note] -empty_lines = next line is empty\ - -[advance] -value with quotes = "some value" -value quote2 again = 'some value' -true = """"2+3=5"""" -"1+1=2" = true -"""6+1=7""" = true -"""` + "`" + `5+5` + "`" + `""" = 10 -""""6+6"""" = 12 -` + "`" + `7-2=4` + "`" + ` = false -ADDRESS = ` + "`" + `404 road, -NotFound, State, 50000` + "`" + ` - -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 \ -` - -func Test_Load(t *testing.T) { - Convey("Load from data sources", t, func() { - - Convey("Load with empty data", func() { - So(Empty(), ShouldNotBeNil) - }) - - Convey("Load with multiple data sources", func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - }) - }) - - Convey("Bad load process", t, func() { - - Convey("Load from invalid data sources", func() { - _, err := Load(_CONF_DATA) - So(err, ShouldNotBeNil) - - _, err = Load("testdata/404.ini") - So(err, ShouldNotBeNil) - - _, err = Load(1) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(""), 1) - So(err, ShouldNotBeNil) - }) - - Convey("Load with empty section name", func() { - _, err := Load([]byte("[]")) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad keys", func() { - _, err := Load([]byte(`"""name`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`"""name"""`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`""=1`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`=`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`name`)) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad values", func() { - _, err := Load([]byte(`name="""Unknwon`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`key = "value`)) - So(err, ShouldNotBeNil) - }) - }) -} - -func Test_Values(t *testing.T) { - Convey("Test getting and setting values", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Get values in default section", func() { - sec := cfg.Section("") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").Value(), ShouldEqual, "ini") - So(sec.Key("NAME").String(), ShouldEqual, "ini") - So(sec.Key("NAME").Validate(func(in string) string { - return in - }), ShouldEqual, "ini") - So(sec.Key("NAME").Comment, ShouldEqual, "; Package name") - So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1") - }) - - Convey("Get values in non-default section", func() { - sec := cfg.Section("author") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").String(), ShouldEqual, "Unknwon") - So(sec.Key("GITHUB").String(), ShouldEqual, "https://github.com/Unknwon") - - sec = cfg.Section("package") - So(sec, ShouldNotBeNil) - So(sec.Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get auto-increment key names", func() { - keys := cfg.Section("features").Keys() - for i, k := range keys { - So(k.Name(), ShouldEqual, fmt.Sprintf("#%d", i+1)) - } - }) - - Convey("Get overwrite value", func() { - So(cfg.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("Get sections", func() { - sections := cfg.Sections() - for i, name := range []string{DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "advance"} { - So(sections[i].Name(), ShouldEqual, name) - } - }) - - Convey("Get parent section value", func() { - So(cfg.Section("package.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get multiple line value", func() { - So(cfg.Section("author").Key("BIO").String(), ShouldEqual, "Gopher.\nCoding addict.\nGood man.\n") - }) - - Convey("Get values with type", func() { - sec := cfg.Section("types") - v1, err := sec.Key("BOOL").Bool() - So(err, ShouldBeNil) - So(v1, ShouldBeTrue) - - v1, err = sec.Key("BOOL_FALSE").Bool() - So(err, ShouldBeNil) - So(v1, ShouldBeFalse) - - v2, err := sec.Key("FLOAT64").Float64() - So(err, ShouldBeNil) - So(v2, ShouldEqual, 1.25) - - v3, err := sec.Key("INT").Int() - So(err, ShouldBeNil) - So(v3, ShouldEqual, 10) - - v4, err := sec.Key("INT").Int64() - So(err, ShouldBeNil) - So(v4, ShouldEqual, 10) - - v5, err := sec.Key("UINT").Uint() - So(err, ShouldBeNil) - So(v5, ShouldEqual, 3) - - v6, err := sec.Key("UINT").Uint64() - So(err, ShouldBeNil) - So(v6, ShouldEqual, 3) - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - v7, err := sec.Key("TIME").Time() - So(err, ShouldBeNil) - So(v7.String(), ShouldEqual, t.String()) - - Convey("Must get values with type", func() { - So(sec.Key("STRING").MustString("404"), ShouldEqual, "str") - So(sec.Key("BOOL").MustBool(), ShouldBeTrue) - So(sec.Key("FLOAT64").MustFloat64(), ShouldEqual, 1.25) - So(sec.Key("INT").MustInt(), ShouldEqual, 10) - So(sec.Key("INT").MustInt64(), ShouldEqual, 10) - So(sec.Key("UINT").MustUint(), ShouldEqual, 3) - So(sec.Key("UINT").MustUint64(), ShouldEqual, 3) - So(sec.Key("TIME").MustTime().String(), ShouldEqual, t.String()) - - dur, err := time.ParseDuration("2h45m") - So(err, ShouldBeNil) - So(sec.Key("DURATION").MustDuration().Seconds(), ShouldEqual, dur.Seconds()) - - Convey("Must get values with default value", func() { - So(sec.Key("STRING_404").MustString("404"), ShouldEqual, "404") - So(sec.Key("BOOL_404").MustBool(true), ShouldBeTrue) - So(sec.Key("FLOAT64_404").MustFloat64(2.5), ShouldEqual, 2.5) - So(sec.Key("INT_404").MustInt(15), ShouldEqual, 15) - So(sec.Key("INT_404").MustInt64(15), ShouldEqual, 15) - So(sec.Key("UINT_404").MustUint(6), ShouldEqual, 6) - So(sec.Key("UINT_404").MustUint64(6), ShouldEqual, 6) - - t, err := time.Parse(time.RFC3339, "2014-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME_404").MustTime(t).String(), ShouldEqual, t.String()) - - So(sec.Key("DURATION_404").MustDuration(dur).Seconds(), ShouldEqual, dur.Seconds()) - }) - }) - }) - - Convey("Get value with candidates", func() { - sec := cfg.Section("types") - So(sec.Key("STRING").In("", []string{"str", "arr", "types"}), ShouldEqual, "str") - So(sec.Key("FLOAT64").InFloat64(0, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) - So(sec.Key("INT").InInt(0, []int{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("INT").InInt64(0, []int64{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("UINT").InUint(0, []uint{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("UINT").InUint64(0, []uint64{3, 6, 9}), ShouldEqual, 3) - - zt, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") - So(err, ShouldBeNil) - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME").InTime(zt, []time.Time{t, time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) - - Convey("Get value with candidates and default value", func() { - So(sec.Key("STRING_404").In("str", []string{"str", "arr", "types"}), ShouldEqual, "str") - So(sec.Key("FLOAT64_404").InFloat64(1.25, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) - So(sec.Key("INT_404").InInt(10, []int{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("INT64_404").InInt64(10, []int64{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("UINT_404").InUint(3, []uint{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("UINT_404").InUint64(3, []uint64{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("TIME_404").InTime(t, []time.Time{time.Now(), time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) - }) - }) - - Convey("Get values in range", func() { - sec := cfg.Section("types") - So(sec.Key("FLOAT64").RangeFloat64(0, 1, 2), ShouldEqual, 1.25) - So(sec.Key("INT").RangeInt(0, 10, 20), ShouldEqual, 10) - So(sec.Key("INT").RangeInt64(0, 10, 20), ShouldEqual, 10) - - minT, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") - So(err, ShouldBeNil) - midT, err := time.Parse(time.RFC3339, "2013-01-01T01:00:00Z") - So(err, ShouldBeNil) - maxT, err := time.Parse(time.RFC3339, "9999-01-01T01:00:00Z") - So(err, ShouldBeNil) - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME").RangeTime(t, minT, maxT).String(), ShouldEqual, t.String()) - - Convey("Get value in range with default value", func() { - So(sec.Key("FLOAT64").RangeFloat64(5, 0, 1), ShouldEqual, 5) - So(sec.Key("INT").RangeInt(7, 0, 5), ShouldEqual, 7) - So(sec.Key("INT").RangeInt64(7, 0, 5), ShouldEqual, 7) - So(sec.Key("TIME").RangeTime(t, minT, midT).String(), ShouldEqual, t.String()) - }) - }) - - Convey("Get values into slice", func() { - sec := cfg.Section("array") - So(strings.Join(sec.Key("STRINGS").Strings(","), ","), ShouldEqual, "en,zh,de") - So(len(sec.Key("STRINGS_404").Strings(",")), ShouldEqual, 0) - - vals1 := sec.Key("FLOAT64S").Float64s(",") - for i, v := range []float64{1.1, 2.2, 3.3} { - So(vals1[i], ShouldEqual, v) - } - - vals2 := sec.Key("INTS").Ints(",") - for i, v := range []int{1, 2, 3} { - So(vals2[i], ShouldEqual, v) - } - - vals3 := sec.Key("INTS").Int64s(",") - for i, v := range []int64{1, 2, 3} { - So(vals3[i], ShouldEqual, v) - } - - vals4 := sec.Key("UINTS").Uints(",") - for i, v := range []uint{1, 2, 3} { - So(vals4[i], ShouldEqual, v) - } - - vals5 := sec.Key("UINTS").Uint64s(",") - for i, v := range []uint64{1, 2, 3} { - So(vals5[i], ShouldEqual, v) - } - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - vals6 := sec.Key("TIMES").Times(",") - for i, v := range []time.Time{t, t, t} { - So(vals6[i].String(), ShouldEqual, v.String()) - } - }) - - Convey("Get key hash", func() { - cfg.Section("").KeysHash() - }) - - Convey("Set key value", func() { - k := cfg.Section("author").Key("NAME") - k.SetValue("无闻") - So(k.String(), ShouldEqual, "无闻") - }) - - Convey("Get key strings", func() { - So(strings.Join(cfg.Section("types").KeyStrings(), ","), ShouldEqual, "STRING,BOOL,BOOL_FALSE,FLOAT64,INT,TIME,DURATION,UINT") - }) - - Convey("Delete a key", func() { - cfg.Section("package.sub").DeleteKey("UNUSED_KEY") - _, err := cfg.Section("package.sub").GetKey("UNUSED_KEY") - So(err, ShouldNotBeNil) - }) - - Convey("Get section strings", func() { - So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,author,package,package.sub,features,types,array,note,advance") - }) - - Convey("Delete a section", func() { - cfg.DeleteSection("") - So(cfg.SectionStrings()[0], ShouldNotEqual, DEFAULT_SECTION) - }) - - Convey("Create new sections", func() { - cfg.NewSections("test", "test2") - _, err := cfg.GetSection("test") - So(err, ShouldBeNil) - _, err = cfg.GetSection("test2") - So(err, ShouldBeNil) - }) - }) - - Convey("Test getting and setting bad values", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Create new key with empty name", func() { - k, err := cfg.Section("").NewKey("", "") - So(err, ShouldNotBeNil) - So(k, ShouldBeNil) - }) - - Convey("Create new section with empty name", func() { - s, err := cfg.NewSection("") - So(err, ShouldNotBeNil) - So(s, ShouldBeNil) - }) - - Convey("Create new sections with empty name", func() { - So(cfg.NewSections(""), ShouldNotBeNil) - }) - - Convey("Get section that not exists", func() { - s, err := cfg.GetSection("404") - So(err, ShouldNotBeNil) - So(s, ShouldBeNil) - - s = cfg.Section("404") - So(s, ShouldNotBeNil) - }) - }) -} - -func Test_File_Append(t *testing.T) { - Convey("Append data sources", t, func() { - cfg, err := Load([]byte("")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Append([]byte(""), []byte("")), ShouldBeNil) - - Convey("Append bad data sources", func() { - So(cfg.Append(1), ShouldNotBeNil) - So(cfg.Append([]byte(""), 1), ShouldNotBeNil) - }) - }) -} - -func Test_File_SaveTo(t *testing.T) { - Convey("Save file", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.Section("").Key("NAME").Comment = "Package name" - cfg.Section("author").Comment = `Information about package author -# Bio can be written in multiple lines.` - cfg.Section("advanced").Key("val w/ pound").SetValue("my#password") - So(cfg.SaveTo("testdata/conf_out.ini"), ShouldBeNil) - - cfg.Section("author").Key("NAME").Comment = "This is author name" - So(cfg.SaveToIndent("testdata/conf_out.ini", "\t"), ShouldBeNil) - }) -} - -func Benchmark_Key_Value(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").Value() - } -} - -func Benchmark_Key_String(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").String() - } -} - -func Benchmark_Key_Value_NonBlock(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - c.BlockMode = false - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").Value() - } -} - -func Benchmark_Key_String_NonBlock(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - c.BlockMode = false - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").String() - } -} - -func Benchmark_Key_SetValue(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").SetValue("10") - } -} diff --git a/vendor/github.com/go-ini/ini/struct.go b/vendor/github.com/go-ini/ini/struct.go deleted file mode 100644 index c1184371010..00000000000 --- a/vendor/github.com/go-ini/ini/struct.go +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "errors" - "fmt" - "reflect" - "time" - "unicode" -) - -// NameMapper represents a ini tag name mapper. -type NameMapper func(string) string - -// Built-in name getters. -var ( - // AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE. - AllCapsUnderscore NameMapper = func(raw string) string { - newstr := make([]rune, 0, len(raw)) - for i, chr := range raw { - if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { - if i > 0 { - newstr = append(newstr, '_') - } - } - newstr = append(newstr, unicode.ToUpper(chr)) - } - return string(newstr) - } - // TitleUnderscore converts to format title_underscore. - TitleUnderscore NameMapper = func(raw string) string { - newstr := make([]rune, 0, len(raw)) - for i, chr := range raw { - if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { - if i > 0 { - newstr = append(newstr, '_') - } - chr -= ('A' - 'a') - } - newstr = append(newstr, chr) - } - return string(newstr) - } -) - -func (s *Section) parseFieldName(raw, actual string) string { - if len(actual) > 0 { - return actual - } - if s.f.NameMapper != nil { - return s.f.NameMapper(raw) - } - return raw -} - -func parseDelim(actual string) string { - if len(actual) > 0 { - return actual - } - return "," -} - -var reflectTime = reflect.TypeOf(time.Now()).Kind() - -// setWithProperType sets proper value to field based on its type, -// but it does not return error for failing parsing, -// because we want to use default value that is already assigned to strcut. -func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error { - switch t.Kind() { - case reflect.String: - if len(key.String()) == 0 { - return nil - } - field.SetString(key.String()) - case reflect.Bool: - boolVal, err := key.Bool() - if err != nil { - return nil - } - field.SetBool(boolVal) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - durationVal, err := key.Duration() - if err == nil { - field.Set(reflect.ValueOf(durationVal)) - return nil - } - - intVal, err := key.Int64() - if err != nil { - return nil - } - field.SetInt(intVal) - // byte is an alias for uint8, so supporting uint8 breaks support for byte - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - durationVal, err := key.Duration() - if err == nil { - field.Set(reflect.ValueOf(durationVal)) - return nil - } - - uintVal, err := key.Uint64() - if err != nil { - return nil - } - field.SetUint(uintVal) - - case reflect.Float64: - floatVal, err := key.Float64() - if err != nil { - return nil - } - field.SetFloat(floatVal) - case reflectTime: - timeVal, err := key.Time() - if err != nil { - return nil - } - field.Set(reflect.ValueOf(timeVal)) - case reflect.Slice: - vals := key.Strings(delim) - numVals := len(vals) - if numVals == 0 { - return nil - } - - sliceOf := field.Type().Elem().Kind() - - var times []time.Time - if sliceOf == reflectTime { - times = key.Times(delim) - } - - slice := reflect.MakeSlice(field.Type(), numVals, numVals) - for i := 0; i < numVals; i++ { - switch sliceOf { - case reflectTime: - slice.Index(i).Set(reflect.ValueOf(times[i])) - default: - slice.Index(i).Set(reflect.ValueOf(vals[i])) - } - } - field.Set(slice) - default: - return fmt.Errorf("unsupported type '%s'", t) - } - return nil -} - -func (s *Section) mapTo(val reflect.Value) error { - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - typ := val.Type() - - for i := 0; i < typ.NumField(); i++ { - field := val.Field(i) - tpField := typ.Field(i) - - tag := tpField.Tag.Get("ini") - if tag == "-" { - continue - } - - fieldName := s.parseFieldName(tpField.Name, tag) - if len(fieldName) == 0 || !field.CanSet() { - continue - } - - isAnonymous := tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous - isStruct := tpField.Type.Kind() == reflect.Struct - if isAnonymous { - field.Set(reflect.New(tpField.Type.Elem())) - } - - if isAnonymous || isStruct { - if sec, err := s.f.GetSection(fieldName); err == nil { - if err = sec.mapTo(field); err != nil { - return fmt.Errorf("error mapping field(%s): %v", fieldName, err) - } - continue - } - } - - if key, err := s.GetKey(fieldName); err == nil { - if err = setWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil { - return fmt.Errorf("error mapping field(%s): %v", fieldName, err) - } - } - } - return nil -} - -// MapTo maps section to given struct. -func (s *Section) MapTo(v interface{}) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return errors.New("cannot map to non-pointer struct") - } - - return s.mapTo(val) -} - -// MapTo maps file to given struct. -func (f *File) MapTo(v interface{}) error { - return f.Section("").MapTo(v) -} - -// MapTo maps data sources to given struct with name mapper. -func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { - cfg, err := Load(source, others...) - if err != nil { - return err - } - cfg.NameMapper = mapper - return cfg.MapTo(v) -} - -// MapTo maps data sources to given struct. -func MapTo(v, source interface{}, others ...interface{}) error { - return MapToWithMapper(v, nil, source, others...) -} - -// reflectWithProperType does the opposite thing with setWithProperType. -func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error { - switch t.Kind() { - case reflect.String: - key.SetValue(field.String()) - case reflect.Bool, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, - reflect.Float64, - reflectTime: - key.SetValue(fmt.Sprint(field)) - case reflect.Slice: - vals := field.Slice(0, field.Len()) - if field.Len() == 0 { - return nil - } - - var buf bytes.Buffer - isTime := fmt.Sprint(field.Type()) == "[]time.Time" - for i := 0; i < field.Len(); i++ { - if isTime { - buf.WriteString(vals.Index(i).Interface().(time.Time).Format(time.RFC3339)) - } else { - buf.WriteString(fmt.Sprint(vals.Index(i))) - } - buf.WriteString(delim) - } - key.SetValue(buf.String()[:buf.Len()-1]) - default: - return fmt.Errorf("unsupported type '%s'", t) - } - return nil -} - -func (s *Section) reflectFrom(val reflect.Value) error { - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - typ := val.Type() - - for i := 0; i < typ.NumField(); i++ { - field := val.Field(i) - tpField := typ.Field(i) - - tag := tpField.Tag.Get("ini") - if tag == "-" { - continue - } - - fieldName := s.parseFieldName(tpField.Name, tag) - if len(fieldName) == 0 || !field.CanSet() { - continue - } - - if (tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous) || - (tpField.Type.Kind() == reflect.Struct) { - // Note: The only error here is section doesn't exist. - sec, err := s.f.GetSection(fieldName) - if err != nil { - // Note: fieldName can never be empty here, ignore error. - sec, _ = s.f.NewSection(fieldName) - } - if err = sec.reflectFrom(field); err != nil { - return fmt.Errorf("error reflecting field(%s): %v", fieldName, err) - } - continue - } - - // Note: Same reason as secion. - key, err := s.GetKey(fieldName) - if err != nil { - key, _ = s.NewKey(fieldName, "") - } - if err = reflectWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil { - return fmt.Errorf("error reflecting field(%s): %v", fieldName, err) - } - - } - return nil -} - -// ReflectFrom reflects secion from given struct. -func (s *Section) ReflectFrom(v interface{}) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return errors.New("cannot reflect from non-pointer struct") - } - - return s.reflectFrom(val) -} - -// ReflectFrom reflects file from given struct. -func (f *File) ReflectFrom(v interface{}) error { - return f.Section("").ReflectFrom(v) -} - -// ReflectFrom reflects data sources from given struct with name mapper. -func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error { - cfg.NameMapper = mapper - return cfg.ReflectFrom(v) -} - -// ReflectFrom reflects data sources from given struct. -func ReflectFrom(cfg *File, v interface{}) error { - return ReflectFromWithMapper(cfg, v, nil) -} diff --git a/vendor/github.com/go-ini/ini/struct_test.go b/vendor/github.com/go-ini/ini/struct_test.go deleted file mode 100644 index d865ad78eb7..00000000000 --- a/vendor/github.com/go-ini/ini/struct_test.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -type testNested struct { - Cities []string `delim:"|"` - Visits []time.Time - Note string - Unused int `ini:"-"` -} - -type testEmbeded struct { - GPA float64 -} - -type testStruct struct { - Name string `ini:"NAME"` - Age int - Male bool - Money float64 - Born time.Time - Time time.Duration `ini:"Duration"` - Others testNested - *testEmbeded `ini:"grade"` - Unused int `ini:"-"` - Unsigned uint -} - -const _CONF_DATA_STRUCT = ` -NAME = Unknwon -Age = 21 -Male = true -Money = 1.25 -Born = 1993-10-07T20:17:05Z -Duration = 2h45m -Unsigned = 3 - -[Others] -Cities = HangZhou|Boston -Visits = 1993-10-07T20:17:05Z, 1993-10-07T20:17:05Z -Note = Hello world! - -[grade] -GPA = 2.8 - -[foo.bar] -Here = there -When = then -` - -type unsupport struct { - Byte byte -} - -type unsupport2 struct { - Others struct { - Cities byte - } -} - -type unsupport3 struct { - Cities byte -} - -type unsupport4 struct { - *unsupport3 `ini:"Others"` -} - -type defaultValue struct { - Name string - Age int - Male bool - Money float64 - Born time.Time - Cities []string -} - -type fooBar struct { - Here, When string -} - -const _INVALID_DATA_CONF_STRUCT = ` -Name = -Age = age -Male = 123 -Money = money -Born = nil -Cities = -` - -func Test_Struct(t *testing.T) { - Convey("Map to struct", t, func() { - Convey("Map file to struct", func() { - ts := new(testStruct) - So(MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil) - - So(ts.Name, ShouldEqual, "Unknwon") - So(ts.Age, ShouldEqual, 21) - So(ts.Male, ShouldBeTrue) - So(ts.Money, ShouldEqual, 1.25) - So(ts.Unsigned, ShouldEqual, 3) - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - So(ts.Born.String(), ShouldEqual, t.String()) - - dur, err := time.ParseDuration("2h45m") - So(err, ShouldBeNil) - So(ts.Time.Seconds(), ShouldEqual, dur.Seconds()) - - So(strings.Join(ts.Others.Cities, ","), ShouldEqual, "HangZhou,Boston") - So(ts.Others.Visits[0].String(), ShouldEqual, t.String()) - So(ts.Others.Note, ShouldEqual, "Hello world!") - So(ts.testEmbeded.GPA, ShouldEqual, 2.8) - }) - - Convey("Map section to struct", func() { - foobar := new(fooBar) - f, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - - So(f.Section("foo.bar").MapTo(foobar), ShouldBeNil) - So(foobar.Here, ShouldEqual, "there") - So(foobar.When, ShouldEqual, "then") - }) - - Convey("Map to non-pointer struct", func() { - cfg, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.MapTo(testStruct{}), ShouldNotBeNil) - }) - - Convey("Map to unsupported type", func() { - cfg, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = func(raw string) string { - if raw == "Byte" { - return "NAME" - } - return raw - } - So(cfg.MapTo(&unsupport{}), ShouldNotBeNil) - So(cfg.MapTo(&unsupport2{}), ShouldNotBeNil) - So(cfg.MapTo(&unsupport4{}), ShouldNotBeNil) - }) - - Convey("Map from invalid data source", func() { - So(MapTo(&testStruct{}, "hi"), ShouldNotBeNil) - }) - - Convey("Map to wrong types and gain default values", func() { - cfg, err := Load([]byte(_INVALID_DATA_CONF_STRUCT)) - So(err, ShouldBeNil) - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - dv := &defaultValue{"Joe", 10, true, 1.25, t, []string{"HangZhou", "Boston"}} - So(cfg.MapTo(dv), ShouldBeNil) - So(dv.Name, ShouldEqual, "Joe") - So(dv.Age, ShouldEqual, 10) - So(dv.Male, ShouldBeTrue) - So(dv.Money, ShouldEqual, 1.25) - So(dv.Born.String(), ShouldEqual, t.String()) - So(strings.Join(dv.Cities, ","), ShouldEqual, "HangZhou,Boston") - }) - }) - - Convey("Reflect from struct", t, func() { - type Embeded struct { - Dates []time.Time `delim:"|"` - Places []string - None []int - } - type Author struct { - Name string `ini:"NAME"` - Male bool - Age int - GPA float64 - NeverMind string `ini:"-"` - *Embeded `ini:"infos"` - } - a := &Author{"Unknwon", true, 21, 2.8, "", - &Embeded{ - []time.Time{time.Now(), time.Now()}, - []string{"HangZhou", "Boston"}, - []int{}, - }} - cfg := Empty() - So(ReflectFrom(cfg, a), ShouldBeNil) - cfg.SaveTo("testdata/conf_reflect.ini") - - Convey("Reflect from non-point struct", func() { - So(ReflectFrom(cfg, Author{}), ShouldNotBeNil) - }) - }) -} - -type testMapper struct { - PackageName string -} - -func Test_NameGetter(t *testing.T) { - Convey("Test name mappers", t, func() { - So(MapToWithMapper(&testMapper{}, TitleUnderscore, []byte("packag_name=ini")), ShouldBeNil) - - cfg, err := Load([]byte("PACKAGE_NAME=ini")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = AllCapsUnderscore - tg := new(testMapper) - So(cfg.MapTo(tg), ShouldBeNil) - So(tg.PackageName, ShouldEqual, "ini") - }) -} diff --git a/vendor/github.com/go-ini/ini/testdata/conf.ini b/vendor/github.com/go-ini/ini/testdata/conf.ini deleted file mode 100644 index 2ed0ac1d3ac..00000000000 --- a/vendor/github.com/go-ini/ini/testdata/conf.ini +++ /dev/null @@ -1,2 +0,0 @@ -[author] -E-MAIL = u@gogs.io \ No newline at end of file diff --git a/vendor/github.com/gopherjs/gopherjs/LICENSE b/vendor/github.com/gopherjs/gopherjs/LICENSE deleted file mode 100644 index d496fef1092..00000000000 --- a/vendor/github.com/gopherjs/gopherjs/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2013 Richard Musiol. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/grafana/grafana-cli/LICENSE b/vendor/github.com/grafana/grafana-cli/LICENSE deleted file mode 100644 index 8dada3edaf5..00000000000 --- a/vendor/github.com/grafana/grafana-cli/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/command_line.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/command_line.go deleted file mode 100644 index edbdc03d7c2..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/command_line.go +++ /dev/null @@ -1,35 +0,0 @@ -package commands - -import ( - "github.com/codegangsta/cli" -) - -type CommandLine interface { - ShowHelp() - ShowVersion() - Application() *cli.App - Args() cli.Args - Bool(name string) bool - Int(name string) int - String(name string) string - StringSlice(name string) []string - GlobalString(name string) string - FlagNames() (names []string) - Generic(name string) interface{} -} - -type contextCommandLine struct { - *cli.Context -} - -func (c *contextCommandLine) ShowHelp() { - cli.ShowCommandHelp(c.Context, c.Command.Name) -} - -func (c *contextCommandLine) ShowVersion() { - cli.ShowVersion(c.Context) -} - -func (c *contextCommandLine) Application() *cli.App { - return c.App -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/commands.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/commands.go deleted file mode 100644 index e72a1e45ff6..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/commands.go +++ /dev/null @@ -1,48 +0,0 @@ -package commands - -import ( - "github.com/codegangsta/cli" - "github.com/grafana/grafana-cli/pkg/log" -) - -func runCommand(command func(commandLine CommandLine) error) func(context *cli.Context) { - return func(context *cli.Context) { - - cmd := &contextCommandLine{context} - if err := command(cmd); err != nil { - log.Errorf("%v\n\n", err) - - cmd.ShowHelp() - } else { - log.Info("Restart grafana after installing plugins . \n") - } - } -} - -var Commands = []cli.Command{ - { - Name: "install", - Usage: "installs stuff", - Action: runCommand(installCommand), - }, { - Name: "list-remote", - Usage: "list remote available plugins", - Action: runCommand(listremoteCommand), - }, { - Name: "upgrade", - Usage: "upgrades one plugin", - Action: runCommand(upgradeCommand), - }, { - Name: "upgrade-all", - Usage: "upgrades all your installed plugins", - Action: runCommand(upgradeAllCommand), - }, { - Name: "ls", - Usage: "list all installed plugins", - Action: runCommand(lsCommand), - }, { - Name: "remove", - Usage: "removes stuff", - Action: runCommand(removeCommand), - }, -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_commandLine.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_commandLine.go deleted file mode 100644 index 4a070b5a192..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_commandLine.go +++ /dev/null @@ -1,95 +0,0 @@ -package commandstest - -import ( - "github.com/codegangsta/cli" -) - -type FakeFlagger struct { - Data map[string]interface{} -} - -type FakeCommandLine struct { - LocalFlags, GlobalFlags *FakeFlagger - HelpShown, VersionShown bool - CliArgs []string -} - -func (ff FakeFlagger) String(key string) string { - if value, ok := ff.Data[key]; ok { - return value.(string) - } - return "" -} - -func (ff FakeFlagger) StringSlice(key string) []string { - if value, ok := ff.Data[key]; ok { - return value.([]string) - } - return []string{} -} - -func (ff FakeFlagger) Int(key string) int { - if value, ok := ff.Data[key]; ok { - return value.(int) - } - return 0 -} - -func (ff FakeFlagger) Bool(key string) bool { - if value, ok := ff.Data[key]; ok { - return value.(bool) - } - return false -} - -func (fcli *FakeCommandLine) String(key string) string { - return fcli.LocalFlags.String(key) -} - -func (fcli *FakeCommandLine) StringSlice(key string) []string { - return fcli.LocalFlags.StringSlice(key) -} - -func (fcli *FakeCommandLine) Int(key string) int { - return fcli.LocalFlags.Int(key) -} - -func (fcli *FakeCommandLine) Bool(key string) bool { - if fcli.LocalFlags == nil { - return false - } - return fcli.LocalFlags.Bool(key) -} - -func (fcli *FakeCommandLine) GlobalString(key string) string { - return fcli.GlobalFlags.String(key) -} - -func (fcli *FakeCommandLine) Generic(name string) interface{} { - return fcli.LocalFlags.Data[name] -} - -func (fcli *FakeCommandLine) FlagNames() []string { - flagNames := []string{} - for key := range fcli.LocalFlags.Data { - flagNames = append(flagNames, key) - } - - return flagNames -} - -func (fcli *FakeCommandLine) ShowHelp() { - fcli.HelpShown = true -} - -func (fcli *FakeCommandLine) Application() *cli.App { - return cli.NewApp() -} - -func (fcli *FakeCommandLine) Args() cli.Args { - return fcli.CliArgs -} - -func (fcli *FakeCommandLine) ShowVersion() { - fcli.VersionShown = true -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_ioutil.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_ioutil.go deleted file mode 100644 index e6715a5ea77..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/commandstest/fake_ioutil.go +++ /dev/null @@ -1,55 +0,0 @@ -package commandstest - -import ( - "os" - "time" -) - -type FakeIoUtil struct { - FakeReadDir []os.FileInfo - FakeIsDirectory bool -} - -func (util *FakeIoUtil) Stat(path string) (os.FileInfo, error) { - return FakeFileInfo{IsDirectory: util.FakeIsDirectory}, nil -} - -func (util *FakeIoUtil) RemoveAll(path string) error { - return nil -} - -func (util *FakeIoUtil) ReadDir(path string) ([]os.FileInfo, error) { - return util.FakeReadDir, nil -} - -func (i *FakeIoUtil) ReadFile(filename string) ([]byte, error) { - return make([]byte, 0), nil -} - -type FakeFileInfo struct { - IsDirectory bool -} - -func (ffi FakeFileInfo) IsDir() bool { - return ffi.IsDirectory -} - -func (ffi FakeFileInfo) Size() int64 { - return 1 -} - -func (ffi FakeFileInfo) Mode() os.FileMode { - return 0777 -} - -func (ffi FakeFileInfo) Name() string { - return "" -} - -func (ffi FakeFileInfo) ModTime() time.Time { - return time.Time{} -} - -func (ffi FakeFileInfo) Sys() interface{} { - return nil -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/install_command.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/install_command.go deleted file mode 100644 index f8807d66108..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/install_command.go +++ /dev/null @@ -1,146 +0,0 @@ -package commands - -import ( - "archive/zip" - "bytes" - "errors" - "github.com/grafana/grafana-cli/pkg/log" - m "github.com/grafana/grafana-cli/pkg/models" - services "github.com/grafana/grafana-cli/pkg/services" - "io" - "io/ioutil" - "net/http" - "os" - "path" - "regexp" -) - -func validateInput(c CommandLine, pluginFolder string) error { - arg := c.Args().First() - if arg == "" { - return errors.New("please specify plugin to install") - } - - pluginDir := c.GlobalString("path") - if pluginDir == "" { - return errors.New("missing path flag") - } - - fileinfo, err := os.Stat(pluginDir) - if err != nil && !fileinfo.IsDir() { - return errors.New("path is not a directory") - } - - return nil -} - -func installCommand(c CommandLine) error { - pluginFolder := c.GlobalString("path") - if err := validateInput(c, pluginFolder); err != nil { - return err - } - - pluginToInstall := c.Args().First() - version := c.Args().Get(1) - - log.Infof("version: %v\n", version) - - return InstallPlugin(pluginToInstall, pluginFolder, version) -} - -func InstallPlugin(pluginName, pluginFolder, version string) error { - plugin, err := services.GetPlugin(pluginName) - if err != nil { - return err - } - - v, err := SelectVersion(plugin, version) - if err != nil { - return err - } - - url := v.Url - commit := v.Commit - - downloadURL := url + "/archive/" + commit + ".zip" - - log.Infof("installing %v @ %v\n", plugin.Id, version) - log.Infof("from url: %v\n", downloadURL) - log.Infof("on commit: %v\n", commit) - log.Infof("into: %v\n", pluginFolder) - - err = downloadFile(plugin.Id, pluginFolder, downloadURL) - if err == nil { - log.Info("Installed %s successfully ✔\n", plugin.Id) - } - - res := services.ReadPlugin(pluginFolder, pluginName) - - for _, v := range res.Dependency.Plugins { - log.Infof("Depends on %s install!\n", v.Id) - - //Todo: uncomment this code once the repo is more correct. - //InstallPlugin(v.Id, pluginFolder, "") - } - - return err -} - -func SelectVersion(plugin m.Plugin, version string) (m.Version, error) { - if version == "" { - return plugin.Versions[0], nil - } - - for _, v := range plugin.Versions { - if v.Version == version { - return v, nil - } - } - - return m.Version{}, errors.New("Could not find the version your looking for") -} - -func RemoveGitBuildFromname(pluginname, filename string) string { - r := regexp.MustCompile("^[a-zA-Z0-9_.-]*/") - return r.ReplaceAllString(filename, pluginname+"/") -} - -func downloadFile(pluginName, filepath, url string) (err error) { - resp, err := http.Get(url) - if err != nil { - return err - } - defer resp.Body.Close() - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - - r, err := zip.NewReader(bytes.NewReader(body), resp.ContentLength) - if err != nil { - return err - } - for _, zf := range r.File { - newfile := path.Join(filepath, RemoveGitBuildFromname(pluginName, zf.Name)) - - if zf.FileInfo().IsDir() { - os.Mkdir(newfile, 0777) - } else { - dst, err := os.Create(newfile) - if err != nil { - log.Errorf("%v", err) - } - defer dst.Close() - src, err := zf.Open() - if err != nil { - log.Errorf("%v", err) - } - defer src.Close() - - io.Copy(dst, src) - } - } - - return nil -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/listremote_command.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/listremote_command.go deleted file mode 100644 index 9dc1af204c9..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/listremote_command.go +++ /dev/null @@ -1,20 +0,0 @@ -package commands - -import ( - "github.com/grafana/grafana-cli/pkg/log" - "github.com/grafana/grafana-cli/pkg/services" -) - -func listremoteCommand(c CommandLine) error { - plugin, err := services.ListAllPlugins() - - if err != nil { - return err - } - - for _, i := range plugin.Plugins { - log.Infof("id: %v version:\n", i.Id) - } - - return nil -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/ls_command.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/ls_command.go deleted file mode 100644 index 7965f74de27..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/ls_command.go +++ /dev/null @@ -1,49 +0,0 @@ -package commands - -import ( - "errors" - "github.com/grafana/grafana-cli/pkg/log" - m "github.com/grafana/grafana-cli/pkg/models" - s "github.com/grafana/grafana-cli/pkg/services" -) - -var getPlugins func(path string) []m.InstalledPlugin - -var GetStat m.IoUtil - -func init() { - getPlugins = s.GetLocalPlugins - GetStat = s.IoUtil -} - -func validateCommand(pluginDir string) error { - if pluginDir == "" { - return errors.New("missing path flag") - } - - log.Info("plugindir: " + pluginDir + "\n") - pluginDirInfo, err := GetStat.Stat(pluginDir) - - if err != nil { - return errors.New("missing path flag") - } - - if pluginDirInfo.IsDir() == false { - return errors.New("plugin path is not a directory") - } - - return nil -} - -func lsCommand(c CommandLine) error { - pluginDir := c.GlobalString("path") - if err := validateCommand(pluginDir); err != nil { - return err - } - - for _, plugin := range getPlugins(pluginDir) { - log.Infof("plugin: %s @ %s \n", plugin.Name, plugin.Info.Version) - } - - return nil -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/remove_command.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/remove_command.go deleted file mode 100644 index 4a25d04404e..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/remove_command.go +++ /dev/null @@ -1,35 +0,0 @@ -package commands - -import ( - "errors" - "github.com/grafana/grafana-cli/pkg/log" - m "github.com/grafana/grafana-cli/pkg/models" - services "github.com/grafana/grafana-cli/pkg/services" -) - -var getPluginss func(path string) []m.InstalledPlugin = services.GetLocalPlugins -var removePlugin func(pluginPath, id string) error = services.RemoveInstalledPlugin - -func removeCommand(c CommandLine) error { - pluginPath := c.GlobalString("path") - localPlugins := getPluginss(pluginPath) - - log.Info("remove!\n") - - plugin := c.Args().First() - log.Info("plugin: " + plugin + "\n") - if plugin == "" { - return errors.New("Missing which plugin parameter") - } - - log.Infof("plugins : \n%v\n", localPlugins) - - for _, p := range localPlugins { - log.Infof("is %s == %s ? %v", p.Id, c.Args().First(), p.Id == c.Args().First()) - if p.Id == c.Args().First() { - removePlugin(pluginPath, p.Id) - } - } - - return nil -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_all_command.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_all_command.go deleted file mode 100644 index 97454769e62..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_all_command.go +++ /dev/null @@ -1,61 +0,0 @@ -package commands - -import ( - "github.com/grafana/grafana-cli/pkg/log" - m "github.com/grafana/grafana-cli/pkg/models" - services "github.com/grafana/grafana-cli/pkg/services" - "github.com/hashicorp/go-version" -) - -func ShouldUpgrade(installed string, remote m.Plugin) bool { - installedVersion, err1 := version.NewVersion(installed) - - if err1 != nil { - return false - } - - for _, v := range remote.Versions { - remoteVersion, err2 := version.NewVersion(v.Version) - - if err2 == nil { - if installedVersion.LessThan(remoteVersion) { - return true - } - } - } - - return false -} - -func upgradeAllCommand(c CommandLine) error { - pluginDir := c.GlobalString("path") - - localPlugins := services.GetLocalPlugins(pluginDir) - - remotePlugins, err := services.ListAllPlugins() - - if err != nil { - return err - } - - pluginsToUpgrade := make([]m.InstalledPlugin, 0) - - for _, localPlugin := range localPlugins { - for _, remotePlugin := range remotePlugins.Plugins { - if localPlugin.Id == remotePlugin.Id { - if ShouldUpgrade(localPlugin.Info.Version, remotePlugin) { - pluginsToUpgrade = append(pluginsToUpgrade, localPlugin) - } - } - } - } - - for _, p := range pluginsToUpgrade { - log.Infof("lets upgrade %v \n", p) - - services.RemoveInstalledPlugin(pluginDir, p.Id) - InstallPlugin(p.Id, pluginDir, "") - } - - return nil -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_command.go b/vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_command.go deleted file mode 100644 index df9581b3dc3..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/commands/upgrade_command.go +++ /dev/null @@ -1,9 +0,0 @@ -package commands - -import ( - "errors" -) - -func upgradeCommand(c CommandLine) error { - return errors.New("Not yet Implemented") -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/log/log.go b/vendor/github.com/grafana/grafana-cli/pkg/log/log.go deleted file mode 100644 index c8222d60c81..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/log/log.go +++ /dev/null @@ -1,49 +0,0 @@ -package log - -import ( - "fmt" -) - -var ( - debugmode = false -) - -func Debug(args ...interface{}) { - if debugmode { - fmt.Print(args...) - } -} - -func Debugf(fmtString string, args ...interface{}) { - if debugmode { - fmt.Printf(fmtString, args...) - } -} - -func Error(args ...interface{}) { - fmt.Print(args...) -} - -func Errorf(fmtString string, args ...interface{}) { - fmt.Printf(fmtString, args...) -} - -func Info(args ...interface{}) { - fmt.Print(args...) -} - -func Infof(fmtString string, args ...interface{}) { - fmt.Printf(fmtString, args...) -} - -func Warn(args ...interface{}) { - fmt.Print(args...) -} - -func Warnf(fmtString string, args ...interface{}) { - fmt.Printf(fmtString, args...) -} - -func SetDebug(value bool) { - debugmode = value -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/models/model.go b/vendor/github.com/grafana/grafana-cli/pkg/models/model.go deleted file mode 100644 index 3a39c5fbe65..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/models/model.go +++ /dev/null @@ -1,48 +0,0 @@ -package models - -import ( - "os" -) - -type InstalledPlugin struct { - Id string `json:"id"` - Name string `json:"name"` - Type string `json:"type"` - - Info PluginInfo `json:"info"` - Dependency Dependency `json:"dependencies"` -} - -type Dependency struct { - GrafanaVersion string `json:"grafanaVersion"` - Plugins []Plugin `json:"plugins"` -} - -type PluginInfo struct { - Version string `json:"version"` - Updated string `json:"updated"` -} - -type Plugin struct { - Id string `json:"id"` - Category string `json:"category"` - Versions []Version `json:"versions"` -} - -type Version struct { - Commit string `json:"commit"` - Url string `json:"url"` - Version string `json:"version"` -} - -type PluginRepo struct { - Plugins []Plugin `json:"plugins"` - Version string `json:"version"` -} - -type IoUtil interface { - Stat(path string) (os.FileInfo, error) - RemoveAll(path string) error - ReadDir(path string) ([]os.FileInfo, error) - ReadFile(filename string) ([]byte, error) -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/services/io_util.go b/vendor/github.com/grafana/grafana-cli/pkg/services/io_util.go deleted file mode 100644 index 5a7cd187575..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/services/io_util.go +++ /dev/null @@ -1,28 +0,0 @@ -package services - -import ( - m "github.com/grafana/grafana-cli/pkg/models" - "io/ioutil" - "os" -) - -var IoUtil m.IoUtil = IoUtilImp{} - -type IoUtilImp struct { -} - -func (i IoUtilImp) Stat(path string) (os.FileInfo, error) { - return os.Stat(path) -} - -func (i IoUtilImp) RemoveAll(path string) error { - return os.RemoveAll(path) -} - -func (i IoUtilImp) ReadDir(path string) ([]os.FileInfo, error) { - return ioutil.ReadDir(path) -} - -func (i IoUtilImp) ReadFile(filename string) ([]byte, error) { - return ioutil.ReadFile(filename) -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/services/services.go b/vendor/github.com/grafana/grafana-cli/pkg/services/services.go deleted file mode 100644 index 9e5b65f5e84..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/services/services.go +++ /dev/null @@ -1,70 +0,0 @@ -package services - -import ( - "encoding/json" - "errors" - "github.com/franela/goreq" - m "github.com/grafana/grafana-cli/pkg/models" - "path" -) - -var IoHelper m.IoUtil = IoUtilImp{} - -func ListAllPlugins() (m.PluginRepo, error) { - res, _ := goreq.Request{Uri: "https://raw.githubusercontent.com/grafana/grafana-plugin-repository/master/repo.json"}.Do() - - var resp m.PluginRepo - err := res.Body.FromJsonTo(&resp) - if err != nil { - return m.PluginRepo{}, errors.New("Could not load plugin data") - } - - return resp, nil -} - -func ReadPlugin(pluginDir, pluginName string) m.InstalledPlugin { - pluginDataPath := path.Join(pluginDir, pluginName, "plugin.json") - pluginData, _ := IoHelper.ReadFile(pluginDataPath) - - res := m.InstalledPlugin{} - json.Unmarshal(pluginData, &res) - - if res.Info.Version == "" { - res.Info.Version = "0.0.0" - } - - if res.Id == "" { - res.Id = res.Name - } - - return res -} - -func GetLocalPlugins(pluginDir string) []m.InstalledPlugin { - result := make([]m.InstalledPlugin, 0) - files, _ := IoHelper.ReadDir(pluginDir) - for _, f := range files { - res := ReadPlugin(pluginDir, f.Name()) - result = append(result, res) - } - - return result -} - -func RemoveInstalledPlugin(pluginPath, id string) error { - return IoHelper.RemoveAll(path.Join(pluginPath, id)) -} - -func GetPlugin(id string) (m.Plugin, error) { - resp, err := ListAllPlugins() - if err != nil { - } - - for _, i := range resp.Plugins { - if i.Id == id { - return i, nil - } - } - - return m.Plugin{}, errors.New("could not find plugin named \"" + id + "\"") -} diff --git a/vendor/github.com/grafana/grafana-cli/pkg/version/version.go b/vendor/github.com/grafana/grafana-cli/pkg/version/version.go deleted file mode 100644 index 2a0eddf9859..00000000000 --- a/vendor/github.com/grafana/grafana-cli/pkg/version/version.go +++ /dev/null @@ -1,5 +0,0 @@ -package version - -var ( - Version = "0.0.2" -) diff --git a/vendor/github.com/influxdata/influxdb/LICENSE b/vendor/github.com/influxdata/influxdb/LICENSE deleted file mode 100644 index 63cef79ba6f..00000000000 --- a/vendor/github.com/influxdata/influxdb/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2016 Errplane Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md b/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md deleted file mode 100644 index f0794abc112..00000000000 --- a/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md +++ /dev/null @@ -1,27 +0,0 @@ -# List -- bootstrap 3.3.5 [MIT LICENSE](https://github.com/twbs/bootstrap/blob/master/LICENSE) -- collectd.org [ISC LICENSE](https://github.com/collectd/go-collectd/blob/master/LICENSE) -- github.com/armon/go-metrics [MIT LICENSE](https://github.com/armon/go-metrics/blob/master/LICENSE) -- github.com/BurntSushi/toml [WTFPL LICENSE](https://github.com/BurntSushi/toml/blob/master/COPYING) -- github.com/bmizerany/pat [MIT LICENSE](https://github.com/bmizerany/pat#license) -- github.com/boltdb/bolt [MIT LICENSE](https://github.com/boltdb/bolt/blob/master/LICENSE) -- github.com/dgryski/go-bits [MIT LICENSE](https://github.com/dgryski/go-bits/blob/master/LICENSE) -- github.com/dgryski/go-bitstream [MIT LICENSE](https://github.com/dgryski/go-bitstream/blob/master/LICENSE) -- github.com/gogo/protobuf/proto [BSD LICENSE](https://github.com/gogo/protobuf/blob/master/LICENSE) -- github.com/davecgh/go-spew/spew [ISC LICENSE](https://github.com/davecgh/go-spew/blob/master/LICENSE) -- github.com/golang/snappy [BSD LICENSE](https://github.com/golang/snappy/blob/master/LICENSE) -- github.com/hashicorp/go-msgpack [BSD LICENSE](https://github.com/hashicorp/go-msgpack/blob/master/LICENSE) -- github.com/hashicorp/raft [MPL LICENSE](https://github.com/hashicorp/raft/blob/master/LICENSE) -- github.com/hashicorp/raft-boltdb [MOZILLA PUBLIC LICENSE](https://github.com/hashicorp/raft-boltdb/blob/master/LICENSE) -- github.com/influxdata/usage-client [MIT LICENSE](https://github.com/influxdata/usage-client/blob/master/LICENSE.txt) -- github.com/jwilder/encoding [MIT LICENSE](https://github.com/jwilder/encoding/blob/master/LICENSE) -- github.com/kimor79/gollectd [BSD LICENSE](https://github.com/kimor79/gollectd/blob/master/LICENSE) -- github.com/paulbellamy/ratecounter [MIT LICENSE](https://github.com/paulbellamy/ratecounter/blob/master/LICENSE) -- github.com/peterh/liner [MIT LICENSE](https://github.com/peterh/liner/blob/master/COPYING) -- github.com/rakyll/statik [APACHE LICENSE](https://github.com/rakyll/statik/blob/master/LICENSE) -- glyphicons [LICENSE](http://glyphicons.com/license/) -- golang.org/x/crypto [BSD LICENSE](https://github.com/golang/crypto/blob/master/LICENSE) -- golang.org/x/tools [BSD LICENSE](https://github.com/golang/tools/blob/master/LICENSE) -- gopkg.in/fatih/pool.v2 [MIT LICENSE](https://github.com/fatih/pool/blob/v2.0.0/LICENSE) -- jquery 2.1.4 [MIT LICENSE](https://github.com/jquery/jquery/blob/master/LICENSE.txt) -- react 0.13.3 [BSD LICENSE](https://github.com/facebook/react/blob/master/LICENSE) diff --git a/vendor/github.com/smartystreets/goconvey/LICENSE.md b/vendor/github.com/smartystreets/goconvey/LICENSE.md deleted file mode 100644 index 55b77008282..00000000000 --- a/vendor/github.com/smartystreets/goconvey/LICENSE.md +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2014 SmartyStreets, LLC - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -NOTE: Various optional and subordinate components carry their own licensing -requirements and restrictions. Use of those components is subject to the terms -and conditions outlined the respective license of each component. diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions.go b/vendor/github.com/smartystreets/goconvey/convey/assertions.go deleted file mode 100644 index a7c1028564f..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions.go +++ /dev/null @@ -1,65 +0,0 @@ -package convey - -import "github.com/smartystreets/goconvey/convey/assertions" - -var ( - ShouldEqual = assertions.ShouldEqual - ShouldNotEqual = assertions.ShouldNotEqual - ShouldAlmostEqual = assertions.ShouldAlmostEqual - ShouldNotAlmostEqual = assertions.ShouldNotAlmostEqual - ShouldResemble = assertions.ShouldResemble - ShouldNotResemble = assertions.ShouldNotResemble - ShouldPointTo = assertions.ShouldPointTo - ShouldNotPointTo = assertions.ShouldNotPointTo - ShouldBeNil = assertions.ShouldBeNil - ShouldNotBeNil = assertions.ShouldNotBeNil - ShouldBeTrue = assertions.ShouldBeTrue - ShouldBeFalse = assertions.ShouldBeFalse - ShouldBeZeroValue = assertions.ShouldBeZeroValue - - ShouldBeGreaterThan = assertions.ShouldBeGreaterThan - ShouldBeGreaterThanOrEqualTo = assertions.ShouldBeGreaterThanOrEqualTo - ShouldBeLessThan = assertions.ShouldBeLessThan - ShouldBeLessThanOrEqualTo = assertions.ShouldBeLessThanOrEqualTo - ShouldBeBetween = assertions.ShouldBeBetween - ShouldNotBeBetween = assertions.ShouldNotBeBetween - ShouldBeBetweenOrEqual = assertions.ShouldBeBetweenOrEqual - ShouldNotBeBetweenOrEqual = assertions.ShouldNotBeBetweenOrEqual - - ShouldContain = assertions.ShouldContain - ShouldNotContain = assertions.ShouldNotContain - ShouldBeIn = assertions.ShouldBeIn - ShouldNotBeIn = assertions.ShouldNotBeIn - ShouldBeEmpty = assertions.ShouldBeEmpty - ShouldNotBeEmpty = assertions.ShouldNotBeEmpty - - ShouldStartWith = assertions.ShouldStartWith - ShouldNotStartWith = assertions.ShouldNotStartWith - ShouldEndWith = assertions.ShouldEndWith - ShouldNotEndWith = assertions.ShouldNotEndWith - ShouldBeBlank = assertions.ShouldBeBlank - ShouldNotBeBlank = assertions.ShouldNotBeBlank - ShouldContainSubstring = assertions.ShouldContainSubstring - ShouldNotContainSubstring = assertions.ShouldNotContainSubstring - - ShouldPanic = assertions.ShouldPanic - ShouldNotPanic = assertions.ShouldNotPanic - ShouldPanicWith = assertions.ShouldPanicWith - ShouldNotPanicWith = assertions.ShouldNotPanicWith - - ShouldHaveSameTypeAs = assertions.ShouldHaveSameTypeAs - ShouldNotHaveSameTypeAs = assertions.ShouldNotHaveSameTypeAs - ShouldImplement = assertions.ShouldImplement - ShouldNotImplement = assertions.ShouldNotImplement - - ShouldHappenBefore = assertions.ShouldHappenBefore - ShouldHappenOnOrBefore = assertions.ShouldHappenOnOrBefore - ShouldHappenAfter = assertions.ShouldHappenAfter - ShouldHappenOnOrAfter = assertions.ShouldHappenOnOrAfter - ShouldHappenBetween = assertions.ShouldHappenBetween - ShouldHappenOnOrBetween = assertions.ShouldHappenOnOrBetween - ShouldNotHappenOnOrBetween = assertions.ShouldNotHappenOnOrBetween - ShouldHappenWithin = assertions.ShouldHappenWithin - ShouldNotHappenWithin = assertions.ShouldNotHappenWithin - ShouldBeChronological = assertions.ShouldBeChronological -) diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/assertions.goconvey b/vendor/github.com/smartystreets/goconvey/convey/assertions/assertions.goconvey deleted file mode 100644 index 8a7f1b6671a..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/assertions.goconvey +++ /dev/null @@ -1,3 +0,0 @@ -#ignore --timeout=1s --coverpkg=github.com/smartystreets/goconvey/convey/assertions,github.com/smartystreets/goconvey/convey/assertions/oglematchers \ No newline at end of file diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go deleted file mode 100644 index 5b326dccb83..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go +++ /dev/null @@ -1,140 +0,0 @@ -package assertions - -import ( - "fmt" - "reflect" - - "github.com/smartystreets/goconvey/convey/assertions/oglematchers" -) - -// ShouldContain receives exactly two parameters. The first is a slice and the -// second is a proposed member. Membership is determined using ShouldEqual. -func ShouldContain(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - if matchError := oglematchers.Contains(expected[0]).Matches(actual); matchError != nil { - typeName := reflect.TypeOf(actual) - - if fmt.Sprintf("%v", matchError) == "which is not a slice or array" { - return fmt.Sprintf(shouldHaveBeenAValidCollection, typeName) - } - return fmt.Sprintf(shouldHaveContained, typeName, expected[0]) - } - return success -} - -// ShouldNotContain receives exactly two parameters. The first is a slice and the -// second is a proposed member. Membership is determinied using ShouldEqual. -func ShouldNotContain(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - typeName := reflect.TypeOf(actual) - - if matchError := oglematchers.Contains(expected[0]).Matches(actual); matchError != nil { - if fmt.Sprintf("%v", matchError) == "which is not a slice or array" { - return fmt.Sprintf(shouldHaveBeenAValidCollection, typeName) - } - return success - } - return fmt.Sprintf(shouldNotHaveContained, typeName, expected[0]) -} - -// ShouldBeIn receives at least 2 parameters. The first is a proposed member of the collection -// that is passed in either as the second parameter, or of the collection that is comprised -// of all the remaining parameters. This assertion ensures that the proposed member is in -// the collection (using ShouldEqual). -func ShouldBeIn(actual interface{}, expected ...interface{}) string { - if fail := atLeast(1, expected); fail != success { - return fail - } - - if len(expected) == 1 { - return shouldBeIn(actual, expected[0]) - } - return shouldBeIn(actual, expected) -} -func shouldBeIn(actual interface{}, expected interface{}) string { - if matchError := oglematchers.Contains(actual).Matches(expected); matchError != nil { - return fmt.Sprintf(shouldHaveBeenIn, actual, reflect.TypeOf(expected)) - } - return success -} - -// ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of the collection -// that is passed in either as the second parameter, or of the collection that is comprised -// of all the remaining parameters. This assertion ensures that the proposed member is NOT in -// the collection (using ShouldEqual). -func ShouldNotBeIn(actual interface{}, expected ...interface{}) string { - if fail := atLeast(1, expected); fail != success { - return fail - } - - if len(expected) == 1 { - return shouldNotBeIn(actual, expected[0]) - } - return shouldNotBeIn(actual, expected) -} -func shouldNotBeIn(actual interface{}, expected interface{}) string { - if matchError := oglematchers.Contains(actual).Matches(expected); matchError == nil { - return fmt.Sprintf(shouldNotHaveBeenIn, actual, reflect.TypeOf(expected)) - } - return success -} - -// ShouldBeEmpty receives a single parameter (actual) and determines whether or not -// calling len(actual) would return `0`. It obeys the rules specified by the len -// function for determining length: http://golang.org/pkg/builtin/#len -func ShouldBeEmpty(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } - - if actual == nil { - return success - } - - value := reflect.ValueOf(actual) - switch value.Kind() { - case reflect.Slice: - if value.Len() == 0 { - return success - } - case reflect.Chan: - if value.Len() == 0 { - return success - } - case reflect.Map: - if value.Len() == 0 { - return success - } - case reflect.String: - if value.Len() == 0 { - return success - } - case reflect.Ptr: - elem := value.Elem() - kind := elem.Kind() - if (kind == reflect.Slice || kind == reflect.Array) && elem.Len() == 0 { - return success - } - } - - return fmt.Sprintf(shouldHaveBeenEmpty, actual) -} - -// ShouldNotBeEmpty receives a single parameter (actual) and determines whether or not -// calling len(actual) would return a value greater than zero. It obeys the rules -// specified by the `len` function for determining length: http://golang.org/pkg/builtin/#len -func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } - - if empty := ShouldBeEmpty(actual, expected...); empty != success { - return success - } - return fmt.Sprintf(shouldNotHaveBeenEmpty, actual) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/doc.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/doc.go deleted file mode 100644 index 7bbd628eef2..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/doc.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package assertions contains the implementations for all assertions which -// are referenced in the convey package for use with the So(...) method. -package assertions - -// This function is not used by the goconvey library. It's actually a convenience method -// for running assertions on arbitrary arguments outside of any testing context, like for -// application logging. It allows you to perform assertion-like behavior (and get nicely -// formatted messages detailing discrepancies) but without the probram blowing up or panicking. -// All that is required is to import this package and call `So` with one of the assertions -// exported by this package as the second parameter. -// The first return parameter is a boolean indicating if the assertion was true. The second -// return parameter is the well-formatted message showing why an assertion was incorrect, or -// blank if the assertion was correct. -// -// Example: -// -// if ok, message := So(x, ShouldBeGreaterThan, y); !ok { -// log.Println(message) -// } -// -func So(actual interface{}, assert assertion, expected ...interface{}) (bool, string) { - serializer = noop - - if result := so(actual, assert, expected...); len(result) == 0 { - return true, result - } else { - return false, result - } -} - -// so is like So, except that it only returns the string message, which is blank if the -// assertion passed. Used to facilitate testing. -func so(actual interface{}, assert func(interface{}, ...interface{}) string, expected ...interface{}) string { - return assert(actual, expected...) -} - -// assertion is an alias for a function with a signature that the So() -// function can handle. Any future or custom assertions should conform to this -// method signature. The return value should be an empty string if the assertion -// passes and a well-formed failure message if not. -type assertion func(actual interface{}, expected ...interface{}) string - -//////////////////////////////////////////////////////////////////////////// diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/equality.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/equality.go deleted file mode 100644 index 9354e493978..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/equality.go +++ /dev/null @@ -1,279 +0,0 @@ -package assertions - -import ( - "errors" - "fmt" - "math" - "reflect" - "strings" - - "github.com/smartystreets/goconvey/convey/assertions/oglematchers" -) - -// default acceptable delta for ShouldAlmostEqual -const defaultDelta = 0.0000000001 - -// ShouldEqual receives exactly two parameters and does an equality check. -func ShouldEqual(actual interface{}, expected ...interface{}) string { - if message := need(1, expected); message != success { - return message - } - return shouldEqual(actual, expected[0]) -} -func shouldEqual(actual, expected interface{}) (message string) { - defer func() { - if r := recover(); r != nil { - message = serializer.serialize(expected, actual, fmt.Sprintf(shouldHaveBeenEqual, expected, actual)) - return - } - }() - - if matchError := oglematchers.Equals(expected).Matches(actual); matchError != nil { - message = serializer.serialize(expected, actual, fmt.Sprintf(shouldHaveBeenEqual, expected, actual)) - return - } - - return success -} - -// ShouldNotEqual receives exactly two parameters and does an inequality check. -func ShouldNotEqual(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } else if ShouldEqual(actual, expected[0]) == success { - return fmt.Sprintf(shouldNotHaveBeenEqual, actual, expected[0]) - } - return success -} - -// ShouldAlmostEqual makes sure that two parameters are close enough to being equal. -// The acceptable delta may be specified with a third argument, -// or a very small default delta will be used. -func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string { - actualFloat, expectedFloat, deltaFloat, err := cleanAlmostEqualInput(actual, expected...) - - if err != "" { - return err - } - - if math.Abs(actualFloat-expectedFloat) <= deltaFloat { - return success - } else { - return fmt.Sprintf(shouldHaveBeenAlmostEqual, actualFloat, expectedFloat) - } -} - -// ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual -func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string { - actualFloat, expectedFloat, deltaFloat, err := cleanAlmostEqualInput(actual, expected...) - - if err != "" { - return err - } - - if math.Abs(actualFloat-expectedFloat) > deltaFloat { - return success - } else { - return fmt.Sprintf(shouldHaveNotBeenAlmostEqual, actualFloat, expectedFloat) - } -} - -func cleanAlmostEqualInput(actual interface{}, expected ...interface{}) (float64, float64, float64, string) { - deltaFloat := 0.0000000001 - - if len(expected) == 0 { - return 0.0, 0.0, 0.0, "This assertion requires exactly one comparison value and an optional delta (you provided neither)" - } else if len(expected) == 2 { - delta, err := getFloat(expected[1]) - - if err != nil { - return 0.0, 0.0, 0.0, "delta must be a numerical type" - } - - deltaFloat = delta - } else if len(expected) > 2 { - return 0.0, 0.0, 0.0, "This assertion requires exactly one comparison value and an optional delta (you provided more values)" - } - - actualFloat, err := getFloat(actual) - - if err != nil { - return 0.0, 0.0, 0.0, err.Error() - } - - expectedFloat, err := getFloat(expected[0]) - - if err != nil { - return 0.0, 0.0, 0.0, err.Error() - } - - return actualFloat, expectedFloat, deltaFloat, "" -} - -// returns the float value of any real number, or error if it is not a numerical type -func getFloat(num interface{}) (float64, error) { - numValue := reflect.ValueOf(num) - numKind := numValue.Kind() - - if numKind == reflect.Int || - numKind == reflect.Int8 || - numKind == reflect.Int16 || - numKind == reflect.Int32 || - numKind == reflect.Int64 { - return float64(numValue.Int()), nil - } else if numKind == reflect.Uint || - numKind == reflect.Uint8 || - numKind == reflect.Uint16 || - numKind == reflect.Uint32 || - numKind == reflect.Uint64 { - return float64(numValue.Uint()), nil - } else if numKind == reflect.Float32 || - numKind == reflect.Float64 { - return numValue.Float(), nil - } else { - return 0.0, errors.New("must be a numerical type, but was " + numKind.String()) - } -} - -// ShouldResemble receives exactly two parameters and does a deep equal check (see reflect.DeepEqual) -func ShouldResemble(actual interface{}, expected ...interface{}) string { - if message := need(1, expected); message != success { - return message - } - - if matchError := oglematchers.DeepEquals(expected[0]).Matches(actual); matchError != nil { - expectedSyntax := fmt.Sprintf("%#v", expected[0]) - actualSyntax := fmt.Sprintf("%#v", actual) - var message string - if expectedSyntax == actualSyntax { - message = fmt.Sprintf(shouldHaveResembledTypeMismatch, expected[0], actual, expected[0], actual) - } else { - message = fmt.Sprintf(shouldHaveResembled, expected[0], actual) - } - return serializer.serializeDetailed(expected[0], actual, message) - } - - return success -} - -// ShouldNotResemble receives exactly two parameters and does an inverse deep equal check (see reflect.DeepEqual) -func ShouldNotResemble(actual interface{}, expected ...interface{}) string { - if message := need(1, expected); message != success { - return message - } else if ShouldResemble(actual, expected[0]) == success { - return fmt.Sprintf(shouldNotHaveResembled, actual, expected[0]) - } - return success -} - -// ShouldPointTo receives exactly two parameters and checks to see that they point to the same address. -func ShouldPointTo(actual interface{}, expected ...interface{}) string { - if message := need(1, expected); message != success { - return message - } - return shouldPointTo(actual, expected[0]) - -} -func shouldPointTo(actual, expected interface{}) string { - actualValue := reflect.ValueOf(actual) - expectedValue := reflect.ValueOf(expected) - - if ShouldNotBeNil(actual) != success { - return fmt.Sprintf(shouldHaveBeenNonNilPointer, "first", "nil") - } else if ShouldNotBeNil(expected) != success { - return fmt.Sprintf(shouldHaveBeenNonNilPointer, "second", "nil") - } else if actualValue.Kind() != reflect.Ptr { - return fmt.Sprintf(shouldHaveBeenNonNilPointer, "first", "not") - } else if expectedValue.Kind() != reflect.Ptr { - return fmt.Sprintf(shouldHaveBeenNonNilPointer, "second", "not") - } else if ShouldEqual(actualValue.Pointer(), expectedValue.Pointer()) != success { - actualAddress := reflect.ValueOf(actual).Pointer() - expectedAddress := reflect.ValueOf(expected).Pointer() - return serializer.serialize(expectedAddress, actualAddress, fmt.Sprintf(shouldHavePointedTo, - actual, actualAddress, - expected, expectedAddress)) - } - return success -} - -// ShouldNotPointTo receives exactly two parameters and checks to see that they point to different addresess. -func ShouldNotPointTo(actual interface{}, expected ...interface{}) string { - if message := need(1, expected); message != success { - return message - } - compare := ShouldPointTo(actual, expected[0]) - if strings.HasPrefix(compare, shouldBePointers) { - return compare - } else if compare == success { - return fmt.Sprintf(shouldNotHavePointedTo, actual, expected[0], reflect.ValueOf(actual).Pointer()) - } - return success -} - -// ShouldBeNil receives a single parameter and ensures that it is nil. -func ShouldBeNil(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } else if actual == nil { - return success - } else if interfaceHasNilValue(actual) { - return success - } - return fmt.Sprintf(shouldHaveBeenNil, actual) -} -func interfaceHasNilValue(actual interface{}) bool { - value := reflect.ValueOf(actual) - kind := value.Kind() - nilable := kind == reflect.Slice || - kind == reflect.Chan || - kind == reflect.Func || - kind == reflect.Ptr || - kind == reflect.Map - - // Careful: reflect.Value.IsNil() will panic unless it's an interface, chan, map, func, slice, or ptr - // Reference: http://golang.org/pkg/reflect/#Value.IsNil - return nilable && value.IsNil() -} - -// ShouldNotBeNil receives a single parameter and ensures that it is not nil. -func ShouldNotBeNil(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } else if ShouldBeNil(actual) == success { - return fmt.Sprintf(shouldNotHaveBeenNil, actual) - } - return success -} - -// ShouldBeTrue receives a single parameter and ensures that it is true. -func ShouldBeTrue(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } else if actual != true { - return fmt.Sprintf(shouldHaveBeenTrue, actual) - } - return success -} - -// ShouldBeFalse receives a single parameter and ensures that it is false. -func ShouldBeFalse(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } else if actual != false { - return fmt.Sprintf(shouldHaveBeenFalse, actual) - } - return success -} - -// ShouldBeZeroValue receives a single parameter and ensures that it is -// the Go equivalent of the default value, or "zero" value. -func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } - zeroVal := reflect.Zero(reflect.TypeOf(actual)).Interface() - if !reflect.DeepEqual(zeroVal, actual) { - return serializer.serialize(zeroVal, actual, fmt.Sprintf(shouldHaveBeenZeroValue, actual)) - } - return success -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go deleted file mode 100644 index 872e58c5407..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go +++ /dev/null @@ -1,22 +0,0 @@ -package assertions - -import "fmt" - -const ( - success = "" - needExactValues = "This assertion requires exactly %d comparison values (you provided %d)." -) - -func need(needed int, expected []interface{}) string { - if len(expected) != needed { - return fmt.Sprintf(needExactValues, needed, len(expected)) - } - return success -} - -func atLeast(minimum int, expected []interface{}) string { - if len(expected) < 1 { - return shouldHaveProvidedCollectionMembers - } - return success -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/init.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/init.go deleted file mode 100644 index 753bcc7daa7..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/init.go +++ /dev/null @@ -1,6 +0,0 @@ -package assertions - -var ( - serializer Serializer = newSerializer() - noop Serializer = new(noopSerializer) -) diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go deleted file mode 100644 index 7b6b3591024..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go +++ /dev/null @@ -1,87 +0,0 @@ -package assertions - -const ( // equality - shouldHaveBeenEqual = "Expected: '%v'\nActual: '%v'\n(Should be equal)" - shouldNotHaveBeenEqual = "Expected '%v'\nto NOT equal '%v'\n(but it did)!" - shouldHaveBeenAlmostEqual = "Expected '%v' to almost equal '%v' (but it didn't)!" - shouldHaveNotBeenAlmostEqual = "Expected '%v' to NOT almost equal '%v' (but it did)!" - shouldHaveResembled = "Expected: '%#v'\nActual: '%#v'\n(Should resemble)!" - shouldHaveResembledTypeMismatch = "Expected: '%#v'\nActual: '%#v'\n(Type mismatch: '%T' vs '%T')!" - shouldNotHaveResembled = "Expected '%#v'\nto NOT resemble '%#v'\n(but it did)!" - shouldBePointers = "Both arguments should be pointers " - shouldHaveBeenNonNilPointer = shouldBePointers + "(the %s was %s)!" - shouldHavePointedTo = "Expected '%+v' (address: '%v') and '%+v' (address: '%v') to be the same address (but their weren't)!" - shouldNotHavePointedTo = "Expected '%+v' and '%+v' to be different references (but they matched: '%v')!" - shouldHaveBeenNil = "Expected: nil\nActual: '%v'" - shouldNotHaveBeenNil = "Expected '%+v' to NOT be nil (but it was)!" - shouldHaveBeenTrue = "Expected: true\nActual: %v" - shouldHaveBeenFalse = "Expected: false\nActual: %v" - shouldHaveBeenZeroValue = "'%+v' should have been the zero value" //"Expected: (zero value)\nActual: %v" -) - -const ( // quantity comparisons - shouldHaveBeenGreater = "Expected '%v' to be greater than '%v' (but it wasn't)!" - shouldHaveBeenGreaterOrEqual = "Expected '%v' to be greater than or equal to '%v' (but it wasn't)!" - shouldHaveBeenLess = "Expected '%v' to be less than '%v' (but it wasn't)!" - shouldHaveBeenLessOrEqual = "Expected '%v' to be less than or equal to '%v' (but it wasn't)!" - shouldHaveBeenBetween = "Expected '%v' to be between '%v' and '%v' (but it wasn't)!" - shouldNotHaveBeenBetween = "Expected '%v' NOT to be between '%v' and '%v' (but it was)!" - shouldHaveDifferentUpperAndLower = "The lower and upper bounds must be different values (they were both '%v')." - shouldHaveBeenBetweenOrEqual = "Expected '%v' to be between '%v' and '%v' or equal to one of them (but it wasn't)!" - shouldNotHaveBeenBetweenOrEqual = "Expected '%v' NOT to be between '%v' and '%v' or equal to one of them (but it was)!" -) - -const ( // collections - shouldHaveContained = "Expected the container (%v) to contain: '%v' (but it didn't)!" - shouldNotHaveContained = "Expected the container (%v) NOT to contain: '%v' (but it did)!" - shouldHaveBeenIn = "Expected '%v' to be in the container (%v, but it wasn't)!" - shouldNotHaveBeenIn = "Expected '%v' NOT to be in the container (%v, but it was)!" - shouldHaveBeenAValidCollection = "You must provide a valid container (was %v)!" - shouldHaveProvidedCollectionMembers = "This assertion requires at least 1 comparison value (you provided 0)." - shouldHaveBeenEmpty = "Expected %+v to be empty (but it wasn't)!" - shouldNotHaveBeenEmpty = "Expected %+v to NOT be empty (but it was)!" -) - -const ( // strings - shouldHaveStartedWith = "Expected '%v'\nto start with '%v'\n(but it didn't)!" - shouldNotHaveStartedWith = "Expected '%v'\nNOT to start with '%v'\n(but it did)!" - shouldHaveEndedWith = "Expected '%v'\nto end with '%v'\n(but it didn't)!" - shouldNotHaveEndedWith = "Expected '%v'\nNOT to end with '%v'\n(but it did)!" - shouldBothBeStrings = "Both arguments to this assertion must be strings (you provided %v and %v)." - shouldBeString = "The argument to this assertion must be a string (you provided %v)." - shouldHaveContainedSubstring = "Expected '%s' to contain substring '%s' (but it didn't)!" - shouldNotHaveContainedSubstring = "Expected '%s' NOT to contain substring '%s' (but it didn't)!" - shouldHaveBeenBlank = "Expected '%s' to be blank (but it wasn't)!" - shouldNotHaveBeenBlank = "Expected value to NOT be blank (but it was)!" -) - -const ( // panics - shouldUseVoidNiladicFunction = "You must provide a void, niladic function as the first argument!" - shouldHavePanickedWith = "Expected func() to panic with '%v' (but it panicked with '%v')!" - shouldHavePanicked = "Expected func() to panic (but it didn't)!" - shouldNotHavePanicked = "Expected func() NOT to panic (error: '%+v')!" - shouldNotHavePanickedWith = "Expected func() NOT to panic with '%v' (but it did)!" -) - -const ( // type checking - shouldHaveBeenA = "Expected '%v' to be: '%v' (but was: '%v')!" - shouldNotHaveBeenA = "Expected '%v' to NOT be: '%v' (but it was)!" - - shouldHaveImplemented = "Expected: '%v interface support'\nActual: '%v' does not implement the interface!" - shouldNotHaveImplemented = "Expected '%v'\nto NOT implement '%v'\n(but it did)!" - shouldCompareWithInterfacePointer = "The expected value must be a pointer to an interface type (eg. *fmt.Stringer)" - shouldNotBeNilActual = "The actual value was 'nil' and should be a value or a pointer to a value!" -) - -const ( // time comparisons - shouldUseTimes = "You must provide time instances as arguments to this assertion." - shouldUseTimeSlice = "You must provide a slice of time instances as the first argument to this assertion." - shouldUseDurationAndTime = "You must provide a duration and a time as arguments to this assertion." - shouldHaveHappenedBefore = "Expected '%v' to happen before '%v' (it happened '%v' after)!" - shouldHaveHappenedAfter = "Expected '%v' to happen after '%v' (it happened '%v' before)!" - shouldHaveHappenedBetween = "Expected '%v' to happen between '%v' and '%v' (it happened '%v' outside threshold)!" - shouldNotHaveHappenedOnOrBetween = "Expected '%v' to NOT happen on or between '%v' and '%v' (but it did)!" - - // format params: incorrect-index, previous-index, previous-time, incorrect-index, incorrect-time - shouldHaveBeenChronological = "The 'Time' at index [%d] should have happened after the previous one (but it didn't!):\n [%d]: %s\n [%d]: %s (see, it happened before!)" -) diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/.gitignore b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/.gitignore deleted file mode 100644 index dd8fc7468f4..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.6 -6.out -_obj/ -_test/ -_testmain.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/LICENSE b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/LICENSE deleted file mode 100644 index d6456956733..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown deleted file mode 100644 index 28ec0793b69..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown +++ /dev/null @@ -1,56 +0,0 @@ -`oglematchers` is a package for the Go programming language containing a set of -matchers, useful in a testing or mocking framework, inspired by and mostly -compatible with [Google Test][googletest] for C++ and -[Google JS Test][google-js-test]. The package is used by the -[ogletest][ogletest] testing framework and [oglemock][oglemock] mocking -framework, which may be more directly useful to you, but can be generically used -elsewhere as well. - -A "matcher" is simply an object with a `Matches` method defining a set of golang -values matched by the matcher, and a `Description` method describing that set. -For example, here are some matchers: - -```go -// Numbers -Equals(17.13) -LessThan(19) - -// Strings -Equals("taco") -HasSubstr("burrito") -MatchesRegex("t.*o") - -// Combining matchers -AnyOf(LessThan(17), GreaterThan(19)) -``` - -There are lots more; see [here][reference] for a reference. You can also add -your own simply by implementing the `oglematchers.Matcher` interface. - - -Installation ------------- - -First, make sure you have installed Go 1.0.2 or newer. See -[here][golang-install] for instructions. - -Use the following command to install `oglematchers` and keep it up to date: - - go get -u github.com/smartystreets/goconvey/convey/assertions/oglematchers - - -Documentation -------------- - -See [here][reference] for documentation hosted on GoPkgDoc. Alternatively, you -can install the package and then use `go doc`: - - go doc github.com/smartystreets/goconvey/convey/assertions/oglematchers - - -[reference]: http://gopkgdoc.appspot.com/pkg/github.com/smartystreets/goconvey/convey/assertions/oglematchers -[golang-install]: http://golang.org/doc/install.html -[googletest]: http://code.google.com/p/googletest/ -[google-js-test]: http://code.google.com/p/google-js-test/ -[ogletest]: http://github.com/smartystreets/goconvey/convey/assertions/ogletest -[oglemock]: http://github.com/smartystreets/goconvey/convey/assertions/oglemock diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/all_of.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/all_of.go deleted file mode 100644 index d93a9740443..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/all_of.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "strings" -) - -// AllOf accepts a set of matchers S and returns a matcher that follows the -// algorithm below when considering a candidate c: -// -// 1. Return true if for every Matcher m in S, m matches c. -// -// 2. Otherwise, if there is a matcher m in S such that m returns a fatal -// error for c, return that matcher's error message. -// -// 3. Otherwise, return false with the error from some wrapped matcher. -// -// This is akin to a logical AND operation for matchers. -func AllOf(matchers ...Matcher) Matcher { - return &allOfMatcher{matchers} -} - -type allOfMatcher struct { - wrappedMatchers []Matcher -} - -func (m *allOfMatcher) Description() string { - // Special case: the empty set. - if len(m.wrappedMatchers) == 0 { - return "is anything" - } - - // Join the descriptions for the wrapped matchers. - wrappedDescs := make([]string, len(m.wrappedMatchers)) - for i, wrappedMatcher := range m.wrappedMatchers { - wrappedDescs[i] = wrappedMatcher.Description() - } - - return strings.Join(wrappedDescs, ", and ") -} - -func (m *allOfMatcher) Matches(c interface{}) (err error) { - for _, wrappedMatcher := range m.wrappedMatchers { - if wrappedErr := wrappedMatcher.Matches(c); wrappedErr != nil { - err = wrappedErr - - // If the error is fatal, return immediately with this error. - _, ok := wrappedErr.(*FatalError) - if ok { - return - } - } - } - - return -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any.go deleted file mode 100644 index f6991ec1020..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -// Any returns a matcher that matches any value. -func Any() Matcher { - return &anyMatcher{} -} - -type anyMatcher struct { -} - -func (m *anyMatcher) Description() string { - return "is anything" -} - -func (m *anyMatcher) Matches(c interface{}) error { - return nil -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go deleted file mode 100644 index 080643adda7..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" - "strings" -) - -// AnyOf accepts a set of values S and returns a matcher that follows the -// algorithm below when considering a candidate c: -// -// 1. If there exists a value m in S such that m implements the Matcher -// interface and m matches c, return true. -// -// 2. Otherwise, if there exists a value v in S such that v does not implement -// the Matcher interface and the matcher Equals(v) matches c, return true. -// -// 3. Otherwise, if there is a value m in S such that m implements the Matcher -// interface and m returns a fatal error for c, return that fatal error. -// -// 4. Otherwise, return false. -// -// This is akin to a logical OR operation for matchers, with non-matchers x -// being treated as Equals(x). -func AnyOf(vals ...interface{}) Matcher { - // Get ahold of a type variable for the Matcher interface. - var dummy *Matcher - matcherType := reflect.TypeOf(dummy).Elem() - - // Create a matcher for each value, or use the value itself if it's already a - // matcher. - wrapped := make([]Matcher, len(vals)) - for i, v := range vals { - if reflect.TypeOf(v).Implements(matcherType) { - wrapped[i] = v.(Matcher) - } else { - wrapped[i] = Equals(v) - } - } - - return &anyOfMatcher{wrapped} -} - -type anyOfMatcher struct { - wrapped []Matcher -} - -func (m *anyOfMatcher) Description() string { - wrappedDescs := make([]string, len(m.wrapped)) - for i, matcher := range m.wrapped { - wrappedDescs[i] = matcher.Description() - } - - return fmt.Sprintf("or(%s)", strings.Join(wrappedDescs, ", ")) -} - -func (m *anyOfMatcher) Matches(c interface{}) (err error) { - err = errors.New("") - - // Try each matcher in turn. - for _, matcher := range m.wrapped { - wrappedErr := matcher.Matches(c) - - // Return immediately if there's a match. - if wrappedErr == nil { - err = nil - return - } - - // Note the fatal error, if any. - if _, isFatal := wrappedErr.(*FatalError); isFatal { - err = wrappedErr - } - } - - return -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go deleted file mode 100644 index 2f326dbc5d6..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2012 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "fmt" - "reflect" -) - -// Return a matcher that matches arrays slices with at least one element that -// matches the supplied argument. If the argument x is not itself a Matcher, -// this is equivalent to Contains(Equals(x)). -func Contains(x interface{}) Matcher { - var result containsMatcher - var ok bool - - if result.elementMatcher, ok = x.(Matcher); !ok { - result.elementMatcher = Equals(x) - } - - return &result -} - -type containsMatcher struct { - elementMatcher Matcher -} - -func (m *containsMatcher) Description() string { - return fmt.Sprintf("contains: %s", m.elementMatcher.Description()) -} - -func (m *containsMatcher) Matches(candidate interface{}) error { - // The candidate must be a slice or an array. - v := reflect.ValueOf(candidate) - if v.Kind() != reflect.Slice && v.Kind() != reflect.Array { - return NewFatalError("which is not a slice or array") - } - - // Check each element. - for i := 0; i < v.Len(); i++ { - elem := v.Index(i) - if matchErr := m.elementMatcher.Matches(elem.Interface()); matchErr == nil { - return nil - } - } - - return fmt.Errorf("") -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/deep_equals.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/deep_equals.go deleted file mode 100644 index 1d91baef32e..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/deep_equals.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "bytes" - "errors" - "fmt" - "reflect" -) - -var byteSliceType reflect.Type = reflect.TypeOf([]byte{}) - -// DeepEquals returns a matcher that matches based on 'deep equality', as -// defined by the reflect package. This matcher requires that values have -// identical types to x. -func DeepEquals(x interface{}) Matcher { - return &deepEqualsMatcher{x} -} - -type deepEqualsMatcher struct { - x interface{} -} - -func (m *deepEqualsMatcher) Description() string { - xDesc := fmt.Sprintf("%v", m.x) - xValue := reflect.ValueOf(m.x) - - // Special case: fmt.Sprintf presents nil slices as "[]", but - // reflect.DeepEqual makes a distinction between nil and empty slices. Make - // this less confusing. - if xValue.Kind() == reflect.Slice && xValue.IsNil() { - xDesc = "" - } - - return fmt.Sprintf("deep equals: %s", xDesc) -} - -func (m *deepEqualsMatcher) Matches(c interface{}) error { - // Make sure the types match. - ct := reflect.TypeOf(c) - xt := reflect.TypeOf(m.x) - - if ct != xt { - return NewFatalError(fmt.Sprintf("which is of type %v", ct)) - } - - // Special case: handle byte slices more efficiently. - cValue := reflect.ValueOf(c) - xValue := reflect.ValueOf(m.x) - - if ct == byteSliceType && !cValue.IsNil() && !xValue.IsNil() { - xBytes := m.x.([]byte) - cBytes := c.([]byte) - - if bytes.Equal(cBytes, xBytes) { - return nil - } - - return errors.New("") - } - - // Defer to the reflect package. - if reflect.DeepEqual(m.x, c) { - return nil - } - - // Special case: if the comparison failed because c is the nil slice, given - // an indication of this (since its value is printed as "[]"). - if cValue.Kind() == reflect.Slice && cValue.IsNil() { - return errors.New("which is nil") - } - - return errors.New("") -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/elements_are.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/elements_are.go deleted file mode 100644 index 2941847c705..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/elements_are.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2012 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" - "strings" -) - -// Given a list of arguments M, ElementsAre returns a matcher that matches -// arrays and slices A where all of the following hold: -// -// * A is the same length as M. -// -// * For each i < len(A) where M[i] is a matcher, A[i] matches M[i]. -// -// * For each i < len(A) where M[i] is not a matcher, A[i] matches -// Equals(M[i]). -// -func ElementsAre(M ...interface{}) Matcher { - // Copy over matchers, or convert to Equals(x) for non-matcher x. - subMatchers := make([]Matcher, len(M)) - for i, x := range M { - if matcher, ok := x.(Matcher); ok { - subMatchers[i] = matcher - continue - } - - subMatchers[i] = Equals(x) - } - - return &elementsAreMatcher{subMatchers} -} - -type elementsAreMatcher struct { - subMatchers []Matcher -} - -func (m *elementsAreMatcher) Description() string { - subDescs := make([]string, len(m.subMatchers)) - for i, sm := range m.subMatchers { - subDescs[i] = sm.Description() - } - - return fmt.Sprintf("elements are: [%s]", strings.Join(subDescs, ", ")) -} - -func (m *elementsAreMatcher) Matches(candidates interface{}) error { - // The candidate must be a slice or an array. - v := reflect.ValueOf(candidates) - if v.Kind() != reflect.Slice && v.Kind() != reflect.Array { - return NewFatalError("which is not a slice or array") - } - - // The length must be correct. - if v.Len() != len(m.subMatchers) { - return errors.New(fmt.Sprintf("which is of length %d", v.Len())) - } - - // Check each element. - for i, subMatcher := range m.subMatchers { - c := v.Index(i) - if matchErr := subMatcher.Matches(c.Interface()); matchErr != nil { - // Return an errors indicating which element doesn't match. If the - // matcher error was fatal, make this one fatal too. - err := errors.New(fmt.Sprintf("whose element %d doesn't match", i)) - if _, isFatal := matchErr.(*FatalError); isFatal { - err = NewFatalError(err.Error()) - } - - return err - } - } - - return nil -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go deleted file mode 100644 index 164059e7c76..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "math" - "reflect" -) - -// Equals(x) returns a matcher that matches values v such that v and x are -// equivalent. This includes the case when the comparison v == x using Go's -// built-in comparison operator is legal, but for convenience the following -// rules also apply: -// -// * Type checking is done based on underlying types rather than actual -// types, so that e.g. two aliases for string can be compared: -// -// type stringAlias1 string -// type stringAlias2 string -// -// a := "taco" -// b := stringAlias1("taco") -// c := stringAlias2("taco") -// -// ExpectTrue(a == b) // Legal, passes -// ExpectTrue(b == c) // Illegal, doesn't compile -// -// ExpectThat(a, Equals(b)) // Passes -// ExpectThat(b, Equals(c)) // Passes -// -// * Values of numeric type are treated as if they were abstract numbers, and -// compared accordingly. Therefore Equals(17) will match int(17), -// int16(17), uint(17), float32(17), complex64(17), and so on. -// -// If you want a stricter matcher that contains no such cleverness, see -// IdenticalTo instead. -func Equals(x interface{}) Matcher { - v := reflect.ValueOf(x) - - // The == operator is not defined for array or struct types. - if v.Kind() == reflect.Array || v.Kind() == reflect.Struct { - panic(fmt.Sprintf("oglematchers.Equals: unsupported kind %v", v.Kind())) - } - - // The == operator is not defined for non-nil slices. - if v.Kind() == reflect.Slice && v.Pointer() != uintptr(0) { - panic(fmt.Sprintf("oglematchers.Equals: non-nil slice")) - } - - return &equalsMatcher{v} -} - -type equalsMatcher struct { - expectedValue reflect.Value -} - -//////////////////////////////////////////////////////////////////////// -// Numeric types -//////////////////////////////////////////////////////////////////////// - -func isSignedInteger(v reflect.Value) bool { - k := v.Kind() - return k >= reflect.Int && k <= reflect.Int64 -} - -func isUnsignedInteger(v reflect.Value) bool { - k := v.Kind() - return k >= reflect.Uint && k <= reflect.Uint64 -} - -func isInteger(v reflect.Value) bool { - return isSignedInteger(v) || isUnsignedInteger(v) -} - -func isFloat(v reflect.Value) bool { - k := v.Kind() - return k == reflect.Float32 || k == reflect.Float64 -} - -func isComplex(v reflect.Value) bool { - k := v.Kind() - return k == reflect.Complex64 || k == reflect.Complex128 -} - -func checkAgainstInt64(e int64, c reflect.Value) (err error) { - err = errors.New("") - - switch { - case isSignedInteger(c): - if c.Int() == e { - err = nil - } - - case isUnsignedInteger(c): - u := c.Uint() - if u <= math.MaxInt64 && int64(u) == e { - err = nil - } - - // Turn around the various floating point types so that the checkAgainst* - // functions for them can deal with precision issues. - case isFloat(c), isComplex(c): - return Equals(c.Interface()).Matches(e) - - default: - err = NewFatalError("which is not numeric") - } - - return -} - -func checkAgainstUint64(e uint64, c reflect.Value) (err error) { - err = errors.New("") - - switch { - case isSignedInteger(c): - i := c.Int() - if i >= 0 && uint64(i) == e { - err = nil - } - - case isUnsignedInteger(c): - if c.Uint() == e { - err = nil - } - - // Turn around the various floating point types so that the checkAgainst* - // functions for them can deal with precision issues. - case isFloat(c), isComplex(c): - return Equals(c.Interface()).Matches(e) - - default: - err = NewFatalError("which is not numeric") - } - - return -} - -func checkAgainstFloat32(e float32, c reflect.Value) (err error) { - err = errors.New("") - - switch { - case isSignedInteger(c): - if float32(c.Int()) == e { - err = nil - } - - case isUnsignedInteger(c): - if float32(c.Uint()) == e { - err = nil - } - - case isFloat(c): - // Compare using float32 to avoid a false sense of precision; otherwise - // e.g. Equals(float32(0.1)) won't match float32(0.1). - if float32(c.Float()) == e { - err = nil - } - - case isComplex(c): - comp := c.Complex() - rl := real(comp) - im := imag(comp) - - // Compare using float32 to avoid a false sense of precision; otherwise - // e.g. Equals(float32(0.1)) won't match (0.1 + 0i). - if im == 0 && float32(rl) == e { - err = nil - } - - default: - err = NewFatalError("which is not numeric") - } - - return -} - -func checkAgainstFloat64(e float64, c reflect.Value) (err error) { - err = errors.New("") - - ck := c.Kind() - - switch { - case isSignedInteger(c): - if float64(c.Int()) == e { - err = nil - } - - case isUnsignedInteger(c): - if float64(c.Uint()) == e { - err = nil - } - - // If the actual value is lower precision, turn the comparison around so we - // apply the low-precision rules. Otherwise, e.g. Equals(0.1) may not match - // float32(0.1). - case ck == reflect.Float32 || ck == reflect.Complex64: - return Equals(c.Interface()).Matches(e) - - // Otherwise, compare with double precision. - case isFloat(c): - if c.Float() == e { - err = nil - } - - case isComplex(c): - comp := c.Complex() - rl := real(comp) - im := imag(comp) - - if im == 0 && rl == e { - err = nil - } - - default: - err = NewFatalError("which is not numeric") - } - - return -} - -func checkAgainstComplex64(e complex64, c reflect.Value) (err error) { - err = errors.New("") - realPart := real(e) - imaginaryPart := imag(e) - - switch { - case isInteger(c) || isFloat(c): - // If we have no imaginary part, then we should just compare against the - // real part. Otherwise, we can't be equal. - if imaginaryPart != 0 { - return - } - - return checkAgainstFloat32(realPart, c) - - case isComplex(c): - // Compare using complex64 to avoid a false sense of precision; otherwise - // e.g. Equals(0.1 + 0i) won't match float32(0.1). - if complex64(c.Complex()) == e { - err = nil - } - - default: - err = NewFatalError("which is not numeric") - } - - return -} - -func checkAgainstComplex128(e complex128, c reflect.Value) (err error) { - err = errors.New("") - realPart := real(e) - imaginaryPart := imag(e) - - switch { - case isInteger(c) || isFloat(c): - // If we have no imaginary part, then we should just compare against the - // real part. Otherwise, we can't be equal. - if imaginaryPart != 0 { - return - } - - return checkAgainstFloat64(realPart, c) - - case isComplex(c): - if c.Complex() == e { - err = nil - } - - default: - err = NewFatalError("which is not numeric") - } - - return -} - -//////////////////////////////////////////////////////////////////////// -// Other types -//////////////////////////////////////////////////////////////////////// - -func checkAgainstBool(e bool, c reflect.Value) (err error) { - if c.Kind() != reflect.Bool { - err = NewFatalError("which is not a bool") - return - } - - err = errors.New("") - if c.Bool() == e { - err = nil - } - return -} - -func checkAgainstUintptr(e uintptr, c reflect.Value) (err error) { - if c.Kind() != reflect.Uintptr { - err = NewFatalError("which is not a uintptr") - return - } - - err = errors.New("") - if uintptr(c.Uint()) == e { - err = nil - } - return -} - -func checkAgainstChan(e reflect.Value, c reflect.Value) (err error) { - // Create a description of e's type, e.g. "chan int". - typeStr := fmt.Sprintf("%s %s", e.Type().ChanDir(), e.Type().Elem()) - - // Make sure c is a chan of the correct type. - if c.Kind() != reflect.Chan || - c.Type().ChanDir() != e.Type().ChanDir() || - c.Type().Elem() != e.Type().Elem() { - err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr)) - return - } - - err = errors.New("") - if c.Pointer() == e.Pointer() { - err = nil - } - return -} - -func checkAgainstFunc(e reflect.Value, c reflect.Value) (err error) { - // Make sure c is a function. - if c.Kind() != reflect.Func { - err = NewFatalError("which is not a function") - return - } - - err = errors.New("") - if c.Pointer() == e.Pointer() { - err = nil - } - return -} - -func checkAgainstMap(e reflect.Value, c reflect.Value) (err error) { - // Make sure c is a map. - if c.Kind() != reflect.Map { - err = NewFatalError("which is not a map") - return - } - - err = errors.New("") - if c.Pointer() == e.Pointer() { - err = nil - } - return -} - -func checkAgainstPtr(e reflect.Value, c reflect.Value) (err error) { - // Create a description of e's type, e.g. "*int". - typeStr := fmt.Sprintf("*%v", e.Type().Elem()) - - // Make sure c is a pointer of the correct type. - if c.Kind() != reflect.Ptr || - c.Type().Elem() != e.Type().Elem() { - err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr)) - return - } - - err = errors.New("") - if c.Pointer() == e.Pointer() { - err = nil - } - return -} - -func checkAgainstSlice(e reflect.Value, c reflect.Value) (err error) { - // Create a description of e's type, e.g. "[]int". - typeStr := fmt.Sprintf("[]%v", e.Type().Elem()) - - // Make sure c is a slice of the correct type. - if c.Kind() != reflect.Slice || - c.Type().Elem() != e.Type().Elem() { - err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr)) - return - } - - err = errors.New("") - if c.Pointer() == e.Pointer() { - err = nil - } - return -} - -func checkAgainstString(e reflect.Value, c reflect.Value) (err error) { - // Make sure c is a string. - if c.Kind() != reflect.String { - err = NewFatalError("which is not a string") - return - } - - err = errors.New("") - if c.String() == e.String() { - err = nil - } - return -} - -func checkAgainstUnsafePointer(e reflect.Value, c reflect.Value) (err error) { - // Make sure c is a pointer. - if c.Kind() != reflect.UnsafePointer { - err = NewFatalError("which is not a unsafe.Pointer") - return - } - - err = errors.New("") - if c.Pointer() == e.Pointer() { - err = nil - } - return -} - -func checkForNil(c reflect.Value) (err error) { - err = errors.New("") - - // Make sure it is legal to call IsNil. - switch c.Kind() { - case reflect.Invalid: - case reflect.Chan: - case reflect.Func: - case reflect.Interface: - case reflect.Map: - case reflect.Ptr: - case reflect.Slice: - - default: - err = NewFatalError("which cannot be compared to nil") - return - } - - // Ask whether the value is nil. Handle a nil literal (kind Invalid) - // specially, since it's not legal to call IsNil there. - if c.Kind() == reflect.Invalid || c.IsNil() { - err = nil - } - return -} - -//////////////////////////////////////////////////////////////////////// -// Public implementation -//////////////////////////////////////////////////////////////////////// - -func (m *equalsMatcher) Matches(candidate interface{}) error { - e := m.expectedValue - c := reflect.ValueOf(candidate) - ek := e.Kind() - - switch { - case ek == reflect.Bool: - return checkAgainstBool(e.Bool(), c) - - case isSignedInteger(e): - return checkAgainstInt64(e.Int(), c) - - case isUnsignedInteger(e): - return checkAgainstUint64(e.Uint(), c) - - case ek == reflect.Uintptr: - return checkAgainstUintptr(uintptr(e.Uint()), c) - - case ek == reflect.Float32: - return checkAgainstFloat32(float32(e.Float()), c) - - case ek == reflect.Float64: - return checkAgainstFloat64(e.Float(), c) - - case ek == reflect.Complex64: - return checkAgainstComplex64(complex64(e.Complex()), c) - - case ek == reflect.Complex128: - return checkAgainstComplex128(complex128(e.Complex()), c) - - case ek == reflect.Chan: - return checkAgainstChan(e, c) - - case ek == reflect.Func: - return checkAgainstFunc(e, c) - - case ek == reflect.Map: - return checkAgainstMap(e, c) - - case ek == reflect.Ptr: - return checkAgainstPtr(e, c) - - case ek == reflect.Slice: - return checkAgainstSlice(e, c) - - case ek == reflect.String: - return checkAgainstString(e, c) - - case ek == reflect.UnsafePointer: - return checkAgainstUnsafePointer(e, c) - - case ek == reflect.Invalid: - return checkForNil(c) - } - - panic(fmt.Sprintf("equalsMatcher.Matches: unexpected kind: %v", ek)) -} - -func (m *equalsMatcher) Description() string { - // Special case: handle nil. - if !m.expectedValue.IsValid() { - return "is nil" - } - - return fmt.Sprintf("%v", m.expectedValue.Interface()) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/error.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/error.go deleted file mode 100644 index 8a078e36d86..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/error.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -// Error returns a matcher that matches non-nil values implementing the -// built-in error interface for whom the return value of Error() matches the -// supplied matcher. -// -// For example: -// -// err := errors.New("taco burrito") -// -// Error(Equals("taco burrito")) // matches err -// Error(HasSubstr("taco")) // matches err -// Error(HasSubstr("enchilada")) // doesn't match err -// -func Error(m Matcher) Matcher { - return &errorMatcher{m} -} - -type errorMatcher struct { - wrappedMatcher Matcher -} - -func (m *errorMatcher) Description() string { - return "error " + m.wrappedMatcher.Description() -} - -func (m *errorMatcher) Matches(c interface{}) error { - // Make sure that c is an error. - e, ok := c.(error) - if !ok { - return NewFatalError("which is not an error") - } - - // Pass on the error text to the wrapped matcher. - return m.wrappedMatcher.Matches(e.Error()) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_or_equal.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_or_equal.go deleted file mode 100644 index 4b9d103a381..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_or_equal.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "fmt" - "reflect" -) - -// GreaterOrEqual returns a matcher that matches integer, floating point, or -// strings values v such that v >= x. Comparison is not defined between numeric -// and string types, but is defined between all integer and floating point -// types. -// -// x must itself be an integer, floating point, or string type; otherwise, -// GreaterOrEqual will panic. -func GreaterOrEqual(x interface{}) Matcher { - desc := fmt.Sprintf("greater than or equal to %v", x) - - // Special case: make it clear that strings are strings. - if reflect.TypeOf(x).Kind() == reflect.String { - desc = fmt.Sprintf("greater than or equal to \"%s\"", x) - } - - return transformDescription(Not(LessThan(x)), desc) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_than.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_than.go deleted file mode 100644 index 3eef32178f8..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_than.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "fmt" - "reflect" -) - -// GreaterThan returns a matcher that matches integer, floating point, or -// strings values v such that v > x. Comparison is not defined between numeric -// and string types, but is defined between all integer and floating point -// types. -// -// x must itself be an integer, floating point, or string type; otherwise, -// GreaterThan will panic. -func GreaterThan(x interface{}) Matcher { - desc := fmt.Sprintf("greater than %v", x) - - // Special case: make it clear that strings are strings. - if reflect.TypeOf(x).Kind() == reflect.String { - desc = fmt.Sprintf("greater than \"%s\"", x) - } - - return transformDescription(Not(LessOrEqual(x)), desc) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go deleted file mode 100644 index a32c1cf708e..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" - "strings" -) - -// HasSubstr returns a matcher that matches strings containing s as a -// substring. -func HasSubstr(s string) Matcher { - return &hasSubstrMatcher{s} -} - -type hasSubstrMatcher struct { - needle string -} - -func (m *hasSubstrMatcher) Description() string { - return fmt.Sprintf("has substring \"%s\"", m.needle) -} - -func (m *hasSubstrMatcher) Matches(c interface{}) error { - v := reflect.ValueOf(c) - if v.Kind() != reflect.String { - return NewFatalError("which is not a string") - } - - // Perform the substring search. - haystack := v.String() - if strings.Contains(haystack, m.needle) { - return nil - } - - return errors.New("") -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/identical_to.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/identical_to.go deleted file mode 100644 index ae6460ed966..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/identical_to.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2012 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" -) - -// Is the type comparable according to the definition here? -// -// http://weekly.golang.org/doc/go_spec.html#Comparison_operators -// -func isComparable(t reflect.Type) bool { - switch t.Kind() { - case reflect.Array: - return isComparable(t.Elem()) - - case reflect.Struct: - for i := 0; i < t.NumField(); i++ { - if !isComparable(t.Field(i).Type) { - return false - } - } - - return true - - case reflect.Slice, reflect.Map, reflect.Func: - return false - } - - return true -} - -// Should the supplied type be allowed as an argument to IdenticalTo? -func isLegalForIdenticalTo(t reflect.Type) (bool, error) { - // Allow the zero type. - if t == nil { - return true, nil - } - - // Reference types are always okay; we compare pointers. - switch t.Kind() { - case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan: - return true, nil - } - - // Reject other non-comparable types. - if !isComparable(t) { - return false, errors.New(fmt.Sprintf("%v is not comparable", t)) - } - - return true, nil -} - -// IdenticalTo(x) returns a matcher that matches values v with type identical -// to x such that: -// -// 1. If v and x are of a reference type (slice, map, function, channel), then -// they are either both nil or are references to the same object. -// -// 2. Otherwise, if v and x are not of a reference type but have a valid type, -// then v == x. -// -// If v and x are both the invalid type (which results from the predeclared nil -// value, or from nil interface variables), then the matcher is satisfied. -// -// This function will panic if x is of a value type that is not comparable. For -// example, x cannot be an array of functions. -func IdenticalTo(x interface{}) Matcher { - t := reflect.TypeOf(x) - - // Reject illegal arguments. - if ok, err := isLegalForIdenticalTo(t); !ok { - panic("IdenticalTo: " + err.Error()) - } - - return &identicalToMatcher{x} -} - -type identicalToMatcher struct { - x interface{} -} - -func (m *identicalToMatcher) Description() string { - t := reflect.TypeOf(m.x) - return fmt.Sprintf("identical to <%v> %v", t, m.x) -} - -func (m *identicalToMatcher) Matches(c interface{}) error { - // Make sure the candidate's type is correct. - t := reflect.TypeOf(m.x) - if ct := reflect.TypeOf(c); t != ct { - return NewFatalError(fmt.Sprintf("which is of type %v", ct)) - } - - // Special case: two values of the invalid type are always identical. - if t == nil { - return nil - } - - // Handle reference types. - switch t.Kind() { - case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan: - xv := reflect.ValueOf(m.x) - cv := reflect.ValueOf(c) - if xv.Pointer() == cv.Pointer() { - return nil - } - - return errors.New("which is not an identical reference") - } - - // Are the values equal? - if m.x == c { - return nil - } - - return errors.New("") -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_or_equal.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_or_equal.go deleted file mode 100644 index 8402cdeaf09..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_or_equal.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "fmt" - "reflect" -) - -// LessOrEqual returns a matcher that matches integer, floating point, or -// strings values v such that v <= x. Comparison is not defined between numeric -// and string types, but is defined between all integer and floating point -// types. -// -// x must itself be an integer, floating point, or string type; otherwise, -// LessOrEqual will panic. -func LessOrEqual(x interface{}) Matcher { - desc := fmt.Sprintf("less than or equal to %v", x) - - // Special case: make it clear that strings are strings. - if reflect.TypeOf(x).Kind() == reflect.String { - desc = fmt.Sprintf("less than or equal to \"%s\"", x) - } - - // Put LessThan last so that its error messages will be used in the event of - // failure. - return transformDescription(AnyOf(Equals(x), LessThan(x)), desc) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_than.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_than.go deleted file mode 100644 index 8258e45d99d..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_than.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "math" - "reflect" -) - -// LessThan returns a matcher that matches integer, floating point, or strings -// values v such that v < x. Comparison is not defined between numeric and -// string types, but is defined between all integer and floating point types. -// -// x must itself be an integer, floating point, or string type; otherwise, -// LessThan will panic. -func LessThan(x interface{}) Matcher { - v := reflect.ValueOf(x) - kind := v.Kind() - - switch { - case isInteger(v): - case isFloat(v): - case kind == reflect.String: - - default: - panic(fmt.Sprintf("LessThan: unexpected kind %v", kind)) - } - - return &lessThanMatcher{v} -} - -type lessThanMatcher struct { - limit reflect.Value -} - -func (m *lessThanMatcher) Description() string { - // Special case: make it clear that strings are strings. - if m.limit.Kind() == reflect.String { - return fmt.Sprintf("less than \"%s\"", m.limit.String()) - } - - return fmt.Sprintf("less than %v", m.limit.Interface()) -} - -func compareIntegers(v1, v2 reflect.Value) (err error) { - err = errors.New("") - - switch { - case isSignedInteger(v1) && isSignedInteger(v2): - if v1.Int() < v2.Int() { - err = nil - } - return - - case isSignedInteger(v1) && isUnsignedInteger(v2): - if v1.Int() < 0 || uint64(v1.Int()) < v2.Uint() { - err = nil - } - return - - case isUnsignedInteger(v1) && isSignedInteger(v2): - if v1.Uint() <= math.MaxInt64 && int64(v1.Uint()) < v2.Int() { - err = nil - } - return - - case isUnsignedInteger(v1) && isUnsignedInteger(v2): - if v1.Uint() < v2.Uint() { - err = nil - } - return - } - - panic(fmt.Sprintf("compareIntegers: %v %v", v1, v2)) -} - -func getFloat(v reflect.Value) float64 { - switch { - case isSignedInteger(v): - return float64(v.Int()) - - case isUnsignedInteger(v): - return float64(v.Uint()) - - case isFloat(v): - return v.Float() - } - - panic(fmt.Sprintf("getFloat: %v", v)) -} - -func (m *lessThanMatcher) Matches(c interface{}) (err error) { - v1 := reflect.ValueOf(c) - v2 := m.limit - - err = errors.New("") - - // Handle strings as a special case. - if v1.Kind() == reflect.String && v2.Kind() == reflect.String { - if v1.String() < v2.String() { - err = nil - } - return - } - - // If we get here, we require that we are dealing with integers or floats. - v1Legal := isInteger(v1) || isFloat(v1) - v2Legal := isInteger(v2) || isFloat(v2) - if !v1Legal || !v2Legal { - err = NewFatalError("which is not comparable") - return - } - - // Handle the various comparison cases. - switch { - // Both integers - case isInteger(v1) && isInteger(v2): - return compareIntegers(v1, v2) - - // At least one float32 - case v1.Kind() == reflect.Float32 || v2.Kind() == reflect.Float32: - if float32(getFloat(v1)) < float32(getFloat(v2)) { - err = nil - } - return - - // At least one float64 - case v1.Kind() == reflect.Float64 || v2.Kind() == reflect.Float64: - if getFloat(v1) < getFloat(v2) { - err = nil - } - return - } - - // We shouldn't get here. - panic(fmt.Sprintf("lessThanMatcher.Matches: Shouldn't get here: %v %v", v1, v2)) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go deleted file mode 100644 index daf59d1d92a..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package oglematchers provides a set of matchers useful in a testing or -// mocking framework. These matchers are inspired by and mostly compatible with -// Google Test for C++ and Google JS Test. -// -// This package is used by github.com/smartystreets/goconvey/convey/assertions/ogletest and -// github.com/smartystreets/goconvey/convey/assertions/oglemock, which may be more directly useful if you're not -// writing your own testing package or defining your own matchers. -package oglematchers - -// A Matcher is some predicate implicitly defining a set of values that it -// matches. For example, GreaterThan(17) matches all numeric values greater -// than 17, and HasSubstr("taco") matches all strings with the substring -// "taco". -type Matcher interface { - // Check whether the supplied value belongs to the the set defined by the - // matcher. Return a non-nil error if and only if it does not. - // - // The error describes why the value doesn't match. The error text is a - // relative clause that is suitable for being placed after the value. For - // example, a predicate that matches strings with a particular substring may, - // when presented with a numerical value, return the following error text: - // - // "which is not a string" - // - // Then the failure message may look like: - // - // Expected: has substring "taco" - // Actual: 17, which is not a string - // - // If the error is self-apparent based on the description of the matcher, the - // error text may be empty (but the error still non-nil). For example: - // - // Expected: 17 - // Actual: 19 - // - // If you are implementing a new matcher, see also the documentation on - // FatalError. - Matches(candidate interface{}) error - - // Description returns a string describing the property that values matching - // this matcher have, as a verb phrase where the subject is the value. For - // example, "is greather than 17" or "has substring "taco"". - Description() string -} - -// FatalError is an implementation of the error interface that may be returned -// from matchers, indicating the error should be propagated. Returning a -// *FatalError indicates that the matcher doesn't process values of the -// supplied type, or otherwise doesn't know how to handle the value. -// -// For example, if GreaterThan(17) returned false for the value "taco" without -// a fatal error, then Not(GreaterThan(17)) would return true. This is -// technically correct, but is surprising and may mask failures where the wrong -// sort of matcher is accidentally used. Instead, GreaterThan(17) can return a -// fatal error, which will be propagated by Not(). -type FatalError struct { - errorText string -} - -// NewFatalError creates a FatalError struct with the supplied error text. -func NewFatalError(s string) *FatalError { - return &FatalError{s} -} - -func (e *FatalError) Error() string { - return e.errorText -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go deleted file mode 100644 index b7439a98435..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" - "regexp" -) - -// MatchesRegexp returns a matcher that matches strings and byte slices whose -// contents match the supplide regular expression. The semantics are those of -// regexp.Match. In particular, that means the match is not implicitly anchored -// to the ends of the string: MatchesRegexp("bar") will match "foo bar baz". -func MatchesRegexp(pattern string) Matcher { - re, err := regexp.Compile(pattern) - if err != nil { - panic("MatchesRegexp: " + err.Error()) - } - - return &matchesRegexpMatcher{re} -} - -type matchesRegexpMatcher struct { - re *regexp.Regexp -} - -func (m *matchesRegexpMatcher) Description() string { - return fmt.Sprintf("matches regexp \"%s\"", m.re.String()) -} - -func (m *matchesRegexpMatcher) Matches(c interface{}) (err error) { - v := reflect.ValueOf(c) - isString := v.Kind() == reflect.String - isByteSlice := v.Kind() == reflect.Slice && v.Elem().Kind() == reflect.Uint8 - - err = errors.New("") - - switch { - case isString: - if m.re.MatchString(v.String()) { - err = nil - } - - case isByteSlice: - if m.re.Match(v.Bytes()) { - err = nil - } - - default: - err = NewFatalError("which is not a string or []byte") - } - - return -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/not.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/not.go deleted file mode 100644 index 623789fe28a..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/not.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" -) - -// Not returns a matcher that inverts the set of values matched by the wrapped -// matcher. It does not transform the result for values for which the wrapped -// matcher returns a fatal error. -func Not(m Matcher) Matcher { - return ¬Matcher{m} -} - -type notMatcher struct { - wrapped Matcher -} - -func (m *notMatcher) Matches(c interface{}) (err error) { - err = m.wrapped.Matches(c) - - // Did the wrapped matcher say yes? - if err == nil { - return errors.New("") - } - - // Did the wrapped matcher return a fatal error? - if _, isFatal := err.(*FatalError); isFatal { - return err - } - - // The wrapped matcher returned a non-fatal error. - return nil -} - -func (m *notMatcher) Description() string { - return fmt.Sprintf("not(%s)", m.wrapped.Description()) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/oglematchers.goconvey b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/oglematchers.goconvey deleted file mode 100644 index 79982854b53..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/oglematchers.goconvey +++ /dev/null @@ -1,2 +0,0 @@ -#ignore --timeout=1s diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/panics.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/panics.go deleted file mode 100644 index d2cfc97869b..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/panics.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" -) - -// Panics matches zero-arg functions which, when invoked, panic with an error -// that matches the supplied matcher. -// -// NOTE(jacobsa): This matcher cannot detect the case where the function panics -// using panic(nil), by design of the language. See here for more info: -// -// http://goo.gl/9aIQL -// -func Panics(m Matcher) Matcher { - return &panicsMatcher{m} -} - -type panicsMatcher struct { - wrappedMatcher Matcher -} - -func (m *panicsMatcher) Description() string { - return "panics with: " + m.wrappedMatcher.Description() -} - -func (m *panicsMatcher) Matches(c interface{}) (err error) { - // Make sure c is a zero-arg function. - v := reflect.ValueOf(c) - if v.Kind() != reflect.Func || v.Type().NumIn() != 0 { - err = NewFatalError("which is not a zero-arg function") - return - } - - // Call the function and check its panic error. - defer func() { - if e := recover(); e != nil { - err = m.wrappedMatcher.Matches(e) - - // Set a clearer error message if the matcher said no. - if err != nil { - wrappedClause := "" - if err.Error() != "" { - wrappedClause = ", " + err.Error() - } - - err = errors.New(fmt.Sprintf("which panicked with: %v%s", e, wrappedClause)) - } - } - }() - - v.Call([]reflect.Value{}) - - // If we get here, the function didn't panic. - err = errors.New("which didn't panic") - return -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/pointee.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/pointee.go deleted file mode 100644 index c5383f2402f..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/pointee.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2012 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -import ( - "errors" - "fmt" - "reflect" -) - -// Return a matcher that matches non-nil pointers whose pointee matches the -// wrapped matcher. -func Pointee(m Matcher) Matcher { - return &pointeeMatcher{m} -} - -type pointeeMatcher struct { - wrapped Matcher -} - -func (m *pointeeMatcher) Matches(c interface{}) (err error) { - // Make sure the candidate is of the appropriate type. - cv := reflect.ValueOf(c) - if !cv.IsValid() || cv.Kind() != reflect.Ptr { - return NewFatalError("which is not a pointer") - } - - // Make sure the candidate is non-nil. - if cv.IsNil() { - return NewFatalError("") - } - - // Defer to the wrapped matcher. Fix up empty errors so that failure messages - // are more helpful than just printing a pointer for "Actual". - pointee := cv.Elem().Interface() - err = m.wrapped.Matches(pointee) - if err != nil && err.Error() == "" { - s := fmt.Sprintf("whose pointee is %v", pointee) - - if _, ok := err.(*FatalError); ok { - err = NewFatalError(s) - } else { - err = errors.New(s) - } - } - - return err -} - -func (m *pointeeMatcher) Description() string { - return fmt.Sprintf("pointee(%s)", m.wrapped.Description()) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/transform_description.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/transform_description.go deleted file mode 100644 index f79d0c03db1..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/transform_description.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2011 Aaron Jacobs. All Rights Reserved. -// Author: aaronjjacobs@gmail.com (Aaron Jacobs) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oglematchers - -// transformDescription returns a matcher that is equivalent to the supplied -// one, except that it has the supplied description instead of the one attached -// to the existing matcher. -func transformDescription(m Matcher, newDesc string) Matcher { - return &transformDescriptionMatcher{newDesc, m} -} - -type transformDescriptionMatcher struct { - desc string - wrappedMatcher Matcher -} - -func (m *transformDescriptionMatcher) Description() string { - return m.desc -} - -func (m *transformDescriptionMatcher) Matches(c interface{}) error { - return m.wrappedMatcher.Matches(c) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/panic.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/panic.go deleted file mode 100644 index 7e75db1784b..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/panic.go +++ /dev/null @@ -1,115 +0,0 @@ -package assertions - -import "fmt" - -// ShouldPanic receives a void, niladic function and expects to recover a panic. -func ShouldPanic(actual interface{}, expected ...interface{}) (message string) { - if fail := need(0, expected); fail != success { - return fail - } - - action, _ := actual.(func()) - - if action == nil { - message = shouldUseVoidNiladicFunction - return - } - - defer func() { - recovered := recover() - if recovered == nil { - message = shouldHavePanicked - } else { - message = success - } - }() - action() - - return -} - -// ShouldNotPanic receives a void, niladic function and expects to execute the function without any panic. -func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string) { - if fail := need(0, expected); fail != success { - return fail - } - - action, _ := actual.(func()) - - if action == nil { - message = shouldUseVoidNiladicFunction - return - } - - defer func() { - recovered := recover() - if recovered != nil { - message = fmt.Sprintf(shouldNotHavePanicked, recovered) - } else { - message = success - } - }() - action() - - return -} - -// ShouldPanicWith receives a void, niladic function and expects to recover a panic with the second argument as the content. -func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string) { - if fail := need(1, expected); fail != success { - return fail - } - - action, _ := actual.(func()) - - if action == nil { - message = shouldUseVoidNiladicFunction - return - } - - defer func() { - recovered := recover() - if recovered == nil { - message = shouldHavePanicked - } else { - if equal := ShouldEqual(recovered, expected[0]); equal != success { - message = serializer.serialize(expected[0], recovered, fmt.Sprintf(shouldHavePanickedWith, expected[0], recovered)) - } else { - message = success - } - } - }() - action() - - return -} - -// ShouldNotPanicWith receives a void, niladic function and expects to recover a panic whose content differs from the second argument. -func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string) { - if fail := need(1, expected); fail != success { - return fail - } - - action, _ := actual.(func()) - - if action == nil { - message = shouldUseVoidNiladicFunction - return - } - - defer func() { - recovered := recover() - if recovered == nil { - message = success - } else { - if equal := ShouldEqual(recovered, expected[0]); equal == success { - message = fmt.Sprintf(shouldNotHavePanickedWith, expected[0]) - } else { - message = success - } - } - }() - action() - - return -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go deleted file mode 100644 index bd9eacd8a5c..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go +++ /dev/null @@ -1,141 +0,0 @@ -package assertions - -import ( - "fmt" - - "github.com/smartystreets/goconvey/convey/assertions/oglematchers" -) - -// ShouldBeGreaterThan receives exactly two parameters and ensures that the first is greater than the second. -func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - if matchError := oglematchers.GreaterThan(expected[0]).Matches(actual); matchError != nil { - return fmt.Sprintf(shouldHaveBeenGreater, actual, expected[0]) - } - return success -} - -// ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that the first is greater than or equal to the second. -func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } else if matchError := oglematchers.GreaterOrEqual(expected[0]).Matches(actual); matchError != nil { - return fmt.Sprintf(shouldHaveBeenGreaterOrEqual, actual, expected[0]) - } - return success -} - -// ShouldBeLessThan receives exactly two parameters and ensures that the first is less than the second. -func ShouldBeLessThan(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } else if matchError := oglematchers.LessThan(expected[0]).Matches(actual); matchError != nil { - return fmt.Sprintf(shouldHaveBeenLess, actual, expected[0]) - } - return success -} - -// ShouldBeLessThan receives exactly two parameters and ensures that the first is less than or equal to the second. -func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } else if matchError := oglematchers.LessOrEqual(expected[0]).Matches(actual); matchError != nil { - return fmt.Sprintf(shouldHaveBeenLess, actual, expected[0]) - } - return success -} - -// ShouldBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound. -// It ensures that the actual value is between both bounds (but not equal to either of them). -func ShouldBeBetween(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - lower, upper, fail := deriveBounds(expected) - - if fail != success { - return fail - } else if !isBetween(actual, lower, upper) { - return fmt.Sprintf(shouldHaveBeenBetween, actual, lower, upper) - } - return success -} - -// ShouldNotBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound. -// It ensures that the actual value is NOT between both bounds. -func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - lower, upper, fail := deriveBounds(expected) - - if fail != success { - return fail - } else if isBetween(actual, lower, upper) { - return fmt.Sprintf(shouldNotHaveBeenBetween, actual, lower, upper) - } - return success -} -func deriveBounds(values []interface{}) (lower interface{}, upper interface{}, fail string) { - lower = values[0] - upper = values[1] - - if ShouldNotEqual(lower, upper) != success { - return nil, nil, fmt.Sprintf(shouldHaveDifferentUpperAndLower, lower) - } else if ShouldBeLessThan(lower, upper) != success { - lower, upper = upper, lower - } - return lower, upper, success -} -func isBetween(value, lower, upper interface{}) bool { - if ShouldBeGreaterThan(value, lower) != success { - return false - } else if ShouldBeLessThan(value, upper) != success { - return false - } - return true -} - -// ShouldBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound. -// It ensures that the actual value is between both bounds or equal to one of them. -func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - lower, upper, fail := deriveBounds(expected) - - if fail != success { - return fail - } else if !isBetweenOrEqual(actual, lower, upper) { - return fmt.Sprintf(shouldHaveBeenBetweenOrEqual, actual, lower, upper) - } - return success -} - -// ShouldNotBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound. -// It ensures that the actual value is nopt between the bounds nor equal to either of them. -func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - lower, upper, fail := deriveBounds(expected) - - if fail != success { - return fail - } else if isBetweenOrEqual(actual, lower, upper) { - return fmt.Sprintf(shouldNotHaveBeenBetweenOrEqual, actual, lower, upper) - } - return success -} - -func isBetweenOrEqual(value, lower, upper interface{}) bool { - if ShouldBeGreaterThanOrEqualTo(value, lower) != success { - return false - } else if ShouldBeLessThanOrEqualTo(value, upper) != success { - return false - } - return true -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go deleted file mode 100644 index 90c4ae3451a..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go +++ /dev/null @@ -1,59 +0,0 @@ -package assertions - -import ( - "encoding/json" - "fmt" - - "github.com/smartystreets/goconvey/convey/reporting" -) - -type Serializer interface { - serialize(expected, actual interface{}, message string) string - serializeDetailed(expected, actual interface{}, message string) string -} - -type failureSerializer struct{} - -func (self *failureSerializer) serializeDetailed(expected, actual interface{}, message string) string { - view := self.format(expected, actual, message, "%#v") - serialized, err := json.Marshal(view) - if err != nil { - return message - } - return string(serialized) -} - -func (self *failureSerializer) serialize(expected, actual interface{}, message string) string { - view := self.format(expected, actual, message, "%+v") - serialized, err := json.Marshal(view) - if err != nil { - return message - } - return string(serialized) -} - -func (self *failureSerializer) format(expected, actual interface{}, message string, format string) reporting.FailureView { - return reporting.FailureView{ - Message: message, - Expected: fmt.Sprintf(format, expected), - Actual: fmt.Sprintf(format, actual), - } -} - -func newSerializer() *failureSerializer { - return &failureSerializer{} -} - -/////////////////////////////////////////////////////// - -// noopSerializer just gives back the original message. This is useful when we are using -// the assertions from a context other than the web UI, that requires the JSON structure -// provided by the failureSerializer. -type noopSerializer struct{} - -func (self *noopSerializer) serialize(expected, actual interface{}, message string) string { - return message -} -func (self *noopSerializer) serializeDetailed(expected, actual interface{}, message string) string { - return message -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go deleted file mode 100644 index 1b887b1191e..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go +++ /dev/null @@ -1,183 +0,0 @@ -package assertions - -import ( - "fmt" - "reflect" - "strings" -) - -// ShouldStartWith receives exactly 2 string parameters and ensures that the first starts with the second. -func ShouldStartWith(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - value, valueIsString := actual.(string) - prefix, prefixIsString := expected[0].(string) - - if !valueIsString || !prefixIsString { - return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) - } - - return shouldStartWith(value, prefix) -} -func shouldStartWith(value, prefix string) string { - if !strings.HasPrefix(value, prefix) { - shortval := value - if len(shortval) > len(prefix) { - shortval = shortval[:len(prefix)] + "..." - } - return serializer.serialize(prefix, shortval, fmt.Sprintf(shouldHaveStartedWith, value, prefix)) - } - return success -} - -// ShouldNotStartWith receives exactly 2 string parameters and ensures that the first does not start with the second. -func ShouldNotStartWith(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - value, valueIsString := actual.(string) - prefix, prefixIsString := expected[0].(string) - - if !valueIsString || !prefixIsString { - return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) - } - - return shouldNotStartWith(value, prefix) -} -func shouldNotStartWith(value, prefix string) string { - if strings.HasPrefix(value, prefix) { - if value == "" { - value = "" - } - if prefix == "" { - prefix = "" - } - return fmt.Sprintf(shouldNotHaveStartedWith, value, prefix) - } - return success -} - -// ShouldEndWith receives exactly 2 string parameters and ensures that the first ends with the second. -func ShouldEndWith(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - value, valueIsString := actual.(string) - suffix, suffixIsString := expected[0].(string) - - if !valueIsString || !suffixIsString { - return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) - } - - return shouldEndWith(value, suffix) -} -func shouldEndWith(value, suffix string) string { - if !strings.HasSuffix(value, suffix) { - shortval := value - if len(shortval) > len(suffix) { - shortval = "..." + shortval[len(shortval)-len(suffix):] - } - return serializer.serialize(suffix, shortval, fmt.Sprintf(shouldHaveEndedWith, value, suffix)) - } - return success -} - -// ShouldEndWith receives exactly 2 string parameters and ensures that the first does not end with the second. -func ShouldNotEndWith(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - value, valueIsString := actual.(string) - suffix, suffixIsString := expected[0].(string) - - if !valueIsString || !suffixIsString { - return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) - } - - return shouldNotEndWith(value, suffix) -} -func shouldNotEndWith(value, suffix string) string { - if strings.HasSuffix(value, suffix) { - if value == "" { - value = "" - } - if suffix == "" { - suffix = "" - } - return fmt.Sprintf(shouldNotHaveEndedWith, value, suffix) - } - return success -} - -// ShouldContainSubstring receives exactly 2 string parameters and ensures that the first contains the second as a substring. -func ShouldContainSubstring(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - long, longOk := actual.(string) - short, shortOk := expected[0].(string) - - if !longOk || !shortOk { - return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) - } - - if !strings.Contains(long, short) { - return serializer.serialize(expected[0], actual, fmt.Sprintf(shouldHaveContainedSubstring, long, short)) - } - return success -} - -// ShouldNotContainSubstring receives exactly 2 string parameters and ensures that the first does NOT contain the second as a substring. -func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - long, longOk := actual.(string) - short, shortOk := expected[0].(string) - - if !longOk || !shortOk { - return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) - } - - if strings.Contains(long, short) { - return fmt.Sprintf(shouldNotHaveContainedSubstring, long, short) - } - return success -} - -// ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal to "". -func ShouldBeBlank(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } - value, ok := actual.(string) - if !ok { - return fmt.Sprintf(shouldBeString, reflect.TypeOf(actual)) - } - if value != "" { - return serializer.serialize("", value, fmt.Sprintf(shouldHaveBeenBlank, value)) - } - return success -} - -// ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is equal to "". -func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } - value, ok := actual.(string) - if !ok { - return fmt.Sprintf(shouldBeString, reflect.TypeOf(actual)) - } - if value == "" { - return shouldNotHaveBeenBlank - } - return success -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/time.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/time.go deleted file mode 100644 index 7e05026143f..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/time.go +++ /dev/null @@ -1,202 +0,0 @@ -package assertions - -import ( - "fmt" - "time" -) - -// ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the first happens before the second. -func ShouldHappenBefore(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - expectedTime, secondOk := expected[0].(time.Time) - - if !firstOk || !secondOk { - return shouldUseTimes - } - - if !actualTime.Before(expectedTime) { - return fmt.Sprintf(shouldHaveHappenedBefore, actualTime, expectedTime, actualTime.Sub(expectedTime)) - } - - return success -} - -// ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that the first happens on or before the second. -func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - expectedTime, secondOk := expected[0].(time.Time) - - if !firstOk || !secondOk { - return shouldUseTimes - } - - if actualTime.Equal(expectedTime) { - return success - } - return ShouldHappenBefore(actualTime, expectedTime) -} - -// ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the first happens after the second. -func ShouldHappenAfter(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - expectedTime, secondOk := expected[0].(time.Time) - - if !firstOk || !secondOk { - return shouldUseTimes - } - if !actualTime.After(expectedTime) { - return fmt.Sprintf(shouldHaveHappenedAfter, actualTime, expectedTime, expectedTime.Sub(actualTime)) - } - return success -} - -// ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that the first happens on or after the second. -func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - expectedTime, secondOk := expected[0].(time.Time) - - if !firstOk || !secondOk { - return shouldUseTimes - } - if actualTime.Equal(expectedTime) { - return success - } - return ShouldHappenAfter(actualTime, expectedTime) -} - -// ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the first happens between (not on) the second and third. -func ShouldHappenBetween(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - min, secondOk := expected[0].(time.Time) - max, thirdOk := expected[1].(time.Time) - - if !firstOk || !secondOk || !thirdOk { - return shouldUseTimes - } - - if !actualTime.After(min) { - return fmt.Sprintf(shouldHaveHappenedBetween, actualTime, min, max, min.Sub(actualTime)) - } - if !actualTime.Before(max) { - return fmt.Sprintf(shouldHaveHappenedBetween, actualTime, min, max, actualTime.Sub(max)) - } - return success -} - -// ShouldHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that the first happens between or on the second and third. -func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - min, secondOk := expected[0].(time.Time) - max, thirdOk := expected[1].(time.Time) - - if !firstOk || !secondOk || !thirdOk { - return shouldUseTimes - } - if actualTime.Equal(min) || actualTime.Equal(max) { - return success - } - return ShouldHappenBetween(actualTime, min, max) -} - -// ShouldNotHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that the first -// does NOT happen between or on the second or third. -func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - min, secondOk := expected[0].(time.Time) - max, thirdOk := expected[1].(time.Time) - - if !firstOk || !secondOk || !thirdOk { - return shouldUseTimes - } - if actualTime.Equal(min) || actualTime.Equal(max) { - return fmt.Sprintf(shouldNotHaveHappenedOnOrBetween, actualTime, min, max) - } - if actualTime.After(min) && actualTime.Before(max) { - return fmt.Sprintf(shouldNotHaveHappenedOnOrBetween, actualTime, min, max) - } - return success -} - -// ShouldHappenWithin receives a time.Time, a time.Duration, and a time.Time (3 arguments) -// and asserts that the first time.Time happens within or on the duration specified relative to -// the other time.Time. -func ShouldHappenWithin(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - tolerance, secondOk := expected[0].(time.Duration) - threshold, thirdOk := expected[1].(time.Time) - - if !firstOk || !secondOk || !thirdOk { - return shouldUseDurationAndTime - } - - min := threshold.Add(-tolerance) - max := threshold.Add(tolerance) - return ShouldHappenOnOrBetween(actualTime, min, max) -} - -// ShouldNotHappenWithin receives a time.Time, a time.Duration, and a time.Time (3 arguments) -// and asserts that the first time.Time does NOT happen within or on the duration specified relative to -// the other time.Time. -func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string { - if fail := need(2, expected); fail != success { - return fail - } - actualTime, firstOk := actual.(time.Time) - tolerance, secondOk := expected[0].(time.Duration) - threshold, thirdOk := expected[1].(time.Time) - - if !firstOk || !secondOk || !thirdOk { - return shouldUseDurationAndTime - } - - min := threshold.Add(-tolerance) - max := threshold.Add(tolerance) - return ShouldNotHappenOnOrBetween(actualTime, min, max) -} - -// ShouldBeChronological receives a []time.Time slice and asserts that the are -// in chronological order starting with the first time.Time as the earliest. -func ShouldBeChronological(actual interface{}, expected ...interface{}) string { - if fail := need(0, expected); fail != success { - return fail - } - - times, ok := actual.([]time.Time) - if !ok { - return shouldUseTimeSlice - } - - var previous time.Time - for i, current := range times { - if i > 0 && current.Before(previous) { - return fmt.Sprintf(shouldHaveBeenChronological, - i, i-1, previous.String(), i, current.String()) - } - previous = current - } - return "" -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/type.go b/vendor/github.com/smartystreets/goconvey/convey/assertions/type.go deleted file mode 100644 index 3fc00f68cd0..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/type.go +++ /dev/null @@ -1,112 +0,0 @@ -package assertions - -import ( - "fmt" - "reflect" -) - -// ShouldHaveSameTypeAs receives exactly two parameters and compares their underlying types for equality. -func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - first := reflect.TypeOf(actual) - second := reflect.TypeOf(expected[0]) - - if equal := ShouldEqual(first, second); equal != success { - return serializer.serialize(second, first, fmt.Sprintf(shouldHaveBeenA, actual, second, first)) - } - return success -} - -// ShouldNotHaveSameTypeAs receives exactly two parameters and compares their underlying types for inequality. -func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string { - if fail := need(1, expected); fail != success { - return fail - } - - first := reflect.TypeOf(actual) - second := reflect.TypeOf(expected[0]) - - if equal := ShouldEqual(first, second); equal == success { - return fmt.Sprintf(shouldNotHaveBeenA, actual, second) - } - return success -} - -// ShouldImplement receives exactly two parameters and ensures -// that the first implements the interface type of the second. -func ShouldImplement(actual interface{}, expectedList ...interface{}) string { - if fail := need(1, expectedList); fail != success { - return fail - } - - expected := expectedList[0] - if fail := ShouldBeNil(expected); fail != success { - return shouldCompareWithInterfacePointer - } - - if fail := ShouldNotBeNil(actual); fail != success { - return shouldNotBeNilActual - } - - var actualType reflect.Type - if reflect.TypeOf(actual).Kind() != reflect.Ptr { - actualType = reflect.PtrTo(reflect.TypeOf(actual)) - } else { - actualType = reflect.TypeOf(actual) - } - - expectedType := reflect.TypeOf(expected) - if fail := ShouldNotBeNil(expectedType); fail != success { - return shouldCompareWithInterfacePointer - } - - expectedInterface := expectedType.Elem() - - if actualType == nil { - return fmt.Sprintf(shouldHaveImplemented, expectedInterface, actual) - } - - if !actualType.Implements(expectedInterface) { - return fmt.Sprintf(shouldHaveImplemented, expectedInterface, actualType) - } - return success -} - -// ShouldNotImplement receives exactly two parameters and ensures -// that the first does NOT implement the interface type of the second. -func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string { - if fail := need(1, expectedList); fail != success { - return fail - } - - expected := expectedList[0] - if fail := ShouldBeNil(expected); fail != success { - return shouldCompareWithInterfacePointer - } - - if fail := ShouldNotBeNil(actual); fail != success { - return shouldNotBeNilActual - } - - var actualType reflect.Type - if reflect.TypeOf(actual).Kind() != reflect.Ptr { - actualType = reflect.PtrTo(reflect.TypeOf(actual)) - } else { - actualType = reflect.TypeOf(actual) - } - - expectedType := reflect.TypeOf(expected) - if fail := ShouldNotBeNil(expectedType); fail != success { - return shouldCompareWithInterfacePointer - } - - expectedInterface := expectedType.Elem() - - if actualType.Implements(expectedInterface) { - return fmt.Sprintf(shouldNotHaveImplemented, actualType, expectedInterface) - } - return success -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/context.go b/vendor/github.com/smartystreets/goconvey/convey/context.go deleted file mode 100644 index 2c75c2d7b1b..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/context.go +++ /dev/null @@ -1,272 +0,0 @@ -package convey - -import ( - "fmt" - - "github.com/jtolds/gls" - "github.com/smartystreets/goconvey/convey/reporting" -) - -type conveyErr struct { - fmt string - params []interface{} -} - -func (e *conveyErr) Error() string { - return fmt.Sprintf(e.fmt, e.params...) -} - -func conveyPanic(fmt string, params ...interface{}) { - panic(&conveyErr{fmt, params}) -} - -const ( - missingGoTest = `Top-level calls to Convey(...) need a reference to the *testing.T. - Hint: Convey("description here", t, func() { /* notice that the second argument was the *testing.T (t)! */ }) ` - extraGoTest = `Only the top-level call to Convey(...) needs a reference to the *testing.T.` - noStackContext = "Convey operation made without context on goroutine stack.\n" + - "Hint: Perhaps you meant to use `Convey(..., func(c C){...})` ?" - differentConveySituations = "Different set of Convey statements on subsequent pass!\nDid not expect %#v." - multipleIdenticalConvey = "Multiple convey suites with identical names: %#v" -) - -const ( - failureHalt = "___FAILURE_HALT___" - - nodeKey = "node" -) - -///////////////////////////////// Stack Context ///////////////////////////////// - -func getCurrentContext() *context { - ctx, ok := ctxMgr.GetValue(nodeKey) - if ok { - return ctx.(*context) - } - return nil -} - -func mustGetCurrentContext() *context { - ctx := getCurrentContext() - if ctx == nil { - conveyPanic(noStackContext) - } - return ctx -} - -//////////////////////////////////// Context //////////////////////////////////// - -// context magically handles all coordination of Convey's and So assertions. -// -// It is tracked on the stack as goroutine-local-storage with the gls package, -// or explicitly if the user decides to call convey like: -// -// Convey(..., func(c C) { -// c.So(...) -// }) -// -// This implements the `C` interface. -type context struct { - reporter reporting.Reporter - - children map[string]*context - - resets []func() - - executedOnce bool - expectChildRun *bool - complete bool - - focus bool - failureMode FailureMode -} - -// rootConvey is the main entry point to a test suite. This is called when -// there's no context in the stack already, and items must contain a `t` object, -// or this panics. -func rootConvey(items ...interface{}) { - entry := discover(items) - - if entry.Test == nil { - conveyPanic(missingGoTest) - } - - expectChildRun := true - ctx := &context{ - reporter: buildReporter(), - - children: make(map[string]*context), - - expectChildRun: &expectChildRun, - - focus: entry.Focus, - failureMode: defaultFailureMode.combine(entry.FailMode), - } - ctxMgr.SetValues(gls.Values{nodeKey: ctx}, func() { - ctx.reporter.BeginStory(reporting.NewStoryReport(entry.Test)) - defer ctx.reporter.EndStory() - - for ctx.shouldVisit() { - ctx.conveyInner(entry.Situation, entry.Func) - expectChildRun = true - } - }) -} - -//////////////////////////////////// Methods //////////////////////////////////// - -func (ctx *context) SkipConvey(items ...interface{}) { - ctx.Convey(items, skipConvey) -} - -func (ctx *context) FocusConvey(items ...interface{}) { - ctx.Convey(items, focusConvey) -} - -func (ctx *context) Convey(items ...interface{}) { - entry := discover(items) - - // we're a branch, or leaf (on the wind) - if entry.Test != nil { - conveyPanic(extraGoTest) - } - if ctx.focus && !entry.Focus { - return - } - - var inner_ctx *context - if ctx.executedOnce { - var ok bool - inner_ctx, ok = ctx.children[entry.Situation] - if !ok { - conveyPanic(differentConveySituations, entry.Situation) - } - } else { - if _, ok := ctx.children[entry.Situation]; ok { - conveyPanic(multipleIdenticalConvey, entry.Situation) - } - inner_ctx = &context{ - reporter: ctx.reporter, - - children: make(map[string]*context), - - expectChildRun: ctx.expectChildRun, - - focus: entry.Focus, - failureMode: ctx.failureMode.combine(entry.FailMode), - } - ctx.children[entry.Situation] = inner_ctx - } - - if inner_ctx.shouldVisit() { - ctxMgr.SetValues(gls.Values{nodeKey: inner_ctx}, func() { - inner_ctx.conveyInner(entry.Situation, entry.Func) - }) - } -} - -func (ctx *context) SkipSo(stuff ...interface{}) { - ctx.assertionReport(reporting.NewSkipReport()) -} - -func (ctx *context) So(actual interface{}, assert assertion, expected ...interface{}) { - if result := assert(actual, expected...); result == assertionSuccess { - ctx.assertionReport(reporting.NewSuccessReport()) - } else { - ctx.assertionReport(reporting.NewFailureReport(result)) - } -} - -func (ctx *context) Reset(action func()) { - /* TODO: Failure mode configuration */ - ctx.resets = append(ctx.resets, action) -} - -func (ctx *context) Print(items ...interface{}) (int, error) { - fmt.Fprint(ctx.reporter, items...) - return fmt.Print(items...) -} - -func (ctx *context) Println(items ...interface{}) (int, error) { - fmt.Fprintln(ctx.reporter, items...) - return fmt.Println(items...) -} - -func (ctx *context) Printf(format string, items ...interface{}) (int, error) { - fmt.Fprintf(ctx.reporter, format, items...) - return fmt.Printf(format, items...) -} - -//////////////////////////////////// Private //////////////////////////////////// - -// shouldVisit returns true iff we should traverse down into a Convey. Note -// that just because we don't traverse a Convey this time, doesn't mean that -// we may not traverse it on a subsequent pass. -func (c *context) shouldVisit() bool { - return !c.complete && *c.expectChildRun -} - -// conveyInner is the function which actually executes the user's anonymous test -// function body. At this point, Convey or RootConvey has decided that this -// function should actually run. -func (ctx *context) conveyInner(situation string, f func(C)) { - // Record/Reset state for next time. - defer func() { - ctx.executedOnce = true - - // This is only needed at the leaves, but there's no harm in also setting it - // when returning from branch Convey's - *ctx.expectChildRun = false - }() - - // Set up+tear down our scope for the reporter - ctx.reporter.Enter(reporting.NewScopeReport(situation)) - defer ctx.reporter.Exit() - - // Recover from any panics in f, and assign the `complete` status for this - // node of the tree. - defer func() { - ctx.complete = true - if problem := recover(); problem != nil { - if problem, ok := problem.(*conveyErr); ok { - panic(problem) - } - if problem != failureHalt { - ctx.reporter.Report(reporting.NewErrorReport(problem)) - } - } else { - for _, child := range ctx.children { - if !child.complete { - ctx.complete = false - return - } - } - } - }() - - // Resets are registered as the `f` function executes, so nil them here. - // All resets are run in registration order (FIFO). - ctx.resets = []func(){} - defer func() { - for _, r := range ctx.resets { - // panics handled by the previous defer - r() - } - }() - - if f == nil { - // if f is nil, this was either a Convey(..., nil), or a SkipConvey - ctx.reporter.Report(reporting.NewSkipReport()) - } else { - f(ctx) - } -} - -// assertionReport is a helper for So and SkipSo which makes the report and -// then possibly panics, depending on the current context's failureMode. -func (ctx *context) assertionReport(r *reporting.AssertionResult) { - ctx.reporter.Report(r) - if r.Failure != "" && ctx.failureMode == FailureHalts { - panic(failureHalt) - } -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey b/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey deleted file mode 100644 index a2d9327dc91..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey +++ /dev/null @@ -1,4 +0,0 @@ -#ignore --timeout=1s -#-covermode=count -#-coverpkg=github.com/smartystreets/goconvey/convey,github.com/smartystreets/goconvey/convey/gotest,github.com/smartystreets/goconvey/convey/reporting \ No newline at end of file diff --git a/vendor/github.com/smartystreets/goconvey/convey/discovery.go b/vendor/github.com/smartystreets/goconvey/convey/discovery.go deleted file mode 100644 index eb8d4cb2cee..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/discovery.go +++ /dev/null @@ -1,103 +0,0 @@ -package convey - -type actionSpecifier uint8 - -const ( - noSpecifier actionSpecifier = iota - skipConvey - focusConvey -) - -type suite struct { - Situation string - Test t - Focus bool - Func func(C) // nil means skipped - FailMode FailureMode -} - -func newSuite(situation string, failureMode FailureMode, f func(C), test t, specifier actionSpecifier) *suite { - ret := &suite{ - Situation: situation, - Test: test, - Func: f, - FailMode: failureMode, - } - switch specifier { - case skipConvey: - ret.Func = nil - case focusConvey: - ret.Focus = true - } - return ret -} - -func discover(items []interface{}) *suite { - name, items := parseName(items) - test, items := parseGoTest(items) - failure, items := parseFailureMode(items) - action, items := parseAction(items) - specifier, items := parseSpecifier(items) - - if len(items) != 0 { - conveyPanic(parseError) - } - - return newSuite(name, failure, action, test, specifier) -} -func item(items []interface{}) interface{} { - if len(items) == 0 { - conveyPanic(parseError) - } - return items[0] -} -func parseName(items []interface{}) (string, []interface{}) { - if name, parsed := item(items).(string); parsed { - return name, items[1:] - } - conveyPanic(parseError) - panic("never get here") -} -func parseGoTest(items []interface{}) (t, []interface{}) { - if test, parsed := item(items).(t); parsed { - return test, items[1:] - } - return nil, items -} -func parseFailureMode(items []interface{}) (FailureMode, []interface{}) { - if mode, parsed := item(items).(FailureMode); parsed { - return mode, items[1:] - } - return FailureInherits, items -} -func parseAction(items []interface{}) (func(C), []interface{}) { - switch x := item(items).(type) { - case nil: - return nil, items[1:] - case func(C): - return x, items[1:] - case func(): - return func(C) { x() }, items[1:] - } - conveyPanic(parseError) - panic("never get here") -} -func parseSpecifier(items []interface{}) (actionSpecifier, []interface{}) { - if len(items) == 0 { - return noSpecifier, items - } - if spec, ok := items[0].(actionSpecifier); ok { - return spec, items[1:] - } - conveyPanic(parseError) - panic("never get here") -} - -// This interface allows us to pass the *testing.T struct -// throughout the internals of this package without ever -// having to import the "testing" package. -type t interface { - Fail() -} - -const parseError = "You must provide a name (string), then a *testing.T (if in outermost scope), an optional FailureMode, and then an action (func())." diff --git a/vendor/github.com/smartystreets/goconvey/convey/doc.go b/vendor/github.com/smartystreets/goconvey/convey/doc.go deleted file mode 100644 index 3670e4c5d2f..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/doc.go +++ /dev/null @@ -1,193 +0,0 @@ -// Package convey contains all of the public-facing entry points to this project. -// This means that it should never be required of the user to import any other -// packages from this project as they serve internal purposes. -package convey - -////////////////////////////////// suite ////////////////////////////////// - -// C is the Convey context which you can optionally obtain in your action -// by calling Convey like: -// -// Convey(..., func(c C) { -// ... -// }) -// -// See the documentation on Convey for more details. -// -// All methods in this context behave identically to the global functions of the -// same name in this package. -type C interface { - Convey(items ...interface{}) - SkipConvey(items ...interface{}) - FocusConvey(items ...interface{}) - - So(actual interface{}, assert assertion, expected ...interface{}) - SkipSo(stuff ...interface{}) - - Reset(action func()) - - Println(items ...interface{}) (int, error) - Print(items ...interface{}) (int, error) - Printf(format string, items ...interface{}) (int, error) -} - -// Convey is the method intended for use when declaring the scopes of -// a specification. Each scope has a description and a func() which may contain -// other calls to Convey(), Reset() or Should-style assertions. Convey calls can -// be nested as far as you see fit. -// -// IMPORTANT NOTE: The top-level Convey() within a Test method -// must conform to the following signature: -// -// Convey(description string, t *testing.T, action func()) -// -// All other calls should look like this (no need to pass in *testing.T): -// -// Convey(description string, action func()) -// -// Don't worry, goconvey will panic if you get it wrong so you can fix it. -// -// Additionally, you may explicitly obtain access to the Convey context by doing: -// -// Convey(description string, action func(c C)) -// -// You may need to do this if you want to pass the context through to a -// goroutine, or to close over the context in a handler to a library which -// calls your handler in a goroutine (httptest comes to mind). -// -// All Convey()-blocks also accept an optional parameter of FailureMode which sets -// how goconvey should treat failures for So()-assertions in the block and -// nested blocks. See the constants in this file for the available options. -// -// By default it will inherit from its parent block and the top-level blocks -// default to the FailureHalts setting. -// -// This parameter is inserted before the block itself: -// -// Convey(description string, t *testing.T, mode FailureMode, action func()) -// Convey(description string, mode FailureMode, action func()) -// -// See the examples package for, well, examples. -func Convey(items ...interface{}) { - if ctx := getCurrentContext(); ctx == nil { - rootConvey(items...) - } else { - ctx.Convey(items...) - } -} - -// SkipConvey is analagous to Convey except that the scope is not executed -// (which means that child scopes defined within this scope are not run either). -// The reporter will be notified that this step was skipped. -func SkipConvey(items ...interface{}) { - Convey(append(items, skipConvey)...) -} - -// FocusConvey is has the inverse effect of SkipConvey. If the top-level -// Convey is changed to `FocusConvey`, only nested scopes that are defined -// with FocusConvey will be run. The rest will be ignored completely. This -// is handy when debugging a large suite that runs a misbehaving function -// repeatedly as you can disable all but one of that function -// without swaths of `SkipConvey` calls, just a targeted chain of calls -// to FocusConvey. -func FocusConvey(items ...interface{}) { - Convey(append(items, focusConvey)...) -} - -// Reset registers a cleanup function to be run after each Convey() -// in the same scope. See the examples package for a simple use case. -func Reset(action func()) { - mustGetCurrentContext().Reset(action) -} - -/////////////////////////////////// Assertions /////////////////////////////////// - -// assertion is an alias for a function with a signature that the convey.So() -// method can handle. Any future or custom assertions should conform to this -// method signature. The return value should be an empty string if the assertion -// passes and a well-formed failure message if not. -type assertion func(actual interface{}, expected ...interface{}) string - -const assertionSuccess = "" - -// So is the means by which assertions are made against the system under test. -// The majority of exported names in the assertions package begin with the word -// 'Should' and describe how the first argument (actual) should compare with any -// of the final (expected) arguments. How many final arguments are accepted -// depends on the particular assertion that is passed in as the assert argument. -// See the examples package for use cases and the assertions package for -// documentation on specific assertion methods. A failing assertion will -// cause t.Fail() to be invoked--you should never call this method (or other -// failure-inducing methods) in your test code. Leave that to GoConvey. -func So(actual interface{}, assert assertion, expected ...interface{}) { - mustGetCurrentContext().So(actual, assert, expected...) -} - -// SkipSo is analagous to So except that the assertion that would have been passed -// to So is not executed and the reporter is notified that the assertion was skipped. -func SkipSo(stuff ...interface{}) { - mustGetCurrentContext().SkipSo() -} - -// FailureMode is a type which determines how the So() blocks should fail -// if their assertion fails. See constants further down for acceptable values -type FailureMode string - -const ( - - // FailureContinues is a failure mode which prevents failing - // So()-assertions from halting Convey-block execution, instead - // allowing the test to continue past failing So()-assertions. - FailureContinues FailureMode = "continue" - - // FailureHalts is the default setting for a top-level Convey()-block - // and will cause all failing So()-assertions to halt further execution - // in that test-arm and continue on to the next arm. - FailureHalts FailureMode = "halt" - - // FailureInherits is the default setting for failure-mode, it will - // default to the failure-mode of the parent block. You should never - // need to specify this mode in your tests.. - FailureInherits FailureMode = "inherits" -) - -func (f FailureMode) combine(other FailureMode) FailureMode { - if other == FailureInherits { - return f - } - return other -} - -var defaultFailureMode FailureMode = FailureHalts - -// SetDefaultFailureMode allows you to specify the default failure mode -// for all Convey blocks. It is meant to be used in an init function to -// allow the default mode to be changdd across all tests for an entire packgae -// but it can be used anywhere. -func SetDefaultFailureMode(mode FailureMode) { - if mode == FailureContinues || mode == FailureHalts { - defaultFailureMode = mode - } else { - panic("You may only use the constants named 'FailureContinues' and 'FailureHalts' as default failure modes.") - } -} - -//////////////////////////////////// Print functions //////////////////////////////////// - -// Print is analogous to fmt.Print (and it even calls fmt.Print). It ensures that -// output is aligned with the corresponding scopes in the web UI. -func Print(items ...interface{}) (written int, err error) { - return mustGetCurrentContext().Print(items...) -} - -// Print is analogous to fmt.Println (and it even calls fmt.Println). It ensures that -// output is aligned with the corresponding scopes in the web UI. -func Println(items ...interface{}) (written int, err error) { - return mustGetCurrentContext().Println(items...) -} - -// Print is analogous to fmt.Printf (and it even calls fmt.Printf). It ensures that -// output is aligned with the corresponding scopes in the web UI. -func Printf(format string, items ...interface{}) (written int, err error) { - return mustGetCurrentContext().Printf(format, items...) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go b/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go deleted file mode 100644 index 294e32fa17e..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package convey - -import "testing" - -func TestFocusOnlyAtTopLevel(t *testing.T) { - output := prepare() - - FocusConvey("hi", t, func() { - output += "done" - }) - - expectEqual(t, "done", output) -} - -func TestFocus(t *testing.T) { - output := prepare() - - FocusConvey("hi", t, func() { - output += "1" - - Convey("bye", func() { - output += "2" - }) - }) - - expectEqual(t, "1", output) -} - -func TestNestedFocus(t *testing.T) { - output := prepare() - - FocusConvey("hi", t, func() { - output += "1" - - Convey("This shouldn't run", func() { - output += "boink!" - }) - - FocusConvey("This should run", func() { - output += "2" - - FocusConvey("The should run too", func() { - output += "3" - - }) - - Convey("The should NOT run", func() { - output += "blah blah blah!" - }) - }) - }) - - expectEqual(t, "123", output) -} - -func TestForgotTopLevelFocus(t *testing.T) { - output := prepare() - - Convey("1", t, func() { - output += "1" - - FocusConvey("This will be run because the top-level lacks Focus", func() { - output += "2" - }) - - Convey("3", func() { - output += "3" - }) - }) - - expectEqual(t, "1213", output) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go b/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go deleted file mode 100644 index b370f1e4cd0..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go +++ /dev/null @@ -1,37 +0,0 @@ -// Package gotest contains internal functionality. Although this package -// contains one or more exported names it is not intended for public -// consumption. See the examples package for how to use this project. -package gotest - -import ( - "fmt" - "runtime" - "strings" -) - -func FormatExternalFileAndLine() string { - file, line, _ := ResolveExternalCaller() - if line == -1 { - return "" // panic? - } - return fmt.Sprintf("%s:%d", file, line) -} - -func ResolveExternalCaller() (file string, line int, name string) { - var caller_id uintptr - callers := runtime.Callers(0, callStack) - - for x := 0; x < callers; x++ { - caller_id, file, line, _ = runtime.Caller(x) - if strings.HasSuffix(file, "_test.go") { - name = runtime.FuncForPC(caller_id).Name() - return - } - } - file, line, name = "", -1, "" - return // panic? -} - -const maxStackDepth = 100 // This had better be enough... - -var callStack []uintptr = make([]uintptr, maxStackDepth, maxStackDepth) diff --git a/vendor/github.com/smartystreets/goconvey/convey/init.go b/vendor/github.com/smartystreets/goconvey/convey/init.go deleted file mode 100644 index fef92266317..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/init.go +++ /dev/null @@ -1,73 +0,0 @@ -package convey - -import ( - "flag" - "os" - - "github.com/jtolds/gls" - "github.com/smartystreets/goconvey/convey/reporting" -) - -func init() { - declareFlags() - - ctxMgr = gls.NewContextManager() -} - -func declareFlags() { - flag.BoolVar(&json, "json", false, "When true, emits results in JSON blocks. Default: 'false'") - flag.BoolVar(&silent, "silent", false, "When true, all output from GoConvey is suppressed.") - flag.BoolVar(&story, "story", false, "When true, emits story output, otherwise emits dot output. When not provided, this flag mirros the value of the '-test.v' flag") - - if noStoryFlagProvided() { - story = verboseEnabled - } - - // FYI: flag.Parse() is called from the testing package. -} - -func noStoryFlagProvided() bool { - return !story && !storyDisabled -} - -func buildReporter() reporting.Reporter { - switch { - case testReporter != nil: - return testReporter - case json: - return reporting.BuildJsonReporter() - case silent: - return reporting.BuildSilentReporter() - case story: - return reporting.BuildStoryReporter() - default: - return reporting.BuildDotReporter() - } -} - -var ( - ctxMgr *gls.ContextManager - - // only set by internal tests - testReporter reporting.Reporter -) - -var ( - json bool - silent bool - story bool - - verboseEnabled = flagFound("-test.v=true") - storyDisabled = flagFound("-story=false") -) - -// flagFound parses the command line args manually for flags defined in other -// packages. Like the '-v' flag from the "testing" package, for instance. -func flagFound(flagValue string) bool { - for _, arg := range os.Args { - if arg == flagValue { - return true - } - } - return false -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go b/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go deleted file mode 100644 index 7e22b3caa53..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go +++ /dev/null @@ -1,774 +0,0 @@ -package convey - -import ( - "strconv" - "testing" - "time" -) - -func TestSingleScope(t *testing.T) { - output := prepare() - - Convey("hi", t, func() { - output += "done" - }) - - expectEqual(t, "done", output) -} - -func TestSingleScopeWithMultipleConveys(t *testing.T) { - output := prepare() - - Convey("1", t, func() { - output += "1" - }) - - Convey("2", t, func() { - output += "2" - }) - - expectEqual(t, "12", output) -} - -func TestNestedScopes(t *testing.T) { - output := prepare() - - Convey("a", t, func() { - output += "a " - - Convey("bb", func() { - output += "bb " - - Convey("ccc", func() { - output += "ccc | " - }) - }) - }) - - expectEqual(t, "a bb ccc | ", output) -} - -func TestNestedScopesWithIsolatedExecution(t *testing.T) { - output := prepare() - - Convey("a", t, func() { - output += "a " - - Convey("aa", func() { - output += "aa " - - Convey("aaa", func() { - output += "aaa | " - }) - - Convey("aaa1", func() { - output += "aaa1 | " - }) - }) - - Convey("ab", func() { - output += "ab " - - Convey("abb", func() { - output += "abb | " - }) - }) - }) - - expectEqual(t, "a aa aaa | a aa aaa1 | a ab abb | ", output) -} - -func TestSingleScopeWithConveyAndNestedReset(t *testing.T) { - output := prepare() - - Convey("1", t, func() { - output += "1" - - Reset(func() { - output += "a" - }) - }) - - expectEqual(t, "1a", output) -} - -func TestPanicingReset(t *testing.T) { - output := prepare() - - Convey("1", t, func() { - output += "1" - - Reset(func() { - panic("nooo") - }) - - Convey("runs since the reset hasn't yet", func() { - output += "a" - }) - - Convey("but this doesnt", func() { - output += "nope" - }) - }) - - expectEqual(t, "1a", output) -} - -func TestSingleScopeWithMultipleRegistrationsAndReset(t *testing.T) { - output := prepare() - - Convey("reset after each nested convey", t, func() { - Convey("first output", func() { - output += "1" - }) - - Convey("second output", func() { - output += "2" - }) - - Reset(func() { - output += "a" - }) - }) - - expectEqual(t, "1a2a", output) -} - -func TestSingleScopeWithMultipleRegistrationsAndMultipleResets(t *testing.T) { - output := prepare() - - Convey("each reset is run at end of each nested convey", t, func() { - Convey("1", func() { - output += "1" - }) - - Convey("2", func() { - output += "2" - }) - - Reset(func() { - output += "a" - }) - - Reset(func() { - output += "b" - }) - }) - - expectEqual(t, "1ab2ab", output) -} - -func Test_Failure_AtHigherLevelScopePreventsChildScopesFromRunning(t *testing.T) { - output := prepare() - - Convey("This step fails", t, func() { - So(1, ShouldEqual, 2) - - Convey("this should NOT be executed", func() { - output += "a" - }) - }) - - expectEqual(t, "", output) -} - -func Test_Panic_AtHigherLevelScopePreventsChildScopesFromRunning(t *testing.T) { - output := prepare() - - Convey("This step panics", t, func() { - Convey("this happens, because the panic didn't happen yet", func() { - output += "1" - }) - - output += "a" - - Convey("this should NOT be executed", func() { - output += "2" - }) - - output += "b" - - panic("Hi") - - output += "nope" - }) - - expectEqual(t, "1ab", output) -} - -func Test_Panic_InChildScopeDoes_NOT_PreventExecutionOfSiblingScopes(t *testing.T) { - output := prepare() - - Convey("This is the parent", t, func() { - Convey("This step panics", func() { - panic("Hi") - output += "1" - }) - - Convey("This sibling should execute", func() { - output += "2" - }) - }) - - expectEqual(t, "2", output) -} - -func Test_Failure_InChildScopeDoes_NOT_PreventExecutionOfSiblingScopes(t *testing.T) { - output := prepare() - - Convey("This is the parent", t, func() { - Convey("This step fails", func() { - So(1, ShouldEqual, 2) - output += "1" - }) - - Convey("This sibling should execute", func() { - output += "2" - }) - }) - - expectEqual(t, "2", output) -} - -func TestResetsAreAlwaysExecutedAfterScope_Panics(t *testing.T) { - output := prepare() - - Convey("This is the parent", t, func() { - Convey("This step panics", func() { - panic("Hi") - output += "1" - }) - - Convey("This sibling step does not panic", func() { - output += "a" - - Reset(func() { - output += "b" - }) - }) - - Reset(func() { - output += "2" - }) - }) - - expectEqual(t, "2ab2", output) -} - -func TestResetsAreAlwaysExecutedAfterScope_Failures(t *testing.T) { - output := prepare() - - Convey("This is the parent", t, func() { - Convey("This step fails", func() { - So(1, ShouldEqual, 2) - output += "1" - }) - - Convey("This sibling step does not fail", func() { - output += "a" - - Reset(func() { - output += "b" - }) - }) - - Reset(func() { - output += "2" - }) - }) - - expectEqual(t, "2ab2", output) -} - -func TestSkipTopLevel(t *testing.T) { - output := prepare() - - SkipConvey("hi", t, func() { - output += "This shouldn't be executed!" - }) - - expectEqual(t, "", output) -} - -func TestSkipNestedLevel(t *testing.T) { - output := prepare() - - Convey("hi", t, func() { - output += "yes" - - SkipConvey("bye", func() { - output += "no" - }) - }) - - expectEqual(t, "yes", output) -} - -func TestSkipNestedLevelSkipsAllChildLevels(t *testing.T) { - output := prepare() - - Convey("hi", t, func() { - output += "yes" - - SkipConvey("bye", func() { - output += "no" - - Convey("byebye", func() { - output += "no-no" - }) - }) - }) - - expectEqual(t, "yes", output) -} - -func TestIterativeConveys(t *testing.T) { - output := prepare() - - Convey("Test", t, func() { - for x := 0; x < 10; x++ { - y := strconv.Itoa(x) - - Convey(y, func() { - output += y - }) - } - }) - - expectEqual(t, "0123456789", output) -} - -func TestClosureVariables(t *testing.T) { - output := prepare() - - i := 0 - - Convey("A", t, func() { - i = i + 1 - j := i - - output += "A" + strconv.Itoa(i) + " " - - Convey("B", func() { - k := j - j = j + 1 - - output += "B" + strconv.Itoa(k) + " " - - Convey("C", func() { - output += "C" + strconv.Itoa(k) + strconv.Itoa(j) + " " - }) - - Convey("D", func() { - output += "D" + strconv.Itoa(k) + strconv.Itoa(j) + " " - }) - }) - - Convey("C", func() { - output += "C" + strconv.Itoa(j) + " " - }) - }) - - output += "D" + strconv.Itoa(i) + " " - - expectEqual(t, "A1 B1 C12 A2 B2 D23 A3 C3 D3 ", output) -} - -func TestClosureVariablesWithReset(t *testing.T) { - output := prepare() - - i := 0 - - Convey("A", t, func() { - i = i + 1 - j := i - - output += "A" + strconv.Itoa(i) + " " - - Reset(func() { - output += "R" + strconv.Itoa(i) + strconv.Itoa(j) + " " - }) - - Convey("B", func() { - output += "B" + strconv.Itoa(j) + " " - }) - - Convey("C", func() { - output += "C" + strconv.Itoa(j) + " " - }) - }) - - output += "D" + strconv.Itoa(i) + " " - - expectEqual(t, "A1 B1 R11 A2 C2 R22 D2 ", output) -} - -func TestWrappedSimple(t *testing.T) { - prepare() - output := resetTestString{""} - - Convey("A", t, func() { - func() { - output.output += "A " - - Convey("B", func() { - output.output += "B " - - Convey("C", func() { - output.output += "C " - }) - - }) - - Convey("D", func() { - output.output += "D " - }) - }() - }) - - expectEqual(t, "A B C A D ", output.output) -} - -type resetTestString struct { - output string -} - -func addReset(o *resetTestString, f func()) func() { - return func() { - Reset(func() { - o.output += "R " - }) - - f() - } -} - -func TestWrappedReset(t *testing.T) { - prepare() - output := resetTestString{""} - - Convey("A", t, addReset(&output, func() { - output.output += "A " - - Convey("B", func() { - output.output += "B " - }) - - Convey("C", func() { - output.output += "C " - }) - })) - - expectEqual(t, "A B R A C R ", output.output) -} - -func TestWrappedReset2(t *testing.T) { - prepare() - output := resetTestString{""} - - Convey("A", t, func() { - Reset(func() { - output.output += "R " - }) - - func() { - output.output += "A " - - Convey("B", func() { - output.output += "B " - - Convey("C", func() { - output.output += "C " - }) - }) - - Convey("D", func() { - output.output += "D " - }) - }() - }) - - expectEqual(t, "A B C R A D R ", output.output) -} - -func TestInfiniteLoopWithTrailingFail(t *testing.T) { - done := make(chan int) - - go func() { - Convey("This fails", t, func() { - Convey("and this is run", func() { - So(true, ShouldEqual, true) - }) - - /* And this prevents the whole block to be marked as run */ - So(false, ShouldEqual, true) - }) - - done <- 1 - }() - - select { - case <-done: - return - case <-time.After(1 * time.Millisecond): - t.Fail() - } -} - -func TestOutermostResetInvokedForGrandchildren(t *testing.T) { - output := prepare() - - Convey("A", t, func() { - output += "A " - - Reset(func() { - output += "rA " - }) - - Convey("B", func() { - output += "B " - - Reset(func() { - output += "rB " - }) - - Convey("C", func() { - output += "C " - - Reset(func() { - output += "rC " - }) - }) - - Convey("D", func() { - output += "D " - - Reset(func() { - output += "rD " - }) - }) - }) - }) - - expectEqual(t, "A B C rC rB rA A B D rD rB rA ", output) -} - -func TestFailureOption(t *testing.T) { - output := prepare() - - Convey("A", t, FailureHalts, func() { - output += "A " - So(true, ShouldEqual, true) - output += "B " - So(false, ShouldEqual, true) - output += "C " - }) - - expectEqual(t, "A B ", output) -} - -func TestFailureOption2(t *testing.T) { - output := prepare() - - Convey("A", t, func() { - output += "A " - So(true, ShouldEqual, true) - output += "B " - So(false, ShouldEqual, true) - output += "C " - }) - - expectEqual(t, "A B ", output) -} - -func TestFailureOption3(t *testing.T) { - output := prepare() - - Convey("A", t, FailureContinues, func() { - output += "A " - So(true, ShouldEqual, true) - output += "B " - So(false, ShouldEqual, true) - output += "C " - }) - - expectEqual(t, "A B C ", output) -} - -func TestFailureOptionInherit(t *testing.T) { - output := prepare() - - Convey("A", t, FailureContinues, func() { - output += "A1 " - So(false, ShouldEqual, true) - output += "A2 " - - Convey("B", func() { - output += "B1 " - So(true, ShouldEqual, true) - output += "B2 " - So(false, ShouldEqual, true) - output += "B3 " - }) - }) - - expectEqual(t, "A1 A2 B1 B2 B3 ", output) -} - -func TestFailureOptionInherit2(t *testing.T) { - output := prepare() - - Convey("A", t, FailureHalts, func() { - output += "A1 " - So(false, ShouldEqual, true) - output += "A2 " - - Convey("B", func() { - output += "A1 " - So(true, ShouldEqual, true) - output += "A2 " - So(false, ShouldEqual, true) - output += "A3 " - }) - }) - - expectEqual(t, "A1 ", output) -} - -func TestFailureOptionInherit3(t *testing.T) { - output := prepare() - - Convey("A", t, FailureHalts, func() { - output += "A1 " - So(true, ShouldEqual, true) - output += "A2 " - - Convey("B", func() { - output += "B1 " - So(true, ShouldEqual, true) - output += "B2 " - So(false, ShouldEqual, true) - output += "B3 " - }) - }) - - expectEqual(t, "A1 A2 B1 B2 ", output) -} - -func TestFailureOptionNestedOverride(t *testing.T) { - output := prepare() - - Convey("A", t, FailureContinues, func() { - output += "A " - So(false, ShouldEqual, true) - output += "B " - - Convey("C", FailureHalts, func() { - output += "C " - So(true, ShouldEqual, true) - output += "D " - So(false, ShouldEqual, true) - output += "E " - }) - }) - - expectEqual(t, "A B C D ", output) -} - -func TestFailureOptionNestedOverride2(t *testing.T) { - output := prepare() - - Convey("A", t, FailureHalts, func() { - output += "A " - So(true, ShouldEqual, true) - output += "B " - - Convey("C", FailureContinues, func() { - output += "C " - So(true, ShouldEqual, true) - output += "D " - So(false, ShouldEqual, true) - output += "E " - }) - }) - - expectEqual(t, "A B C D E ", output) -} - -func TestMultipleInvocationInheritance(t *testing.T) { - output := prepare() - - Convey("A", t, FailureHalts, func() { - output += "A1 " - So(true, ShouldEqual, true) - output += "A2 " - - Convey("B", FailureContinues, func() { - output += "B1 " - So(true, ShouldEqual, true) - output += "B2 " - So(false, ShouldEqual, true) - output += "B3 " - }) - - Convey("C", func() { - output += "C1 " - So(true, ShouldEqual, true) - output += "C2 " - So(false, ShouldEqual, true) - output += "C3 " - }) - }) - - expectEqual(t, "A1 A2 B1 B2 B3 A1 A2 C1 C2 ", output) -} - -func TestMultipleInvocationInheritance2(t *testing.T) { - output := prepare() - - Convey("A", t, FailureContinues, func() { - output += "A1 " - So(true, ShouldEqual, true) - output += "A2 " - So(false, ShouldEqual, true) - output += "A3 " - - Convey("B", FailureHalts, func() { - output += "B1 " - So(true, ShouldEqual, true) - output += "B2 " - So(false, ShouldEqual, true) - output += "B3 " - }) - - Convey("C", func() { - output += "C1 " - So(true, ShouldEqual, true) - output += "C2 " - So(false, ShouldEqual, true) - output += "C3 " - }) - }) - - expectEqual(t, "A1 A2 A3 B1 B2 A1 A2 A3 C1 C2 C3 ", output) -} - -func TestSetDefaultFailureMode(t *testing.T) { - output := prepare() - - SetDefaultFailureMode(FailureContinues) // the default is normally FailureHalts - defer SetDefaultFailureMode(FailureHalts) - - Convey("A", t, func() { - output += "A1 " - So(true, ShouldBeFalse) - output += "A2 " - }) - - expectEqual(t, "A1 A2 ", output) -} - -func prepare() string { - testReporter = newNilReporter() - return "" -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go b/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go deleted file mode 100644 index 777b2a51228..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go +++ /dev/null @@ -1,15 +0,0 @@ -package convey - -import ( - "github.com/smartystreets/goconvey/convey/reporting" -) - -type nilReporter struct{} - -func (self *nilReporter) BeginStory(story *reporting.StoryReport) {} -func (self *nilReporter) Enter(scope *reporting.ScopeReport) {} -func (self *nilReporter) Report(report *reporting.AssertionResult) {} -func (self *nilReporter) Exit() {} -func (self *nilReporter) EndStory() {} -func (self *nilReporter) Write(p []byte) (int, error) { return len(p), nil } -func newNilReporter() *nilReporter { return &nilReporter{} } diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go deleted file mode 100644 index 7bf67dbb2b1..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go +++ /dev/null @@ -1,16 +0,0 @@ -package reporting - -import ( - "fmt" - "io" -) - -type console struct{} - -func (self *console) Write(p []byte) (n int, err error) { - return fmt.Print(string(p)) -} - -func NewConsole() io.Writer { - return new(console) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go deleted file mode 100644 index a37d0019466..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package reporting contains internal functionality related -// to console reporting and output. Although this package has -// exported names is not intended for public consumption. See the -// examples package for how to use this project. -package reporting diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go deleted file mode 100644 index 47d57c6b0d9..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go +++ /dev/null @@ -1,40 +0,0 @@ -package reporting - -import "fmt" - -type dot struct{ out *Printer } - -func (self *dot) BeginStory(story *StoryReport) {} - -func (self *dot) Enter(scope *ScopeReport) {} - -func (self *dot) Report(report *AssertionResult) { - if report.Error != nil { - fmt.Print(redColor) - self.out.Insert(dotError) - } else if report.Failure != "" { - fmt.Print(yellowColor) - self.out.Insert(dotFailure) - } else if report.Skipped { - fmt.Print(yellowColor) - self.out.Insert(dotSkip) - } else { - fmt.Print(greenColor) - self.out.Insert(dotSuccess) - } - fmt.Print(resetColor) -} - -func (self *dot) Exit() {} - -func (self *dot) EndStory() {} - -func (self *dot) Write(content []byte) (written int, err error) { - return len(content), nil // no-op -} - -func NewDotReporter(out *Printer) *dot { - self := new(dot) - self.out = out - return self -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go deleted file mode 100644 index a8d20d46f08..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package reporting - -import ( - "errors" - "testing" -) - -func TestDotReporterAssertionPrinting(t *testing.T) { - monochrome() - file := newMemoryFile() - printer := NewPrinter(file) - reporter := NewDotReporter(printer) - - reporter.Report(NewSuccessReport()) - reporter.Report(NewFailureReport("failed")) - reporter.Report(NewErrorReport(errors.New("error"))) - reporter.Report(NewSkipReport()) - - expected := dotSuccess + dotFailure + dotError + dotSkip - - if file.buffer != expected { - t.Errorf("\nExpected: '%s'\nActual: '%s'", expected, file.buffer) - } -} - -func TestDotReporterOnlyReportsAssertions(t *testing.T) { - monochrome() - file := newMemoryFile() - printer := NewPrinter(file) - reporter := NewDotReporter(printer) - - reporter.BeginStory(nil) - reporter.Enter(nil) - reporter.Exit() - reporter.EndStory() - - if file.buffer != "" { - t.Errorf("\nExpected: '(blank)'\nActual: '%s'", file.buffer) - } -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go deleted file mode 100644 index c396e16b17a..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go +++ /dev/null @@ -1,33 +0,0 @@ -package reporting - -type gotestReporter struct{ test T } - -func (self *gotestReporter) BeginStory(story *StoryReport) { - self.test = story.Test -} - -func (self *gotestReporter) Enter(scope *ScopeReport) {} - -func (self *gotestReporter) Report(r *AssertionResult) { - if !passed(r) { - self.test.Fail() - } -} - -func (self *gotestReporter) Exit() {} - -func (self *gotestReporter) EndStory() { - self.test = nil -} - -func (self *gotestReporter) Write(content []byte) (written int, err error) { - return len(content), nil // no-op -} - -func NewGoTestReporter() *gotestReporter { - return new(gotestReporter) -} - -func passed(r *AssertionResult) bool { - return r.Error == nil && r.Failure == "" -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go deleted file mode 100644 index fda189458e5..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package reporting - -import "testing" - -func TestReporterReceivesSuccessfulReport(t *testing.T) { - reporter := NewGoTestReporter() - test := new(fakeTest) - reporter.BeginStory(NewStoryReport(test)) - reporter.Report(NewSuccessReport()) - - if test.failed { - t.Errorf("Should have have marked test as failed--the report reflected success.") - } -} - -func TestReporterReceivesFailureReport(t *testing.T) { - reporter := NewGoTestReporter() - test := new(fakeTest) - reporter.BeginStory(NewStoryReport(test)) - reporter.Report(NewFailureReport("This is a failure.")) - - if !test.failed { - t.Errorf("Test should have been marked as failed (but it wasn't).") - } -} - -func TestReporterReceivesErrorReport(t *testing.T) { - reporter := NewGoTestReporter() - test := new(fakeTest) - reporter.BeginStory(NewStoryReport(test)) - reporter.Report(NewErrorReport("This is an error.")) - - if !test.failed { - t.Errorf("Test should have been marked as failed (but it wasn't).") - } -} - -func TestReporterIsResetAtTheEndOfTheStory(t *testing.T) { - defer catch(t) - reporter := NewGoTestReporter() - test := new(fakeTest) - reporter.BeginStory(NewStoryReport(test)) - reporter.EndStory() - - reporter.Report(NewSuccessReport()) -} - -func TestReporterNoopMethods(t *testing.T) { - reporter := NewGoTestReporter() - reporter.Enter(NewScopeReport("title")) - reporter.Exit() -} - -func catch(t *testing.T) { - if r := recover(); r != nil { - t.Log("Getting to this point means we've passed (because we caught a panic appropriately).") - } -} - -type fakeTest struct { - failed bool -} - -func (self *fakeTest) Fail() { - self.failed = true -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go deleted file mode 100644 index ea7a4be075f..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go +++ /dev/null @@ -1,94 +0,0 @@ -package reporting - -import ( - "fmt" - "os" - "runtime" - "strings" -) - -func init() { - if !isXterm() { - monochrome() - } - - if runtime.GOOS == "windows" { - success, failure, error_ = dotSuccess, dotFailure, dotError - } -} - -func BuildJsonReporter() Reporter { - out := NewPrinter(NewConsole()) - return NewReporters( - NewGoTestReporter(), - NewJsonReporter(out)) -} -func BuildDotReporter() Reporter { - out := NewPrinter(NewConsole()) - return NewReporters( - NewGoTestReporter(), - NewDotReporter(out), - NewProblemReporter(out), - consoleStatistics) -} -func BuildStoryReporter() Reporter { - out := NewPrinter(NewConsole()) - return NewReporters( - NewGoTestReporter(), - NewStoryReporter(out), - NewProblemReporter(out), - consoleStatistics) -} -func BuildSilentReporter() Reporter { - out := NewPrinter(NewConsole()) - return NewReporters( - NewGoTestReporter(), - NewProblemReporter(out)) -} - -var ( - newline = "\n" - success = "✔" - failure = "✘" - error_ = "🔥" - skip = "⚠" - dotSuccess = "." - dotFailure = "x" - dotError = "E" - dotSkip = "S" - errorTemplate = "* %s \nLine %d: - %v \n%s\n" - failureTemplate = "* %s \nLine %d:\n%s\n" -) - -var ( - greenColor = "\033[32m" - yellowColor = "\033[33m" - redColor = "\033[31m" - resetColor = "\033[0m" -) - -var consoleStatistics = NewStatisticsReporter(NewPrinter(NewConsole())) - -// QuiteMode disables all console output symbols. This is only meant to be used -// for tests that are internal to goconvey where the output is distracting or -// otherwise not needed in the test output. -func QuietMode() { - success, failure, error_, skip, dotSuccess, dotFailure, dotError, dotSkip = "", "", "", "", "", "", "", "" -} - -func monochrome() { - greenColor, yellowColor, redColor, resetColor = "", "", "", "" -} - -func isXterm() bool { - env := fmt.Sprintf("%v", os.Environ()) - return strings.Contains(env, " TERM=isXterm") || - strings.Contains(env, " TERM=xterm") -} - -// This interface allows us to pass the *testing.T struct -// throughout the internals of this tool without ever -// having to import the "testing" package. -type T interface { - Fail() -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/json.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/json.go deleted file mode 100644 index f8526979f85..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/json.go +++ /dev/null @@ -1,88 +0,0 @@ -// TODO: under unit test - -package reporting - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" -) - -type JsonReporter struct { - out *Printer - currentKey []string - current *ScopeResult - index map[string]*ScopeResult - scopes []*ScopeResult -} - -func (self *JsonReporter) depth() int { return len(self.currentKey) } - -func (self *JsonReporter) BeginStory(story *StoryReport) {} - -func (self *JsonReporter) Enter(scope *ScopeReport) { - self.currentKey = append(self.currentKey, scope.Title) - ID := strings.Join(self.currentKey, "|") - if _, found := self.index[ID]; !found { - next := newScopeResult(scope.Title, self.depth(), scope.File, scope.Line) - self.scopes = append(self.scopes, next) - self.index[ID] = next - } - self.current = self.index[ID] -} - -func (self *JsonReporter) Report(report *AssertionResult) { - self.current.Assertions = append(self.current.Assertions, report) -} - -func (self *JsonReporter) Exit() { - self.currentKey = self.currentKey[:len(self.currentKey)-1] -} - -func (self *JsonReporter) EndStory() { - self.report() - self.reset() -} -func (self *JsonReporter) report() { - scopes := []string{} - for _, scope := range self.scopes { - serialized, err := json.Marshal(scope) - if err != nil { - self.out.Println(jsonMarshalFailure) - panic(err) - } - var buffer bytes.Buffer - json.Indent(&buffer, serialized, "", " ") - scopes = append(scopes, buffer.String()) - } - self.out.Print(fmt.Sprintf("%s\n%s,\n%s\n", OpenJson, strings.Join(scopes, ","), CloseJson)) -} -func (self *JsonReporter) reset() { - self.scopes = []*ScopeResult{} - self.index = map[string]*ScopeResult{} - self.currentKey = nil -} - -func (self *JsonReporter) Write(content []byte) (written int, err error) { - self.current.Output += string(content) - return len(content), nil -} - -func NewJsonReporter(out *Printer) *JsonReporter { - self := new(JsonReporter) - self.out = out - self.reset() - return self -} - -const OpenJson = ">->->OPEN-JSON->->->" // "⌦" -const CloseJson = "<-<-<-CLOSE-JSON<-<-<" // "⌫" -const jsonMarshalFailure = ` - -GOCONVEY_JSON_MARSHALL_FAILURE: There was an error when attempting to convert test results to JSON. -Please file a bug report and reference the code that caused this failure if possible. - -Here's the panic: - -` diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go deleted file mode 100644 index 6d4a879c40d..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go +++ /dev/null @@ -1,57 +0,0 @@ -package reporting - -import ( - "fmt" - "io" - "strings" -) - -type Printer struct { - out io.Writer - prefix string -} - -func (self *Printer) Println(message string, values ...interface{}) { - formatted := self.format(message, values...) + newline - self.out.Write([]byte(formatted)) -} - -func (self *Printer) Print(message string, values ...interface{}) { - formatted := self.format(message, values...) - self.out.Write([]byte(formatted)) -} - -func (self *Printer) Insert(text string) { - self.out.Write([]byte(text)) -} - -func (self *Printer) format(message string, values ...interface{}) string { - var formatted string - if len(values) == 0 { - formatted = self.prefix + message - } else { - formatted = self.prefix + fmt.Sprintf(message, values...) - } - indented := strings.Replace(formatted, newline, newline+self.prefix, -1) - return strings.TrimRight(indented, space) -} - -func (self *Printer) Indent() { - self.prefix += pad -} - -func (self *Printer) Dedent() { - if len(self.prefix) >= padLength { - self.prefix = self.prefix[:len(self.prefix)-padLength] - } -} - -func NewPrinter(out io.Writer) *Printer { - self := new(Printer) - self.out = out - return self -} - -const space = " " -const pad = space + space -const padLength = len(pad) diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go deleted file mode 100644 index 94202d5ac97..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go +++ /dev/null @@ -1,181 +0,0 @@ -package reporting - -import "testing" - -func TestPrint(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const expected = "Hello, World!" - - printer.Print(expected) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintFormat(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - template := "Hi, %s" - name := "Ralph" - expected := "Hi, Ralph" - - printer.Print(template, name) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintPreservesEncodedStrings(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const expected = "= -> %3D" - printer.Print(expected) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintln(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const expected = "Hello, World!" - - printer.Println(expected) - - if file.buffer != expected+"\n" { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintlnFormat(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - template := "Hi, %s" - name := "Ralph" - expected := "Hi, Ralph\n" - - printer.Println(template, name) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintlnPreservesEncodedStrings(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const expected = "= -> %3D" - printer.Println(expected) - - if file.buffer != expected+"\n" { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintIndented(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const message = "Hello, World!\nGoodbye, World!" - const expected = " Hello, World!\n Goodbye, World!" - - printer.Indent() - printer.Print(message) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintDedented(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const expected = "Hello, World!\nGoodbye, World!" - - printer.Indent() - printer.Dedent() - printer.Print(expected) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintlnIndented(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const message = "Hello, World!\nGoodbye, World!" - const expected = " Hello, World!\n Goodbye, World!\n" - - printer.Indent() - printer.Println(message) - - if file.buffer != expected { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestPrintlnDedented(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - const expected = "Hello, World!\nGoodbye, World!" - - printer.Indent() - printer.Dedent() - printer.Println(expected) - - if file.buffer != expected+"\n" { - t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer) - } -} - -func TestDedentTooFarShouldNotPanic(t *testing.T) { - defer func() { - if r := recover(); r != nil { - t.Error("Should not have panicked!") - } - }() - file := newMemoryFile() - printer := NewPrinter(file) - - printer.Dedent() - - t.Log("Getting to this point without panicking means we passed.") -} - -func TestInsert(t *testing.T) { - file := newMemoryFile() - printer := NewPrinter(file) - - printer.Indent() - printer.Print("Hi") - printer.Insert(" there") - printer.Dedent() - - expected := " Hi there" - if file.buffer != expected { - t.Errorf("Should have written '%s' but instead wrote '%s'.", expected, file.buffer) - } -} - -////////////////// memoryFile //////////////////// - -type memoryFile struct { - buffer string -} - -func (self *memoryFile) Write(p []byte) (n int, err error) { - self.buffer += string(p) - return len(p), nil -} - -func (self *memoryFile) String() string { - return self.buffer -} - -func newMemoryFile() *memoryFile { - return new(memoryFile) -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go deleted file mode 100644 index c610ba88693..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go +++ /dev/null @@ -1,68 +0,0 @@ -package reporting - -import "fmt" - -type problem struct { - out *Printer - errors []*AssertionResult - failures []*AssertionResult -} - -func (self *problem) BeginStory(story *StoryReport) {} - -func (self *problem) Enter(scope *ScopeReport) {} - -func (self *problem) Report(report *AssertionResult) { - if report.Error != nil { - self.errors = append(self.errors, report) - } else if report.Failure != "" { - self.failures = append(self.failures, report) - } -} - -func (self *problem) Exit() {} - -func (self *problem) EndStory() { - self.show(self.showErrors, redColor) - self.show(self.showFailures, yellowColor) - self.prepareForNextStory() -} -func (self *problem) show(display func(), color string) { - fmt.Print(color) - display() - fmt.Print(resetColor) - self.out.Dedent() -} -func (self *problem) showErrors() { - for i, e := range self.errors { - if i == 0 { - self.out.Println("\nErrors:\n") - self.out.Indent() - } - self.out.Println(errorTemplate, e.File, e.Line, e.Error, e.StackTrace) - } -} -func (self *problem) showFailures() { - for i, f := range self.failures { - if i == 0 { - self.out.Println("\nFailures:\n") - self.out.Indent() - } - self.out.Println(failureTemplate, f.File, f.Line, f.Failure) - } -} - -func (self *problem) Write(content []byte) (written int, err error) { - return len(content), nil // no-op -} - -func NewProblemReporter(out *Printer) *problem { - self := new(problem) - self.out = out - self.prepareForNextStory() - return self -} -func (self *problem) prepareForNextStory() { - self.errors = []*AssertionResult{} - self.failures = []*AssertionResult{} -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go deleted file mode 100644 index 92f0ca35cca..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package reporting - -import ( - "strings" - "testing" -) - -func TestNoopProblemReporterActions(t *testing.T) { - file, reporter := setup() - reporter.BeginStory(nil) - reporter.Enter(nil) - reporter.Exit() - expected := "" - actual := file.String() - if expected != actual { - t.Errorf("Expected: '(blank)'\nActual: '%s'", actual) - } -} - -func TestReporterPrintsFailuresAndErrorsAtTheEndOfTheStory(t *testing.T) { - file, reporter := setup() - reporter.Report(NewFailureReport("failed")) - reporter.Report(NewErrorReport("error")) - reporter.Report(NewSuccessReport()) - reporter.EndStory() - - result := file.String() - if !strings.Contains(result, "Errors:\n") { - t.Errorf("Expected errors, found none.") - } - if !strings.Contains(result, "Failures:\n") { - t.Errorf("Expected failures, found none.") - } - - // Each stack trace looks like: `* /path/to/file.go`, so look for `* `. - // With go 1.4+ there is a line in some stack traces that looks like this: - // `testing.(*M).Run(0x2082d60a0, 0x25b7c0)` - // So we can't just look for "*" anymore. - problemCount := strings.Count(result, "* ") - if problemCount != 2 { - t.Errorf("Expected one failure and one error (total of 2 '*' characters). Got %d", problemCount) - } -} - -func setup() (file *memoryFile, reporter *problem) { - monochrome() - file = newMemoryFile() - printer := NewPrinter(file) - reporter = NewProblemReporter(printer) - return -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go deleted file mode 100644 index cce6c5e4388..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go +++ /dev/null @@ -1,39 +0,0 @@ -package reporting - -import "io" - -type Reporter interface { - BeginStory(story *StoryReport) - Enter(scope *ScopeReport) - Report(r *AssertionResult) - Exit() - EndStory() - io.Writer -} - -type reporters struct{ collection []Reporter } - -func (self *reporters) BeginStory(s *StoryReport) { self.foreach(func(r Reporter) { r.BeginStory(s) }) } -func (self *reporters) Enter(s *ScopeReport) { self.foreach(func(r Reporter) { r.Enter(s) }) } -func (self *reporters) Report(a *AssertionResult) { self.foreach(func(r Reporter) { r.Report(a) }) } -func (self *reporters) Exit() { self.foreach(func(r Reporter) { r.Exit() }) } -func (self *reporters) EndStory() { self.foreach(func(r Reporter) { r.EndStory() }) } - -func (self *reporters) Write(contents []byte) (written int, err error) { - self.foreach(func(r Reporter) { - written, err = r.Write(contents) - }) - return written, err -} - -func (self *reporters) foreach(action func(Reporter)) { - for _, r := range self.collection { - action(r) - } -} - -func NewReporters(collection ...Reporter) *reporters { - self := new(reporters) - self.collection = collection - return self -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go deleted file mode 100644 index 4e5caf63b2b..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package reporting - -import ( - "runtime" - "testing" -) - -func TestEachNestedReporterReceivesTheCallFromTheContainingReporter(t *testing.T) { - fake1 := newFakeReporter() - fake2 := newFakeReporter() - reporter := NewReporters(fake1, fake2) - - reporter.BeginStory(nil) - assertTrue(t, fake1.begun) - assertTrue(t, fake2.begun) - - reporter.Enter(NewScopeReport("scope")) - assertTrue(t, fake1.entered) - assertTrue(t, fake2.entered) - - reporter.Report(NewSuccessReport()) - assertTrue(t, fake1.reported) - assertTrue(t, fake2.reported) - - reporter.Exit() - assertTrue(t, fake1.exited) - assertTrue(t, fake2.exited) - - reporter.EndStory() - assertTrue(t, fake1.ended) - assertTrue(t, fake2.ended) - - content := []byte("hi") - written, err := reporter.Write(content) - assertTrue(t, fake1.written) - assertTrue(t, fake2.written) - assertEqual(t, written, len(content)) - assertNil(t, err) - -} - -func assertTrue(t *testing.T, value bool) { - if !value { - _, _, line, _ := runtime.Caller(1) - t.Errorf("Value should have been true (but was false). See line %d", line) - } -} - -func assertEqual(t *testing.T, expected, actual int) { - if actual != expected { - _, _, line, _ := runtime.Caller(1) - t.Errorf("Value should have been %d (but was %d). See line %d", expected, actual, line) - } -} - -func assertNil(t *testing.T, err error) { - if err != nil { - _, _, line, _ := runtime.Caller(1) - t.Errorf("Error should have been (but wasn't). See line %d", err, line) - } -} - -type fakeReporter struct { - begun bool - entered bool - reported bool - exited bool - ended bool - written bool -} - -func newFakeReporter() *fakeReporter { - return &fakeReporter{} -} - -func (self *fakeReporter) BeginStory(story *StoryReport) { - self.begun = true -} -func (self *fakeReporter) Enter(scope *ScopeReport) { - self.entered = true -} -func (self *fakeReporter) Report(report *AssertionResult) { - self.reported = true -} -func (self *fakeReporter) Exit() { - self.exited = true -} -func (self *fakeReporter) EndStory() { - self.ended = true -} -func (self *fakeReporter) Write(content []byte) (int, error) { - self.written = true - return len(content), nil -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey b/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey deleted file mode 100644 index 79982854b53..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey +++ /dev/null @@ -1,2 +0,0 @@ -#ignore --timeout=1s diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go deleted file mode 100644 index 659a0ec98b4..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go +++ /dev/null @@ -1,177 +0,0 @@ -package reporting - -import ( - "encoding/json" - "fmt" - "runtime" - "strings" - - "github.com/smartystreets/goconvey/convey/gotest" -) - -////////////////// ScopeReport //////////////////// - -type ScopeReport struct { - Title string - File string - Line int -} - -func NewScopeReport(title string) *ScopeReport { - file, line, _ := gotest.ResolveExternalCaller() - self := new(ScopeReport) - self.Title = title - self.File = file - self.Line = line - return self -} - -////////////////// ScopeResult //////////////////// - -type ScopeResult struct { - Title string - File string - Line int - Depth int - Assertions []*AssertionResult - Output string -} - -func newScopeResult(title string, depth int, file string, line int) *ScopeResult { - self := new(ScopeResult) - self.Title = title - self.Depth = depth - self.File = file - self.Line = line - self.Assertions = []*AssertionResult{} - return self -} - -/////////////////// StoryReport ///////////////////// - -type StoryReport struct { - Test T - Name string - File string - Line int -} - -func NewStoryReport(test T) *StoryReport { - file, line, name := gotest.ResolveExternalCaller() - name = removePackagePath(name) - self := new(StoryReport) - self.Test = test - self.Name = name - self.File = file - self.Line = line - return self -} - -// name comes in looking like "github.com/smartystreets/goconvey/examples.TestName". -// We only want the stuff after the last '.', which is the name of the test function. -func removePackagePath(name string) string { - parts := strings.Split(name, ".") - return parts[len(parts)-1] -} - -/////////////////// FailureView //////////////////////// - -type FailureView struct { - Message string - Expected string - Actual string -} - -////////////////////AssertionResult ////////////////////// - -type AssertionResult struct { - File string - Line int - Expected string - Actual string - Failure string - Error interface{} - StackTrace string - Skipped bool -} - -func NewFailureReport(failure string) *AssertionResult { - report := new(AssertionResult) - report.File, report.Line = caller() - report.StackTrace = stackTrace() - parseFailure(failure, report) - return report -} -func parseFailure(failure string, report *AssertionResult) { - view := new(FailureView) - err := json.Unmarshal([]byte(failure), view) - if err == nil { - report.Failure = view.Message - report.Expected = view.Expected - report.Actual = view.Actual - } else { - report.Failure = failure - } -} -func NewErrorReport(err interface{}) *AssertionResult { - report := new(AssertionResult) - report.File, report.Line = caller() - report.StackTrace = fullStackTrace() - report.Error = fmt.Sprintf("%v", err) - return report -} -func NewSuccessReport() *AssertionResult { - return new(AssertionResult) -} -func NewSkipReport() *AssertionResult { - report := new(AssertionResult) - report.File, report.Line = caller() - report.StackTrace = fullStackTrace() - report.Skipped = true - return report -} - -func caller() (file string, line int) { - file, line, _ = gotest.ResolveExternalCaller() - return -} - -func stackTrace() string { - buffer := make([]byte, 1024*64) - n := runtime.Stack(buffer, false) - return removeInternalEntries(string(buffer[:n])) -} -func fullStackTrace() string { - buffer := make([]byte, 1024*64) - n := runtime.Stack(buffer, true) - return removeInternalEntries(string(buffer[:n])) -} -func removeInternalEntries(stack string) string { - lines := strings.Split(stack, newline) - filtered := []string{} - for _, line := range lines { - if !isExternal(line) { - filtered = append(filtered, line) - } - } - return strings.Join(filtered, newline) -} -func isExternal(line string) bool { - for _, p := range internalPackages { - if strings.Contains(line, p) { - return true - } - } - return false -} - -// NOTE: any new packages that host goconvey packages will need to be added here! -// An alternative is to scan the goconvey directory and then exclude stuff like -// the examples package but that's nasty too. -var internalPackages = []string{ - "goconvey/assertions", - "goconvey/convey", - "goconvey/execution", - "goconvey/gotest", - "goconvey/reporting", -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go deleted file mode 100644 index e015031c3a3..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go +++ /dev/null @@ -1,79 +0,0 @@ -package reporting - -import "fmt" - -func (self *statistics) BeginStory(story *StoryReport) {} - -func (self *statistics) Enter(scope *ScopeReport) {} - -func (self *statistics) Report(report *AssertionResult) { - if !self.failing && report.Failure != "" { - self.failing = true - } - if !self.erroring && report.Error != nil { - self.erroring = true - } - if report.Skipped { - self.skipped += 1 - } else { - self.total++ - } -} - -func (self *statistics) Exit() {} - -func (self *statistics) EndStory() { - self.reportAssertions() - self.reportSkippedSections() - self.completeReport() -} -func (self *statistics) reportAssertions() { - self.decideColor() - self.out.Print("\n%d %s thus far", self.total, plural("assertion", self.total)) -} -func (self *statistics) decideColor() { - if self.failing && !self.erroring { - fmt.Print(yellowColor) - } else if self.erroring { - fmt.Print(redColor) - } else { - fmt.Print(greenColor) - } -} -func (self *statistics) reportSkippedSections() { - if self.skipped > 0 { - fmt.Print(yellowColor) - self.out.Print(" (one or more sections skipped)") - self.skipped = 0 - } -} -func (self *statistics) completeReport() { - fmt.Print(resetColor) - self.out.Print("\n") - self.out.Print("\n") -} - -func (self *statistics) Write(content []byte) (written int, err error) { - return len(content), nil // no-op -} - -func NewStatisticsReporter(out *Printer) *statistics { - self := statistics{} - self.out = out - return &self -} - -type statistics struct { - out *Printer - total int - failing bool - erroring bool - skipped int -} - -func plural(word string, count int) string { - if count == 1 { - return word - } - return word + "s" -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/story.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/story.go deleted file mode 100644 index 9e73c971f8f..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/story.go +++ /dev/null @@ -1,73 +0,0 @@ -// TODO: in order for this reporter to be completely honest -// we need to retrofit to be more like the json reporter such that: -// 1. it maintains ScopeResult collections, which count assertions -// 2. it reports only after EndStory(), so that all tick marks -// are placed near the appropriate title. -// 3. Under unit test - -package reporting - -import ( - "fmt" - "strings" -) - -type story struct { - out *Printer - titlesById map[string]string - currentKey []string -} - -func (self *story) BeginStory(story *StoryReport) {} - -func (self *story) Enter(scope *ScopeReport) { - self.out.Indent() - - self.currentKey = append(self.currentKey, scope.Title) - ID := strings.Join(self.currentKey, "|") - - if _, found := self.titlesById[ID]; !found { - self.out.Println("") - self.out.Print(scope.Title) - self.out.Insert(" ") - self.titlesById[ID] = scope.Title - } -} - -func (self *story) Report(report *AssertionResult) { - if report.Error != nil { - fmt.Print(redColor) - self.out.Insert(error_) - } else if report.Failure != "" { - fmt.Print(yellowColor) - self.out.Insert(failure) - } else if report.Skipped { - fmt.Print(yellowColor) - self.out.Insert(skip) - } else { - fmt.Print(greenColor) - self.out.Insert(success) - } - fmt.Print(resetColor) -} - -func (self *story) Exit() { - self.out.Dedent() - self.currentKey = self.currentKey[:len(self.currentKey)-1] -} - -func (self *story) EndStory() { - self.titlesById = make(map[string]string) - self.out.Println("\n") -} - -func (self *story) Write(content []byte) (written int, err error) { - return len(content), nil // no-op -} - -func NewStoryReporter(out *Printer) *story { - self := new(story) - self.out = out - self.titlesById = make(map[string]string) - return self -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go b/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go deleted file mode 100644 index 69125c3cf44..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go +++ /dev/null @@ -1,317 +0,0 @@ -package convey - -import ( - "fmt" - "net/http" - "net/http/httptest" - "path" - "runtime" - "strconv" - "strings" - "testing" - - "github.com/smartystreets/goconvey/convey/reporting" -) - -func TestSingleScopeReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - So(1, ShouldEqual, 1) - }) - - expectEqual(t, "Begin|A|Success|Exit|End", myReporter.wholeStory()) -} - -func TestNestedScopeReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - Convey("B", func() { - So(1, ShouldEqual, 1) - }) - }) - - expectEqual(t, "Begin|A|B|Success|Exit|Exit|End", myReporter.wholeStory()) -} - -func TestFailureReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - So(1, ShouldBeNil) - }) - - expectEqual(t, "Begin|A|Failure|Exit|End", myReporter.wholeStory()) -} - -func TestFirstFailureEndsScopeExecution(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - So(1, ShouldBeNil) - So(nil, ShouldBeNil) - }) - - expectEqual(t, "Begin|A|Failure|Exit|End", myReporter.wholeStory()) -} - -func TestComparisonFailureDeserializedAndReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - So("hi", ShouldEqual, "bye") - }) - - expectEqual(t, "Begin|A|Failure(bye/hi)|Exit|End", myReporter.wholeStory()) -} - -func TestNestedFailureReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - Convey("B", func() { - So(2, ShouldBeNil) - }) - }) - - expectEqual(t, "Begin|A|B|Failure|Exit|Exit|End", myReporter.wholeStory()) -} - -func TestSuccessAndFailureReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - So(nil, ShouldBeNil) - So(1, ShouldBeNil) - }) - - expectEqual(t, "Begin|A|Success|Failure|Exit|End", myReporter.wholeStory()) -} - -func TestIncompleteActionReportedAsSkipped(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - Convey("B", nil) - }) - - expectEqual(t, "Begin|A|B|Skipped|Exit|Exit|End", myReporter.wholeStory()) -} - -func TestSkippedConveyReportedAsSkipped(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - SkipConvey("B", func() { - So(1, ShouldEqual, 1) - }) - }) - - expectEqual(t, "Begin|A|B|Skipped|Exit|Exit|End", myReporter.wholeStory()) -} - -func TestMultipleSkipsAreReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - Convey("0", func() { - So(nil, ShouldBeNil) - }) - - SkipConvey("1", func() {}) - SkipConvey("2", func() {}) - - Convey("3", nil) - Convey("4", nil) - - Convey("5", func() { - So(nil, ShouldBeNil) - }) - }) - - expected := "Begin" + - "|A|0|Success|Exit|Exit" + - "|A|1|Skipped|Exit|Exit" + - "|A|2|Skipped|Exit|Exit" + - "|A|3|Skipped|Exit|Exit" + - "|A|4|Skipped|Exit|Exit" + - "|A|5|Success|Exit|Exit" + - "|End" - - expectEqual(t, expected, myReporter.wholeStory()) -} - -func TestSkippedAssertionIsNotReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - SkipSo(1, ShouldEqual, 1) - }) - - expectEqual(t, "Begin|A|Skipped|Exit|End", myReporter.wholeStory()) -} - -func TestMultipleSkippedAssertionsAreNotReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - SkipSo(1, ShouldEqual, 1) - So(1, ShouldEqual, 1) - SkipSo(1, ShouldEqual, 1) - }) - - expectEqual(t, "Begin|A|Skipped|Success|Skipped|Exit|End", myReporter.wholeStory()) -} - -func TestErrorByManualPanicReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - panic("Gopher alert!") - }) - - expectEqual(t, "Begin|A|Error|Exit|End", myReporter.wholeStory()) -} - -func TestIterativeConveysReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - for x := 0; x < 3; x++ { - Convey(strconv.Itoa(x), func() { - So(x, ShouldEqual, x) - }) - } - }) - - expectEqual(t, "Begin|A|0|Success|Exit|Exit|A|1|Success|Exit|Exit|A|2|Success|Exit|Exit|End", myReporter.wholeStory()) -} - -func TestNestedIterativeConveysReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func() { - for x := 0; x < 3; x++ { - Convey(strconv.Itoa(x), func() { - for y := 0; y < 3; y++ { - Convey("< "+strconv.Itoa(y), func() { - So(x, ShouldBeLessThan, y) - }) - } - }) - } - }) - - expectEqual(t, ("Begin|" + - "A|0|< 0|Failure|Exit|Exit|Exit|" + - "A|0|< 1|Success|Exit|Exit|Exit|" + - "A|0|< 2|Success|Exit|Exit|Exit|" + - "A|1|< 0|Failure|Exit|Exit|Exit|" + - "A|1|< 1|Failure|Exit|Exit|Exit|" + - "A|1|< 2|Success|Exit|Exit|Exit|" + - "A|2|< 0|Failure|Exit|Exit|Exit|" + - "A|2|< 1|Failure|Exit|Exit|Exit|" + - "A|2|< 2|Failure|Exit|Exit|Exit|" + - "End"), myReporter.wholeStory()) -} - -func TestEmbeddedAssertionReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - Convey("A", test, func(c C) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - c.So(r.FormValue("msg"), ShouldEqual, "ping") - })) - http.DefaultClient.Get(ts.URL + "?msg=ping") - }) - - expectEqual(t, "Begin|A|Success|Exit|End", myReporter.wholeStory()) -} - -func TestEmbeddedContextHelperReported(t *testing.T) { - myReporter, test := setupFakeReporter() - - helper := func(c C) http.HandlerFunc { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - c.Convey("Embedded", func() { - So(r.FormValue("msg"), ShouldEqual, "ping") - }) - }) - } - - Convey("A", test, func(c C) { - ts := httptest.NewServer(helper(c)) - http.DefaultClient.Get(ts.URL + "?msg=ping") - }) - - expectEqual(t, "Begin|A|Embedded|Success|Exit|Exit|End", myReporter.wholeStory()) -} - -func expectEqual(t *testing.T, expected interface{}, actual interface{}) { - if expected != actual { - _, file, line, _ := runtime.Caller(1) - t.Errorf("Expected '%v' to be '%v' but it wasn't. See '%s' at line %d.", - actual, expected, path.Base(file), line) - } -} - -func setupFakeReporter() (*fakeReporter, *fakeGoTest) { - myReporter := new(fakeReporter) - myReporter.calls = []string{} - testReporter = myReporter - return myReporter, new(fakeGoTest) -} - -type fakeReporter struct { - calls []string -} - -func (self *fakeReporter) BeginStory(story *reporting.StoryReport) { - self.calls = append(self.calls, "Begin") -} - -func (self *fakeReporter) Enter(scope *reporting.ScopeReport) { - self.calls = append(self.calls, scope.Title) -} - -func (self *fakeReporter) Report(report *reporting.AssertionResult) { - if report.Error != nil { - self.calls = append(self.calls, "Error") - } else if report.Failure != "" { - message := "Failure" - if report.Expected != "" || report.Actual != "" { - message += fmt.Sprintf("(%s/%s)", report.Expected, report.Actual) - } - self.calls = append(self.calls, message) - } else if report.Skipped { - self.calls = append(self.calls, "Skipped") - } else { - self.calls = append(self.calls, "Success") - } -} - -func (self *fakeReporter) Exit() { - self.calls = append(self.calls, "Exit") -} - -func (self *fakeReporter) EndStory() { - self.calls = append(self.calls, "End") -} - -func (self *fakeReporter) Write(content []byte) (int, error) { - return len(content), nil // no-op -} - -func (self *fakeReporter) wholeStory() string { - return strings.Join(self.calls, "|") -} - -//////////////////////////////// - -type fakeGoTest struct{} - -func (self *fakeGoTest) Fail() {} -func (self *fakeGoTest) Fatalf(format string, args ...interface{}) {} - -var test t = new(fakeGoTest) diff --git a/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go b/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go deleted file mode 100644 index ff3a4e6e7a0..00000000000 --- a/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go +++ /dev/null @@ -1,184 +0,0 @@ -package convey - -import ( - "reflect" - "testing" -) - -func expectPanic(t *testing.T, f string) interface{} { - r := recover() - if r != nil { - if cp, ok := r.(*conveyErr); ok { - if cp.fmt != f { - t.Error("Incorrect panic message.") - } - } else { - t.Errorf("Incorrect panic type. %s", reflect.TypeOf(r)) - } - } else { - t.Error("Expected panic but none occured") - } - return r -} - -func TestMissingTopLevelGoTestReferenceCausesPanic(t *testing.T) { - output := map[string]bool{} - - defer expectEqual(t, false, output["good"]) - defer expectPanic(t, missingGoTest) - - Convey("Hi", func() { - output["bad"] = true // this shouldn't happen - }) -} - -func requireGoTestReference(t *testing.T) { - err := recover() - if err == nil { - t.Error("We should have recovered a panic here (because of a missing *testing.T reference)!") - } else { - expectEqual(t, missingGoTest, err) - } -} - -func TestMissingTopLevelGoTestReferenceAfterGoodExample(t *testing.T) { - output := map[string]bool{} - - defer func() { - expectEqual(t, true, output["good"]) - expectEqual(t, false, output["bad"]) - }() - defer expectPanic(t, missingGoTest) - - Convey("Good example", t, func() { - output["good"] = true - }) - - Convey("Bad example", func() { - output["bad"] = true // shouldn't happen - }) -} - -func TestExtraReferencePanics(t *testing.T) { - output := map[string]bool{} - - defer expectEqual(t, false, output["bad"]) - defer expectPanic(t, extraGoTest) - - Convey("Good example", t, func() { - Convey("Bad example - passing in *testing.T a second time!", t, func() { - output["bad"] = true // shouldn't happen - }) - }) -} - -func TestParseRegistrationMissingRequiredElements(t *testing.T) { - defer expectPanic(t, parseError) - - Convey() -} - -func TestParseRegistration_MissingNameString(t *testing.T) { - defer expectPanic(t, parseError) - - Convey(func() {}) -} - -func TestParseRegistration_MissingActionFunc(t *testing.T) { - defer expectPanic(t, parseError) - - Convey("Hi there", 12345) -} - -func TestFailureModeNoContext(t *testing.T) { - Convey("Foo", t, func() { - done := make(chan int, 1) - go func() { - defer func() { done <- 1 }() - defer expectPanic(t, noStackContext) - So(len("I have no context"), ShouldBeGreaterThan, 0) - }() - <-done - }) -} - -func TestFailureModeDuplicateSuite(t *testing.T) { - Convey("cool", t, func() { - defer expectPanic(t, multipleIdenticalConvey) - - Convey("dup", nil) - Convey("dup", nil) - }) -} - -func TestFailureModeIndeterminentSuiteNames(t *testing.T) { - defer expectPanic(t, differentConveySituations) - - name := "bob" - Convey("cool", t, func() { - for i := 0; i < 3; i++ { - Convey(name, func() {}) - name += "bob" - } - }) -} - -func TestFailureModeNestedIndeterminentSuiteNames(t *testing.T) { - defer expectPanic(t, differentConveySituations) - - name := "bob" - Convey("cool", t, func() { - Convey("inner", func() { - for i := 0; i < 3; i++ { - Convey(name, func() {}) - name += "bob" - } - }) - }) -} - -func TestFailureModeParameterButMissing(t *testing.T) { - defer expectPanic(t, parseError) - - prepare() - - Convey("Foobar", t, FailureHalts) -} - -func TestFailureModeParameterWithAction(t *testing.T) { - prepare() - - Convey("Foobar", t, FailureHalts, func() {}) -} - -func TestExtraConveyParameters(t *testing.T) { - defer expectPanic(t, parseError) - - prepare() - - Convey("Foobar", t, FailureHalts, func() {}, "This is not supposed to be here") -} - -func TestExtraConveyParameters2(t *testing.T) { - defer expectPanic(t, parseError) - - prepare() - - Convey("Foobar", t, func() {}, "This is not supposed to be here") -} - -func TestExtraConveyParameters3(t *testing.T) { - defer expectPanic(t, parseError) - - output := prepare() - - Convey("A", t, func() { - output += "A " - - Convey("B", func() { - output += "B " - }, "This is not supposed to be here") - }) - - expectEqual(t, "A ", output) -}