diff --git a/docs/sources/installation/configuration.md b/docs/sources/installation/configuration.md index 54cb2d95fee..4c7f63d53ae 100644 --- a/docs/sources/installation/configuration.md +++ b/docs/sources/installation/configuration.md @@ -428,7 +428,7 @@ session provider you have configured. - **mysql:** go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name` - **postgres:** ex: user=a password=b host=localhost port=5432 dbname=c sslmode=disable - **memcache:** ex: 127.0.0.1:11211 -- **redis:** ex: `addr=127.0.0.1:6379,pool_size=100,db=grafana` +- **redis:** ex: `addr=127.0.0.1:6379,pool_size=100,prefix=grafana` If you use MySQL or Postgres as the session store you need to create the session table manually. diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 363a4759cce..7498cab9c48 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -68,7 +68,7 @@ is `3000` and default user and group is `admin`. To configure the Grafana server to start at boot time: - $ sudo update-rc.d grafana-server defaults 95 10 + $ sudo update-rc.d grafana-server defaults ## Start the server (via systemd) 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/pkg/services/alerting/conditions/query.go b/pkg/services/alerting/conditions/query.go index dd39453ae42..f966985f132 100644 --- a/pkg/services/alerting/conditions/query.go +++ b/pkg/services/alerting/conditions/query.go @@ -43,6 +43,11 @@ func (c *QueryCondition) Eval(context *alerting.EvalContext) { reducedValue := c.Reducer.Reduce(series) evalMatch := c.Evaluator.Eval(reducedValue) + if reducedValue == nil { + emptySerieCount++ + continue + } + if context.IsTestRun { context.Logs = append(context.Logs, &alerting.ResultLogEntry{ Message: fmt.Sprintf("Condition[%d]: Eval: %v, Metric: %s, Value: %1.3f", c.Index, evalMatch, series.Name, *reducedValue), @@ -55,11 +60,6 @@ func (c *QueryCondition) Eval(context *alerting.EvalContext) { Value: *reducedValue, }) } - - // handle no data scenario - if reducedValue == nil { - emptySerieCount++ - } } context.NoDataFound = emptySerieCount == len(seriesList) diff --git a/pkg/services/alerting/conditions/query_test.go b/pkg/services/alerting/conditions/query_test.go index f78ac17db2b..983e75c4c1b 100644 --- a/pkg/services/alerting/conditions/query_test.go +++ b/pkg/services/alerting/conditions/query_test.go @@ -85,6 +85,18 @@ func TestQueryCondition(t *testing.T) { So(ctx.result.NoDataFound, ShouldBeTrue) }) + Convey("Should set NoDataFound both series contains null", func() { + one := float64(120) + ctx.series = tsdb.TimeSeriesSlice{ + tsdb.NewTimeSeries("test1", [][2]*float64{{nil, &one}}), + tsdb.NewTimeSeries("test2", [][2]*float64{{nil, &one}}), + } + ctx.exec() + + So(ctx.result.Error, ShouldBeNil) + So(ctx.result.NoDataFound, ShouldBeTrue) + }) + Convey("Should not set NoDataFound if one serie is empty", func() { one := float64(120) two := float64(0) diff --git a/pkg/services/alerting/scheduler.go b/pkg/services/alerting/scheduler.go index 6701ad6eb6c..9d20796f3dc 100644 --- a/pkg/services/alerting/scheduler.go +++ b/pkg/services/alerting/scheduler.go @@ -35,8 +35,9 @@ func (s *SchedulerImpl) Update(rules []*Rule) { } job.Rule = rule - job.Offset = ((rule.Frequency * 1000) / int64(len(rules))) * int64(i) - job.Offset = int64(math.Floor(float64(job.Offset) / 1000)) + + offset := ((rule.Frequency * 1000) / int64(len(rules))) * int64(i) + job.Offset = int64(math.Floor(float64(offset) / 1000)) jobs[rule.Id] = job } diff --git a/public/app/plugins/panel/alertlist/editor.html b/public/app/plugins/panel/alertlist/editor.html index ad946202432..b75a7e453aa 100644 --- a/public/app/plugins/panel/alertlist/editor.html +++ b/public/app/plugins/panel/alertlist/editor.html @@ -22,8 +22,8 @@
- -
+ +
diff --git a/public/app/plugins/panel/alertlist/module.ts b/public/app/plugins/panel/alertlist/module.ts index f5ba0c61aa8..96d7ad18e7c 100644 --- a/public/app/plugins/panel/alertlist/module.ts +++ b/public/app/plugins/panel/alertlist/module.ts @@ -14,7 +14,7 @@ class AlertListPanel extends PanelCtrl { showOptions = [ {text: 'Current state', value: 'current'}, - {text: 'State changes', value: 'changes'} + {text: 'Recent state changes', value: 'changes'} ]; stateFilter: any = {}; @@ -71,6 +71,9 @@ class AlertListPanel extends PanelCtrl { newState: this.panel.stateFilter }; + params.from = dateMath.parse(this.dashboard.time.from).unix() * 1000; + params.to = dateMath.parse(this.dashboard.time.to).unix() * 1000; + this.backendSrv.get(`/api/annotations`, params) .then(res => { this.alertHistory = _.map(res, al => { diff --git a/public/app/plugins/panel/graph/graph.js b/public/app/plugins/panel/graph/graph.js index bb51c88cd10..69154ffed65 100755 --- a/public/app/plugins/panel/graph/graph.js +++ b/public/app/plugins/panel/graph/graph.js @@ -339,6 +339,75 @@ function (angular, $, moment, _, kbn, GraphTooltip, thresholdManExports) { }; } + //Override min/max to provide more flexible autoscaling + function autoscaleSpanOverride(yaxis, data, options) { + var expr; + if (yaxis.min != null && data != null) { + expr = parseThresholdExpr(yaxis.min); + options.min = autoscaleYAxisMin(expr, data.stats); + } + if (yaxis.max != null && data != null) { + expr = parseThresholdExpr(yaxis.max); + options.max = autoscaleYAxisMax(expr, data.stats); + } + } + + function parseThresholdExpr(expr) { + var match, operator, value, precision; + match = expr.match(/\s*([<=>~]*)\W*(\d+(\.\d+)?)/); + if (match) { + operator = match[1]; + value = parseFloat(match[2]); + //Precision based on input + precision = match[3] ? match[3].length - 1 : 0; + return { + operator: operator, + value: value, + precision: precision + }; + } else { + return undefined; + } + } + + function autoscaleYAxisMax(expr, dataStats) { + var operator = expr.operator, + value = expr.value, + precision = expr.precision; + if (operator === ">") { + return dataStats.max < value ? value : null; + } else if (operator === "<") { + return dataStats.max > value ? value : null; + } else if (operator === "~") { + return kbn.roundValue(dataStats.avg + value, precision); + } else if (operator === "=") { + return kbn.roundValue(dataStats.current + value, precision); + } else if (!operator && !isNaN(value)) { + return kbn.roundValue(value, precision); + } else { + return null; + } + } + + function autoscaleYAxisMin(expr, dataStats) { + var operator = expr.operator, + value = expr.value, + precision = expr.precision; + if (operator === ">") { + return dataStats.min < value ? value : null; + } else if (operator === "<") { + return dataStats.min > value ? value : null; + } else if (operator === "~") { + return kbn.roundValue(dataStats.avg - value, precision); + } else if (operator === "=") { + return kbn.roundValue(dataStats.current - value, precision); + } else if (!operator && !isNaN(value)) { + return kbn.roundValue(value, precision); + } else { + return null; + } + } + function configureAxisOptions(data, options) { var defaults = { position: 'left', @@ -349,6 +418,7 @@ function (angular, $, moment, _, kbn, GraphTooltip, thresholdManExports) { max: panel.percentage && panel.stack ? 100 : panel.yaxes[0].max, }; + autoscaleSpanOverride(panel.yaxes[0], data[0], defaults); options.yaxes.push(defaults); if (_.find(data, {yaxis: 2})) { @@ -359,6 +429,7 @@ function (angular, $, moment, _, kbn, GraphTooltip, thresholdManExports) { secondY.position = 'right'; secondY.min = panel.yaxes[1].min; secondY.max = panel.percentage && panel.stack ? 100 : panel.yaxes[1].max; + autoscaleSpanOverride(panel.yaxes[1], data[1], secondY); options.yaxes.push(secondY); applyLogScale(options.yaxes[1], data); diff --git a/public/app/plugins/panel/graph/specs/graph_specs.ts b/public/app/plugins/panel/graph/specs/graph_specs.ts index 633832d4866..10c81b7212d 100644 --- a/public/app/plugins/panel/graph/specs/graph_specs.ts +++ b/public/app/plugins/panel/graph/specs/graph_specs.ts @@ -218,4 +218,99 @@ describe('grafanaGraph', function() { }); }, 10); + + graphScenario('when using flexible Y-Min and Y-Max settings', function(ctx) { + describe('and Y-Min is <100 and Y-Max is >200 and values within range', function() { + ctx.setup(function(ctrl, data) { + ctrl.panel.yaxes[0].min = '<100'; + ctrl.panel.yaxes[0].max = '>200'; + data[0] = new TimeSeries({ + datapoints: [[120,10],[160,20]], + alias: 'series1', + }); + }); + + it('should set min to 100 and max to 200', function() { + expect(ctx.plotOptions.yaxes[0].min).to.be(100); + expect(ctx.plotOptions.yaxes[0].max).to.be(200); + }); + }); + describe('and Y-Min is <100 and Y-Max is >200 and values outside range', function() { + ctx.setup(function(ctrl, data) { + ctrl.panel.yaxes[0].min = '<100'; + ctrl.panel.yaxes[0].max = '>200'; + data[0] = new TimeSeries({ + datapoints: [[99,10],[201,20]], + alias: 'series1', + }); + }); + + it('should set min to auto and max to auto', function() { + expect(ctx.plotOptions.yaxes[0].min).to.be(null); + expect(ctx.plotOptions.yaxes[0].max).to.be(null); + }); + }); + describe('and Y-Min is =10.5 and Y-Max is =10.5', function() { + ctx.setup(function(ctrl, data) { + ctrl.panel.yaxes[0].min = '=10.5'; + ctrl.panel.yaxes[0].max = '=10.5'; + data[0] = new TimeSeries({ + datapoints: [[100,10],[120,20], [110,30]], + alias: 'series1', + }); + }); + + it('should set min to last value + 10.5 and max to last value + 10.5', function() { + expect(ctx.plotOptions.yaxes[0].min).to.be(99.5); + expect(ctx.plotOptions.yaxes[0].max).to.be(120.5); + }); + }); + describe('and Y-Min is ~10.5 and Y-Max is ~10.5', function() { + ctx.setup(function(ctrl, data) { + ctrl.panel.yaxes[0].min = '~10.5'; + ctrl.panel.yaxes[0].max = '~10.5'; + data[0] = new TimeSeries({ + datapoints: [[102,10],[104,20], [110,30]], //Also checks precision + alias: 'series1', + }); + }); + + it('should set min to average value + 10.5 and max to average value + 10.5', function() { + expect(ctx.plotOptions.yaxes[0].min).to.be(94.8); + expect(ctx.plotOptions.yaxes[0].max).to.be(115.8); + }); + }); + }); + graphScenario('when using regular Y-Min and Y-Max settings', function(ctx) { + describe('and Y-Min is 100 and Y-Max is 200', function() { + ctx.setup(function(ctrl, data) { + ctrl.panel.yaxes[0].min = '100'; + ctrl.panel.yaxes[0].max = '200'; + data[0] = new TimeSeries({ + datapoints: [[120,10],[160,20]], + alias: 'series1', + }); + }); + + it('should set min to 100 and max to 200', function() { + expect(ctx.plotOptions.yaxes[0].min).to.be(100); + expect(ctx.plotOptions.yaxes[0].max).to.be(200); + }); + }); + describe('and Y-Min is 0 and Y-Max is 0', function() { + ctx.setup(function(ctrl, data) { + ctrl.panel.yaxes[0].min = '0'; + ctrl.panel.yaxes[0].max = '0'; + data[0] = new TimeSeries({ + datapoints: [[120,10],[160,20]], + alias: 'series1', + }); + }); + + it('should set min to 0 and max to 0', function() { + expect(ctx.plotOptions.yaxes[0].min).to.be(0); + expect(ctx.plotOptions.yaxes[0].max).to.be(0); + }); + }); + }); }); diff --git a/public/app/plugins/panel/graph/tab_axes.html b/public/app/plugins/panel/graph/tab_axes.html index bb051649424..e85e266dd7d 100644 --- a/public/app/plugins/panel/graph/tab_axes.html +++ b/public/app/plugins/panel/graph/tab_axes.html @@ -22,11 +22,11 @@
- +
- +
diff --git a/tasks/build_task.js b/tasks/build_task.js index 3ace8514164..4a6c208c1c6 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -59,7 +59,7 @@ module.exports = function(grunt) { }); grunt.config('copy.backend_files', { expand: true, - src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'], + src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/phantomjs/*', 'scripts/*'], options: { mode: true}, dest: '<%= tempDir %>' }); 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/assertions/CONTRIBUTING.md b/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md new file mode 100644 index 00000000000..1820ecb3310 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md @@ -0,0 +1,12 @@ +# Contributing + +In general, the code posted to the [SmartyStreets github organization](https://github.com/smartystreets) is created to solve specific problems at SmartyStreets that are ancillary to our core products in the address verification industry and may or may not be useful to other organizations or developers. Our reason for posting said code isn't necessarily to solicit feedback or contributions from the community but more as a showcase of some of the approaches to solving problems we have adopted. + +Having stated that, we do consider issues raised by other githubbers as well as contributions submitted via pull requests. When submitting such a pull request, please follow these guidelines: + +- _Look before you leap:_ If the changes you plan to make are significant, it's in everyone's best interest for you to discuss them with a SmartyStreets team member prior to opening a pull request. +- _License and ownership:_ If modifying the `LICENSE.md` file, limit your changes to fixing typographical mistakes. Do NOT modify the actual terms in the license or the copyright by **SmartyStreets, LLC**. Code submitted to SmartyStreets projects becomes property of SmartyStreets and must be compatible with the associated license. +- _Testing:_ If the code you are submitting resides in packages/modules covered by automated tests, be sure to add passing tests that cover your changes and assert expected behavior and state. Submit the additional test cases as part of your change set. +- _Style:_ Match your approach to **naming** and **formatting** with the surrounding code. Basically, the code you submit shouldn't stand out. + - "Naming" refers to such constructs as variables, methods, functions, classes, structs, interfaces, packages, modules, directories, files, etc... + - "Formatting" refers to such constructs as whitespace, horizontal line length, vertical function length, vertical file length, indentation, curly braces, etc... diff --git a/vendor/github.com/smartystreets/assertions/LICENSE.md b/vendor/github.com/smartystreets/assertions/LICENSE.md new file mode 100644 index 00000000000..8ea6f945521 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/LICENSE.md @@ -0,0 +1,23 @@ +Copyright (c) 2016 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/assertions/README.md b/vendor/github.com/smartystreets/assertions/README.md new file mode 100644 index 00000000000..58383bb00af --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/README.md @@ -0,0 +1,575 @@ +# assertions +-- + import "github.com/smartystreets/assertions" + +Package assertions contains the implementations for all assertions which are +referenced in goconvey's `convey` package +(github.com/smartystreets/goconvey/convey) and gunit +(github.com/smartystreets/gunit) for use with the So(...) method. They can also +be used in traditional Go test functions and even in applications. + +Many of the assertions lean heavily on work done by Aaron Jacobs in his +excellent oglematchers library. (https://github.com/jacobsa/oglematchers) The +ShouldResemble assertion leans heavily on work done by Daniel Jacques in his +very helpful go-render library. (https://github.com/luci/go-render) + +## Usage + +#### func GoConveyMode + +```go +func GoConveyMode(yes bool) +``` +GoConveyMode provides control over JSON serialization of failures. When using +the assertions in this package from the convey package JSON results are very +helpful and can be rendered in a DIFF view. In that case, this function will be +called with a true value to enable the JSON serialization. By default, the +assertions in this package will not serializer a JSON result, making standalone +ussage more convenient. + +#### func ShouldAlmostEqual + +```go +func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string +``` +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 ShouldBeBetween + +```go +func ShouldBeBetween(actual interface{}, expected ...interface{}) string +``` +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 ShouldBeBetweenOrEqual + +```go +func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string +``` +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 ShouldBeBlank + +```go +func ShouldBeBlank(actual interface{}, expected ...interface{}) string +``` +ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal +to "". + +#### func ShouldBeChronological + +```go +func ShouldBeChronological(actual interface{}, expected ...interface{}) string +``` +ShouldBeChronological receives a []time.Time slice and asserts that the are in +chronological order starting with the first time.Time as the earliest. + +#### func ShouldBeEmpty + +```go +func ShouldBeEmpty(actual interface{}, expected ...interface{}) string +``` +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 ShouldBeFalse + +```go +func ShouldBeFalse(actual interface{}, expected ...interface{}) string +``` +ShouldBeFalse receives a single parameter and ensures that it is false. + +#### func ShouldBeGreaterThan + +```go +func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string +``` +ShouldBeGreaterThan receives exactly two parameters and ensures that the first +is greater than the second. + +#### func ShouldBeGreaterThanOrEqualTo + +```go +func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string +``` +ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that +the first is greater than or equal to the second. + +#### func ShouldBeIn + +```go +func ShouldBeIn(actual interface{}, expected ...interface{}) string +``` +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 ShouldBeLessThan + +```go +func ShouldBeLessThan(actual interface{}, expected ...interface{}) string +``` +ShouldBeLessThan receives exactly two parameters and ensures that the first is +less than the second. + +#### func ShouldBeLessThanOrEqualTo + +```go +func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string +``` +ShouldBeLessThan receives exactly two parameters and ensures that the first is +less than or equal to the second. + +#### func ShouldBeNil + +```go +func ShouldBeNil(actual interface{}, expected ...interface{}) string +``` +ShouldBeNil receives a single parameter and ensures that it is nil. + +#### func ShouldBeTrue + +```go +func ShouldBeTrue(actual interface{}, expected ...interface{}) string +``` +ShouldBeTrue receives a single parameter and ensures that it is true. + +#### func ShouldBeZeroValue + +```go +func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string +``` +ShouldBeZeroValue receives a single parameter and ensures that it is the Go +equivalent of the default value, or "zero" value. + +#### func ShouldContain + +```go +func ShouldContain(actual interface{}, expected ...interface{}) string +``` +ShouldContain receives exactly two parameters. The first is a slice and the +second is a proposed member. Membership is determined using ShouldEqual. + +#### func ShouldContainKey + +```go +func ShouldContainKey(actual interface{}, expected ...interface{}) string +``` +ShouldContainKey receives exactly two parameters. The first is a map and the +second is a proposed key. Keys are compared with a simple '=='. + +#### func ShouldContainSubstring + +```go +func ShouldContainSubstring(actual interface{}, expected ...interface{}) string +``` +ShouldContainSubstring receives exactly 2 string parameters and ensures that the +first contains the second as a substring. + +#### func ShouldEndWith + +```go +func ShouldEndWith(actual interface{}, expected ...interface{}) string +``` +ShouldEndWith receives exactly 2 string parameters and ensures that the first +ends with the second. + +#### func ShouldEqual + +```go +func ShouldEqual(actual interface{}, expected ...interface{}) string +``` +ShouldEqual receives exactly two parameters and does an equality check. + +#### func ShouldEqualTrimSpace + +```go +func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) string +``` +ShouldEqualTrimSpace receives exactly 2 string parameters and ensures that the +first is equal to the second after removing all leading and trailing whitespace +using strings.TrimSpace(first). + +#### func ShouldEqualWithout + +```go +func ShouldEqualWithout(actual interface{}, expected ...interface{}) string +``` +ShouldEqualWithout receives exactly 3 string parameters and ensures that the +first is equal to the second after removing all instances of the third from the +first using strings.Replace(first, third, "", -1). + +#### func ShouldHappenAfter + +```go +func ShouldHappenAfter(actual interface{}, expected ...interface{}) string +``` +ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the +first happens after the second. + +#### func ShouldHappenBefore + +```go +func ShouldHappenBefore(actual interface{}, expected ...interface{}) string +``` +ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the +first happens before the second. + +#### func ShouldHappenBetween + +```go +func ShouldHappenBetween(actual interface{}, expected ...interface{}) string +``` +ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the +first happens between (not on) the second and third. + +#### func ShouldHappenOnOrAfter + +```go +func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string +``` +ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that +the first happens on or after the second. + +#### func ShouldHappenOnOrBefore + +```go +func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string +``` +ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that +the first happens on or before the second. + +#### func ShouldHappenOnOrBetween + +```go +func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string +``` +ShouldHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that +the first happens between or on the second and third. + +#### func ShouldHappenWithin + +```go +func ShouldHappenWithin(actual interface{}, expected ...interface{}) string +``` +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 ShouldHaveLength + +```go +func ShouldHaveLength(actual interface{}, expected ...interface{}) string +``` +ShouldHaveLength receives 2 parameters. The first is a collection to check the +length of, the second being the expected length. It obeys the rules specified by +the len function for determining length: http://golang.org/pkg/builtin/#len + +#### func ShouldHaveSameTypeAs + +```go +func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string +``` +ShouldHaveSameTypeAs receives exactly two parameters and compares their +underlying types for equality. + +#### func ShouldImplement + +```go +func ShouldImplement(actual interface{}, expectedList ...interface{}) string +``` +ShouldImplement receives exactly two parameters and ensures that the first +implements the interface type of the second. + +#### func ShouldNotAlmostEqual + +```go +func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string +``` +ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual + +#### func ShouldNotBeBetween + +```go +func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string +``` +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 ShouldNotBeBetweenOrEqual + +```go +func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string +``` +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 ShouldNotBeBlank + +```go +func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string +``` +ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is +equal to "". + +#### func ShouldNotBeEmpty + +```go +func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string +``` +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 ShouldNotBeIn + +```go +func ShouldNotBeIn(actual interface{}, expected ...interface{}) string +``` +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 ShouldNotBeNil + +```go +func ShouldNotBeNil(actual interface{}, expected ...interface{}) string +``` +ShouldNotBeNil receives a single parameter and ensures that it is not nil. + +#### func ShouldNotContain + +```go +func ShouldNotContain(actual interface{}, expected ...interface{}) string +``` +ShouldNotContain receives exactly two parameters. The first is a slice and the +second is a proposed member. Membership is determinied using ShouldEqual. + +#### func ShouldNotContainKey + +```go +func ShouldNotContainKey(actual interface{}, expected ...interface{}) string +``` +ShouldNotContainKey receives exactly two parameters. The first is a map and the +second is a proposed absent key. Keys are compared with a simple '=='. + +#### func ShouldNotContainSubstring + +```go +func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string +``` +ShouldNotContainSubstring receives exactly 2 string parameters and ensures that +the first does NOT contain the second as a substring. + +#### func ShouldNotEndWith + +```go +func ShouldNotEndWith(actual interface{}, expected ...interface{}) string +``` +ShouldEndWith receives exactly 2 string parameters and ensures that the first +does not end with the second. + +#### func ShouldNotEqual + +```go +func ShouldNotEqual(actual interface{}, expected ...interface{}) string +``` +ShouldNotEqual receives exactly two parameters and does an inequality check. + +#### func ShouldNotHappenOnOrBetween + +```go +func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string +``` +ShouldNotHappenOnOrBetween receives exactly 3 time.Time arguments and asserts +that the first does NOT happen between or on the second or third. + +#### func ShouldNotHappenWithin + +```go +func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string +``` +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 ShouldNotHaveSameTypeAs + +```go +func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string +``` +ShouldNotHaveSameTypeAs receives exactly two parameters and compares their +underlying types for inequality. + +#### func ShouldNotImplement + +```go +func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string +``` +ShouldNotImplement receives exactly two parameters and ensures that the first +does NOT implement the interface type of the second. + +#### func ShouldNotPanic + +```go +func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string) +``` +ShouldNotPanic receives a void, niladic function and expects to execute the +function without any panic. + +#### func ShouldNotPanicWith + +```go +func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string) +``` +ShouldNotPanicWith receives a void, niladic function and expects to recover a +panic whose content differs from the second argument. + +#### func ShouldNotPointTo + +```go +func ShouldNotPointTo(actual interface{}, expected ...interface{}) string +``` +ShouldNotPointTo receives exactly two parameters and checks to see that they +point to different addresess. + +#### func ShouldNotResemble + +```go +func ShouldNotResemble(actual interface{}, expected ...interface{}) string +``` +ShouldNotResemble receives exactly two parameters and does an inverse deep equal +check (see reflect.DeepEqual) + +#### func ShouldNotStartWith + +```go +func ShouldNotStartWith(actual interface{}, expected ...interface{}) string +``` +ShouldNotStartWith receives exactly 2 string parameters and ensures that the +first does not start with the second. + +#### func ShouldPanic + +```go +func ShouldPanic(actual interface{}, expected ...interface{}) (message string) +``` +ShouldPanic receives a void, niladic function and expects to recover a panic. + +#### func ShouldPanicWith + +```go +func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string) +``` +ShouldPanicWith receives a void, niladic function and expects to recover a panic +with the second argument as the content. + +#### func ShouldPointTo + +```go +func ShouldPointTo(actual interface{}, expected ...interface{}) string +``` +ShouldPointTo receives exactly two parameters and checks to see that they point +to the same address. + +#### func ShouldResemble + +```go +func ShouldResemble(actual interface{}, expected ...interface{}) string +``` +ShouldResemble receives exactly two parameters and does a deep equal check (see +reflect.DeepEqual) + +#### func ShouldStartWith + +```go +func ShouldStartWith(actual interface{}, expected ...interface{}) string +``` +ShouldStartWith receives exactly 2 string parameters and ensures that the first +starts with the second. + +#### func So + +```go +func So(actual interface{}, assert assertion, expected ...interface{}) (bool, string) +``` +So is a convenience function (as opposed to an inconvenience function?) for +running assertions on arbitrary arguments in any context, be it for testing or +even application logging. It allows you to perform assertion-like behavior (and +get nicely formatted messages detailing discrepancies) but without the program +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) + } + +#### type Assertion + +```go +type Assertion struct { +} +``` + + +#### func New + +```go +func New(t testingT) *Assertion +``` +New swallows the *testing.T struct and prints failed assertions using t.Error. +Example: assertions.New(t).So(1, should.Equal, 1) + +#### func (*Assertion) Failed + +```go +func (this *Assertion) Failed() bool +``` +Failed reports whether any calls to So (on this Assertion instance) have failed. + +#### func (*Assertion) So + +```go +func (this *Assertion) So(actual interface{}, assert assertion, expected ...interface{}) bool +``` +So calls the standalone So function and additionally, calls t.Error in failure +scenarios. + +#### type FailureView + +```go +type FailureView struct { + Message string `json:"Message"` + Expected string `json:"Expected"` + Actual string `json:"Actual"` +} +``` + +This struct is also declared in +github.com/smartystreets/goconvey/convey/reporting. The json struct tags should +be equal in both declarations. + +#### type Serializer + +```go +type Serializer interface { + // contains filtered or unexported methods +} +``` diff --git a/vendor/github.com/smartystreets/assertions/assertions.goconvey b/vendor/github.com/smartystreets/assertions/assertions.goconvey new file mode 100644 index 00000000000..e76cf275d47 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/assertions.goconvey @@ -0,0 +1,3 @@ +#ignore +-timeout=1s +-coverpkg=github.com/smartystreets/assertions,github.com/smartystreets/assertions/internal/oglematchers \ No newline at end of file diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go b/vendor/github.com/smartystreets/assertions/collections.go similarity index 59% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go rename to vendor/github.com/smartystreets/assertions/collections.go index 5b326dccb83..d7f407e913f 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/collections.go +++ b/vendor/github.com/smartystreets/assertions/collections.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - "github.com/smartystreets/goconvey/convey/assertions/oglematchers" + "github.com/smartystreets/assertions/internal/oglematchers" ) // ShouldContain receives exactly two parameters. The first is a slice and the @@ -42,6 +42,61 @@ func ShouldNotContain(actual interface{}, expected ...interface{}) string { return fmt.Sprintf(shouldNotHaveContained, typeName, expected[0]) } +// ShouldContainKey receives exactly two parameters. The first is a map and the +// second is a proposed key. Keys are compared with a simple '=='. +func ShouldContainKey(actual interface{}, expected ...interface{}) string { + if fail := need(1, expected); fail != success { + return fail + } + + keys, isMap := mapKeys(actual) + if !isMap { + return fmt.Sprintf(shouldHaveBeenAValidMap, reflect.TypeOf(actual)) + } + + if !keyFound(keys, expected[0]) { + return fmt.Sprintf(shouldHaveContainedKey, reflect.TypeOf(actual), expected) + } + + return "" +} + +// ShouldNotContainKey receives exactly two parameters. The first is a map and the +// second is a proposed absent key. Keys are compared with a simple '=='. +func ShouldNotContainKey(actual interface{}, expected ...interface{}) string { + if fail := need(1, expected); fail != success { + return fail + } + + keys, isMap := mapKeys(actual) + if !isMap { + return fmt.Sprintf(shouldHaveBeenAValidMap, reflect.TypeOf(actual)) + } + + if keyFound(keys, expected[0]) { + return fmt.Sprintf(shouldNotHaveContainedKey, reflect.TypeOf(actual), expected) + } + + return "" +} + +func mapKeys(m interface{}) ([]reflect.Value, bool) { + value := reflect.ValueOf(m) + if value.Kind() != reflect.Map { + return nil, false + } + return value.MapKeys(), true +} +func keyFound(keys []reflect.Value, expectedKey interface{}) bool { + found := false + for _, key := range keys { + if key.Interface() == expectedKey { + found = true + } + } + return found +} + // 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 @@ -138,3 +193,52 @@ func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string { } return fmt.Sprintf(shouldNotHaveBeenEmpty, actual) } + +// ShouldHaveLength receives 2 parameters. The first is a collection to check +// the length of, the second being the expected length. It obeys the rules +// specified by the len function for determining length: +// http://golang.org/pkg/builtin/#len +func ShouldHaveLength(actual interface{}, expected ...interface{}) string { + if fail := need(1, expected); fail != success { + return fail + } + + var expectedLen int64 + lenValue := reflect.ValueOf(expected[0]) + switch lenValue.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + expectedLen = lenValue.Int() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + expectedLen = int64(lenValue.Uint()) + default: + return fmt.Sprintf(shouldHaveBeenAValidInteger, reflect.TypeOf(expected[0])) + } + + if expectedLen < 0 { + return fmt.Sprintf(shouldHaveBeenAValidLength, expected[0]) + } + + value := reflect.ValueOf(actual) + switch value.Kind() { + case reflect.Slice, + reflect.Chan, + reflect.Map, + reflect.String: + if int64(value.Len()) == expectedLen { + return success + } else { + return fmt.Sprintf(shouldHaveHadLength, actual, value.Len(), expectedLen) + } + case reflect.Ptr: + elem := value.Elem() + kind := elem.Kind() + if kind == reflect.Slice || kind == reflect.Array { + if int64(elem.Len()) == expectedLen { + return success + } else { + return fmt.Sprintf(shouldHaveHadLength, actual, elem.Len(), expectedLen) + } + } + } + return fmt.Sprintf(shouldHaveBeenAValidCollection, reflect.TypeOf(actual)) +} diff --git a/vendor/github.com/smartystreets/assertions/doc.go b/vendor/github.com/smartystreets/assertions/doc.go new file mode 100644 index 00000000000..5720fc298c6 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/doc.go @@ -0,0 +1,105 @@ +// Package assertions contains the implementations for all assertions which +// are referenced in goconvey's `convey` package +// (github.com/smartystreets/goconvey/convey) and gunit (github.com/smartystreets/gunit) +// for use with the So(...) method. +// They can also be used in traditional Go test functions and even in +// applications. +// +// Many of the assertions lean heavily on work done by Aaron Jacobs in his excellent oglematchers library. +// (https://github.com/jacobsa/oglematchers) +// The ShouldResemble assertion leans heavily on work done by Daniel Jacques in his very helpful go-render library. +// (https://github.com/luci/go-render) +package assertions + +import ( + "fmt" + "runtime" +) + +// By default we use a no-op serializer. The actual Serializer provides a JSON +// representation of failure results on selected assertions so the goconvey +// web UI can display a convenient diff. +var serializer Serializer = new(noopSerializer) + +// GoConveyMode provides control over JSON serialization of failures. When +// using the assertions in this package from the convey package JSON results +// are very helpful and can be rendered in a DIFF view. In that case, this function +// will be called with a true value to enable the JSON serialization. By default, +// the assertions in this package will not serializer a JSON result, making +// standalone ussage more convenient. +func GoConveyMode(yes bool) { + if yes { + serializer = newSerializer() + } else { + serializer = new(noopSerializer) + } +} + +type testingT interface { + Error(args ...interface{}) +} + +type Assertion struct { + t testingT + failed bool +} + +// New swallows the *testing.T struct and prints failed assertions using t.Error. +// Example: assertions.New(t).So(1, should.Equal, 1) +func New(t testingT) *Assertion { + return &Assertion{t: t} +} + +// Failed reports whether any calls to So (on this Assertion instance) have failed. +func (this *Assertion) Failed() bool { + return this.failed +} + +// So calls the standalone So function and additionally, calls t.Error in failure scenarios. +func (this *Assertion) So(actual interface{}, assert assertion, expected ...interface{}) bool { + ok, result := So(actual, assert, expected...) + if !ok { + this.failed = true + _, file, line, _ := runtime.Caller(1) + this.t.Error(fmt.Sprintf("\n%s:%d\n%s", file, line, result)) + } + return ok +} + +// So is a convenience function (as opposed to an inconvenience function?) +// for running assertions on arbitrary arguments in any context, be it for testing or even +// application logging. It allows you to perform assertion-like behavior (and get nicely +// formatted messages detailing discrepancies) but without the program 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) { + 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/assertions/equality.go similarity index 91% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/equality.go rename to vendor/github.com/smartystreets/assertions/equality.go index 9354e493978..2b6049c37d9 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/equality.go +++ b/vendor/github.com/smartystreets/assertions/equality.go @@ -7,7 +7,8 @@ import ( "reflect" "strings" - "github.com/smartystreets/goconvey/convey/assertions/oglematchers" + "github.com/smartystreets/assertions/internal/oglematchers" + "github.com/smartystreets/assertions/internal/go-render/render" ) // default acceptable delta for ShouldAlmostEqual @@ -29,7 +30,14 @@ func shouldEqual(actual, expected interface{}) (message string) { }() if matchError := oglematchers.Equals(expected).Matches(actual); matchError != nil { - message = serializer.serialize(expected, actual, fmt.Sprintf(shouldHaveBeenEqual, expected, actual)) + expectedSyntax := fmt.Sprintf("%v", expected) + actualSyntax := fmt.Sprintf("%v", actual) + if expectedSyntax == actualSyntax && reflect.TypeOf(expected) != reflect.TypeOf(actual) { + message = fmt.Sprintf(shouldHaveBeenEqualTypeMismatch, expected, expected, actual, actual) + } else { + message = fmt.Sprintf(shouldHaveBeenEqual, expected, actual) + } + message = serializer.serialize(expected, actual, message) return } @@ -142,15 +150,8 @@ func ShouldResemble(actual interface{}, expected ...interface{}) string { } 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 serializer.serializeDetailed(expected[0], actual, + fmt.Sprintf(shouldHaveResembled, render.Render(expected[0]), render.Render(actual))) } return success @@ -161,7 +162,7 @@ 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 fmt.Sprintf(shouldNotHaveResembled, render.Render(actual), render.Render(expected[0])) } return success } diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go b/vendor/github.com/smartystreets/assertions/filter.go similarity index 55% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go rename to vendor/github.com/smartystreets/assertions/filter.go index 872e58c5407..ee368a97ed7 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/filter.go +++ b/vendor/github.com/smartystreets/assertions/filter.go @@ -3,8 +3,9 @@ package assertions import "fmt" const ( - success = "" - needExactValues = "This assertion requires exactly %d comparison values (you provided %d)." + success = "" + needExactValues = "This assertion requires exactly %d comparison values (you provided %d)." + needNonEmptyCollection = "This assertion requires at least 1 comparison value (you provided 0)." ) func need(needed int, expected []interface{}) string { @@ -16,7 +17,7 @@ func need(needed int, expected []interface{}) string { func atLeast(minimum int, expected []interface{}) string { if len(expected) < 1 { - return shouldHaveProvidedCollectionMembers + return needNonEmptyCollection } return success } diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE b/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE new file mode 100644 index 00000000000..6280ff0e06b --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE @@ -0,0 +1,27 @@ +// Copyright (c) 2015 The Chromium Authors. 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// 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/smartystreets/assertions/internal/go-render/render/render.go b/vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go new file mode 100644 index 00000000000..23b7a586761 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go @@ -0,0 +1,477 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package render + +import ( + "bytes" + "fmt" + "reflect" + "sort" + "strconv" +) + +var builtinTypeMap = map[reflect.Kind]string{ + reflect.Bool: "bool", + reflect.Complex128: "complex128", + reflect.Complex64: "complex64", + reflect.Float32: "float32", + reflect.Float64: "float64", + reflect.Int16: "int16", + reflect.Int32: "int32", + reflect.Int64: "int64", + reflect.Int8: "int8", + reflect.Int: "int", + reflect.String: "string", + reflect.Uint16: "uint16", + reflect.Uint32: "uint32", + reflect.Uint64: "uint64", + reflect.Uint8: "uint8", + reflect.Uint: "uint", + reflect.Uintptr: "uintptr", +} + +var builtinTypeSet = map[string]struct{}{} + +func init() { + for _, v := range builtinTypeMap { + builtinTypeSet[v] = struct{}{} + } +} + +var typeOfString = reflect.TypeOf("") +var typeOfInt = reflect.TypeOf(int(1)) +var typeOfUint = reflect.TypeOf(uint(1)) +var typeOfFloat = reflect.TypeOf(10.1) + +// Render converts a structure to a string representation. Unline the "%#v" +// format string, this resolves pointer types' contents in structs, maps, and +// slices/arrays and prints their field values. +func Render(v interface{}) string { + buf := bytes.Buffer{} + s := (*traverseState)(nil) + s.render(&buf, 0, reflect.ValueOf(v), false) + return buf.String() +} + +// renderPointer is called to render a pointer value. +// +// This is overridable so that the test suite can have deterministic pointer +// values in its expectations. +var renderPointer = func(buf *bytes.Buffer, p uintptr) { + fmt.Fprintf(buf, "0x%016x", p) +} + +// traverseState is used to note and avoid recursion as struct members are being +// traversed. +// +// traverseState is allowed to be nil. Specifically, the root state is nil. +type traverseState struct { + parent *traverseState + ptr uintptr +} + +func (s *traverseState) forkFor(ptr uintptr) *traverseState { + for cur := s; cur != nil; cur = cur.parent { + if ptr == cur.ptr { + return nil + } + } + + fs := &traverseState{ + parent: s, + ptr: ptr, + } + return fs +} + +func (s *traverseState) render(buf *bytes.Buffer, ptrs int, v reflect.Value, implicit bool) { + if v.Kind() == reflect.Invalid { + buf.WriteString("nil") + return + } + vt := v.Type() + + // If the type being rendered is a potentially recursive type (a type that + // can contain itself as a member), we need to avoid recursion. + // + // If we've already seen this type before, mark that this is the case and + // write a recursion placeholder instead of actually rendering it. + // + // If we haven't seen it before, fork our `seen` tracking so any higher-up + // renderers will also render it at least once, then mark that we've seen it + // to avoid recursing on lower layers. + pe := uintptr(0) + vk := vt.Kind() + switch vk { + case reflect.Ptr: + // Since structs and arrays aren't pointers, they can't directly be + // recursed, but they can contain pointers to themselves. Record their + // pointer to avoid this. + switch v.Elem().Kind() { + case reflect.Struct, reflect.Array: + pe = v.Pointer() + } + + case reflect.Slice, reflect.Map: + pe = v.Pointer() + } + if pe != 0 { + s = s.forkFor(pe) + if s == nil { + buf.WriteString("") + return + } + } + + isAnon := func(t reflect.Type) bool { + if t.Name() != "" { + if _, ok := builtinTypeSet[t.Name()]; !ok { + return false + } + } + return t.Kind() != reflect.Interface + } + + switch vk { + case reflect.Struct: + if !implicit { + writeType(buf, ptrs, vt) + } + structAnon := vt.Name() == "" + buf.WriteRune('{') + for i := 0; i < vt.NumField(); i++ { + if i > 0 { + buf.WriteString(", ") + } + anon := structAnon && isAnon(vt.Field(i).Type) + + if !anon { + buf.WriteString(vt.Field(i).Name) + buf.WriteRune(':') + } + + s.render(buf, 0, v.Field(i), anon) + } + buf.WriteRune('}') + + case reflect.Slice: + if v.IsNil() { + if !implicit { + writeType(buf, ptrs, vt) + buf.WriteString("(nil)") + } else { + buf.WriteString("nil") + } + return + } + fallthrough + + case reflect.Array: + if !implicit { + writeType(buf, ptrs, vt) + } + anon := vt.Name() == "" && isAnon(vt.Elem()) + buf.WriteString("{") + for i := 0; i < v.Len(); i++ { + if i > 0 { + buf.WriteString(", ") + } + + s.render(buf, 0, v.Index(i), anon) + } + buf.WriteRune('}') + + case reflect.Map: + if !implicit { + writeType(buf, ptrs, vt) + } + if v.IsNil() { + buf.WriteString("(nil)") + } else { + buf.WriteString("{") + + mkeys := v.MapKeys() + tryAndSortMapKeys(vt, mkeys) + + kt := vt.Key() + keyAnon := typeOfString.ConvertibleTo(kt) || typeOfInt.ConvertibleTo(kt) || typeOfUint.ConvertibleTo(kt) || typeOfFloat.ConvertibleTo(kt) + valAnon := vt.Name() == "" && isAnon(vt.Elem()) + for i, mk := range mkeys { + if i > 0 { + buf.WriteString(", ") + } + + s.render(buf, 0, mk, keyAnon) + buf.WriteString(":") + s.render(buf, 0, v.MapIndex(mk), valAnon) + } + buf.WriteRune('}') + } + + case reflect.Ptr: + ptrs++ + fallthrough + case reflect.Interface: + if v.IsNil() { + writeType(buf, ptrs, v.Type()) + buf.WriteString("(nil)") + } else { + s.render(buf, ptrs, v.Elem(), false) + } + + case reflect.Chan, reflect.Func, reflect.UnsafePointer: + writeType(buf, ptrs, vt) + buf.WriteRune('(') + renderPointer(buf, v.Pointer()) + buf.WriteRune(')') + + default: + tstr := vt.String() + implicit = implicit || (ptrs == 0 && builtinTypeMap[vk] == tstr) + if !implicit { + writeType(buf, ptrs, vt) + buf.WriteRune('(') + } + + switch vk { + case reflect.String: + fmt.Fprintf(buf, "%q", v.String()) + case reflect.Bool: + fmt.Fprintf(buf, "%v", v.Bool()) + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + fmt.Fprintf(buf, "%d", v.Int()) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + fmt.Fprintf(buf, "%d", v.Uint()) + + case reflect.Float32, reflect.Float64: + fmt.Fprintf(buf, "%g", v.Float()) + + case reflect.Complex64, reflect.Complex128: + fmt.Fprintf(buf, "%g", v.Complex()) + } + + if !implicit { + buf.WriteRune(')') + } + } +} + +func writeType(buf *bytes.Buffer, ptrs int, t reflect.Type) { + parens := ptrs > 0 + switch t.Kind() { + case reflect.Chan, reflect.Func, reflect.UnsafePointer: + parens = true + } + + if parens { + buf.WriteRune('(') + for i := 0; i < ptrs; i++ { + buf.WriteRune('*') + } + } + + switch t.Kind() { + case reflect.Ptr: + if ptrs == 0 { + // This pointer was referenced from within writeType (e.g., as part of + // rendering a list), and so hasn't had its pointer asterisk accounted + // for. + buf.WriteRune('*') + } + writeType(buf, 0, t.Elem()) + + case reflect.Interface: + if n := t.Name(); n != "" { + buf.WriteString(t.String()) + } else { + buf.WriteString("interface{}") + } + + case reflect.Array: + buf.WriteRune('[') + buf.WriteString(strconv.FormatInt(int64(t.Len()), 10)) + buf.WriteRune(']') + writeType(buf, 0, t.Elem()) + + case reflect.Slice: + if t == reflect.SliceOf(t.Elem()) { + buf.WriteString("[]") + writeType(buf, 0, t.Elem()) + } else { + // Custom slice type, use type name. + buf.WriteString(t.String()) + } + + case reflect.Map: + if t == reflect.MapOf(t.Key(), t.Elem()) { + buf.WriteString("map[") + writeType(buf, 0, t.Key()) + buf.WriteRune(']') + writeType(buf, 0, t.Elem()) + } else { + // Custom map type, use type name. + buf.WriteString(t.String()) + } + + default: + buf.WriteString(t.String()) + } + + if parens { + buf.WriteRune(')') + } +} + +type cmpFn func(a, b reflect.Value) int + +type sortableValueSlice struct { + cmp cmpFn + elements []reflect.Value +} + +func (s sortableValueSlice) Len() int { + return len(s.elements) +} + +func (s sortableValueSlice) Less(i, j int) bool { + return s.cmp(s.elements[i], s.elements[j]) < 0 +} + +func (s sortableValueSlice) Swap(i, j int) { + s.elements[i], s.elements[j] = s.elements[j], s.elements[i] +} + +// cmpForType returns a cmpFn which sorts the data for some type t in the same +// order that a go-native map key is compared for equality. +func cmpForType(t reflect.Type) cmpFn { + switch t.Kind() { + case reflect.String: + return func(av, bv reflect.Value) int { + a, b := av.String(), bv.String() + if a < b { + return -1 + } else if a > b { + return 1 + } + return 0 + } + + case reflect.Bool: + return func(av, bv reflect.Value) int { + a, b := av.Bool(), bv.Bool() + if !a && b { + return -1 + } else if a && !b { + return 1 + } + return 0 + } + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return func(av, bv reflect.Value) int { + a, b := av.Int(), bv.Int() + if a < b { + return -1 + } else if a > b { + return 1 + } + return 0 + } + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, + reflect.Uint64, reflect.Uintptr, reflect.UnsafePointer: + return func(av, bv reflect.Value) int { + a, b := av.Uint(), bv.Uint() + if a < b { + return -1 + } else if a > b { + return 1 + } + return 0 + } + + case reflect.Float32, reflect.Float64: + return func(av, bv reflect.Value) int { + a, b := av.Float(), bv.Float() + if a < b { + return -1 + } else if a > b { + return 1 + } + return 0 + } + + case reflect.Interface: + return func(av, bv reflect.Value) int { + a, b := av.InterfaceData(), bv.InterfaceData() + if a[0] < b[0] { + return -1 + } else if a[0] > b[0] { + return 1 + } + if a[1] < b[1] { + return -1 + } else if a[1] > b[1] { + return 1 + } + return 0 + } + + case reflect.Complex64, reflect.Complex128: + return func(av, bv reflect.Value) int { + a, b := av.Complex(), bv.Complex() + if real(a) < real(b) { + return -1 + } else if real(a) > real(b) { + return 1 + } + if imag(a) < imag(b) { + return -1 + } else if imag(a) > imag(b) { + return 1 + } + return 0 + } + + case reflect.Ptr, reflect.Chan: + return func(av, bv reflect.Value) int { + a, b := av.Pointer(), bv.Pointer() + if a < b { + return -1 + } else if a > b { + return 1 + } + return 0 + } + + case reflect.Struct: + cmpLst := make([]cmpFn, t.NumField()) + for i := range cmpLst { + cmpLst[i] = cmpForType(t.Field(i).Type) + } + return func(a, b reflect.Value) int { + for i, cmp := range cmpLst { + if rslt := cmp(a.Field(i), b.Field(i)); rslt != 0 { + return rslt + } + } + return 0 + } + } + + return nil +} + +func tryAndSortMapKeys(mt reflect.Type, k []reflect.Value) { + if cmp := cmpForType(mt.Key()); cmp != nil { + sort.Sort(sortableValueSlice{cmp, k}) + } +} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/LICENSE b/vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/LICENSE rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown b/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md similarity index 67% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md index 28ec0793b69..215a2bb7a8b 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/README.markdown +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md @@ -1,3 +1,5 @@ +[![GoDoc](https://godoc.org/github.com/smartystreets/assertions/internal/oglematchers?status.svg)](https://godoc.org/github.com/smartystreets/assertions/internal/oglematchers) + `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 @@ -36,21 +38,21 @@ First, make sure you have installed Go 1.0.2 or newer. See Use the following command to install `oglematchers` and keep it up to date: - go get -u github.com/smartystreets/goconvey/convey/assertions/oglematchers + go get -u github.com/smartystreets/assertions/internal/oglematchers Documentation ------------- -See [here][reference] for documentation hosted on GoPkgDoc. Alternatively, you -can install the package and then use `go doc`: +See [here][reference] for documentation. Alternatively, you can install the +package and then use `godoc`: - go doc github.com/smartystreets/goconvey/convey/assertions/oglematchers + godoc github.com/smartystreets/assertions/internal/oglematchers -[reference]: http://gopkgdoc.appspot.com/pkg/github.com/smartystreets/goconvey/convey/assertions/oglematchers +[reference]: http://godoc.org/github.com/smartystreets/assertions/internal/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 +[ogletest]: http://github.com/smartystreets/assertions/internal/ogletest +[oglemock]: http://github.com/smartystreets/assertions/internal/oglemock diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/all_of.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/all_of.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/any.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/any.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go similarity index 97% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go index 080643adda7..2918b51f21a 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/any_of.go +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go @@ -47,7 +47,8 @@ func AnyOf(vals ...interface{}) Matcher { // matcher. wrapped := make([]Matcher, len(vals)) for i, v := range vals { - if reflect.TypeOf(v).Implements(matcherType) { + t := reflect.TypeOf(v) + if t != nil && t.Implements(matcherType) { wrapped[i] = v.(Matcher) } else { wrapped[i] = Equals(v) diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go similarity index 97% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go index 2f326dbc5d6..87f107d3921 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/contains.go +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go @@ -28,7 +28,7 @@ func Contains(x interface{}) Matcher { var ok bool if result.elementMatcher, ok = x.(Matcher); !ok { - result.elementMatcher = Equals(x) + result.elementMatcher = DeepEquals(x) } return &result diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/deep_equals.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/deep_equals.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/elements_are.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/elements_are.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go similarity index 92% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go index 164059e7c76..a510707b3c7 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/equals.go +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go @@ -24,8 +24,9 @@ import ( // 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: +// built-in comparison operator is legal (except for structs, which this +// matcher does not support), 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: @@ -49,11 +50,16 @@ import ( // // If you want a stricter matcher that contains no such cleverness, see // IdenticalTo instead. +// +// Arrays are supported by this matcher, but do not participate in the +// exceptions above. Two arrays compared with this matcher must have identical +// types, and their element type must itself be comparable according to Go's == +// operator. 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 { + // This matcher doesn't support structs. + if v.Kind() == reflect.Struct { panic(fmt.Sprintf("oglematchers.Equals: unsupported kind %v", v.Kind())) } @@ -80,7 +86,7 @@ func isSignedInteger(v reflect.Value) bool { func isUnsignedInteger(v reflect.Value) bool { k := v.Kind() - return k >= reflect.Uint && k <= reflect.Uint64 + return k >= reflect.Uint && k <= reflect.Uintptr } func isInteger(v reflect.Value) bool { @@ -307,19 +313,6 @@ func checkAgainstBool(e bool, c reflect.Value) (err error) { 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()) @@ -417,6 +410,25 @@ func checkAgainstString(e reflect.Value, c reflect.Value) (err error) { return } +func checkAgainstArray(e reflect.Value, c reflect.Value) (err error) { + // Create a description of e's type, e.g. "[2]int". + typeStr := fmt.Sprintf("%v", e.Type()) + + // Make sure c is the correct type. + if c.Type() != e.Type() { + err = NewFatalError(fmt.Sprintf("which is not %s", typeStr)) + return + } + + // Check for equality. + if e.Interface() != c.Interface() { + err = errors.New("") + return + } + + return +} + func checkAgainstUnsafePointer(e reflect.Value, c reflect.Value) (err error) { // Make sure c is a pointer. if c.Kind() != reflect.UnsafePointer { @@ -476,9 +488,6 @@ func (m *equalsMatcher) Matches(candidate interface{}) error { 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) @@ -509,6 +518,9 @@ func (m *equalsMatcher) Matches(candidate interface{}) error { case ek == reflect.String: return checkAgainstString(e, c) + case ek == reflect.Array: + return checkAgainstArray(e, c) + case ek == reflect.UnsafePointer: return checkAgainstUnsafePointer(e, c) diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/error.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/error.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/error.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/error.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_or_equal.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_or_equal.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_than.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/greater_than.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as.go new file mode 100644 index 00000000000..3b286f73218 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as.go @@ -0,0 +1,37 @@ +// Copyright 2015 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" +) + +// HasSameTypeAs returns a matcher that matches values with exactly the same +// type as the supplied prototype. +func HasSameTypeAs(p interface{}) Matcher { + expected := reflect.TypeOf(p) + pred := func(c interface{}) error { + actual := reflect.TypeOf(c) + if actual != expected { + return fmt.Errorf("which has type %v", actual) + } + + return nil + } + + return NewMatcher(pred, fmt.Sprintf("has type %v", expected)) +} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr.go similarity index 78% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr.go index a32c1cf708e..bf5bd6ae6d3 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/has_substr.go +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr.go @@ -25,18 +25,12 @@ import ( // HasSubstr returns a matcher that matches strings containing s as a // substring. func HasSubstr(s string) Matcher { - return &hasSubstrMatcher{s} + return NewMatcher( + func(c interface{}) error { return hasSubstr(s, c) }, + fmt.Sprintf("has substring \"%s\"", 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 { +func hasSubstr(needle string, c interface{}) error { v := reflect.ValueOf(c) if v.Kind() != reflect.String { return NewFatalError("which is not a string") @@ -44,7 +38,7 @@ func (m *hasSubstrMatcher) Matches(c interface{}) error { // Perform the substring search. haystack := v.String() - if strings.Contains(haystack, m.needle) { + if strings.Contains(haystack, needle) { return nil } diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/identical_to.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/identical_to.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_or_equal.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_or_equal.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_than.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/less_than.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go similarity index 89% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go index daf59d1d92a..78159a0727c 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matcher.go +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go @@ -17,8 +17,8 @@ // 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 +// This package is used by github.com/smartystreets/assertions/internal/ogletest and +// github.com/smartystreets/assertions/internal/oglemock, which may be more directly useful if you're not // writing your own testing package or defining your own matchers. package oglematchers @@ -26,6 +26,10 @@ package oglematchers // matches. For example, GreaterThan(17) matches all numeric values greater // than 17, and HasSubstr("taco") matches all strings with the substring // "taco". +// +// Matchers are typically exposed to tests via constructor functions like +// HasSubstr. In order to implement such a function you can either define your +// own matcher type or use NewMatcher. 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. diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp.go similarity index 96% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp.go index b7439a98435..1ed63f30c4e 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/matches_regexp.go +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp.go @@ -23,7 +23,7 @@ import ( ) // MatchesRegexp returns a matcher that matches strings and byte slices whose -// contents match the supplide regular expression. The semantics are those of +// contents match the supplied 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 { diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/new_matcher.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/new_matcher.go new file mode 100644 index 00000000000..c9d8398ee63 --- /dev/null +++ b/vendor/github.com/smartystreets/assertions/internal/oglematchers/new_matcher.go @@ -0,0 +1,43 @@ +// Copyright 2015 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 + +// Create a matcher with the given description and predicate function, which +// will be invoked to handle calls to Matchers. +// +// Using this constructor may be a convenience over defining your own type that +// implements Matcher if you do not need any logic in your Description method. +func NewMatcher( + predicate func(interface{}) error, + description string) Matcher { + return &predicateMatcher{ + predicate: predicate, + description: description, + } +} + +type predicateMatcher struct { + predicate func(interface{}) error + description string +} + +func (pm *predicateMatcher) Matches(c interface{}) error { + return pm.predicate(c) +} + +func (pm *predicateMatcher) Description() string { + return pm.description +} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/not.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/not.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/panics.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/panics.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/panics.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/panics.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/pointee.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/pointee.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/transform_description.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/oglematchers/transform_description.go rename to vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go b/vendor/github.com/smartystreets/assertions/messages.go similarity index 78% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go rename to vendor/github.com/smartystreets/assertions/messages.go index 7b6b3591024..9c57ab2b8b9 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/messages.go +++ b/vendor/github.com/smartystreets/assertions/messages.go @@ -3,10 +3,10 @@ package assertions const ( // equality shouldHaveBeenEqual = "Expected: '%v'\nActual: '%v'\n(Should be equal)" shouldNotHaveBeenEqual = "Expected '%v'\nto NOT equal '%v'\n(but it did)!" + shouldHaveBeenEqualTypeMismatch = "Expected: '%v' (%T)\nActual: '%v' (%T)\n(Should be equal, type mismatch)" 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')!" + shouldHaveResembled = "Expected: '%s'\nActual: '%s'\n(Should resemble)!" shouldNotHaveResembled = "Expected '%#v'\nto NOT resemble '%#v'\n(but it did)!" shouldBePointers = "Both arguments should be pointers " shouldHaveBeenNonNilPointer = shouldBePointers + "(the %s was %s)!" @@ -32,14 +32,19 @@ const ( // quantity comparisons ) 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)!" + shouldHaveContained = "Expected the container (%v) to contain: '%v' (but it didn't)!" + shouldNotHaveContained = "Expected the container (%v) NOT to contain: '%v' (but it did)!" + shouldHaveContainedKey = "Expected the %v to contain the key: %v (but it didn't)!" + shouldNotHaveContainedKey = "Expected the %v NOT to contain the key: %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)!" + shouldHaveBeenAValidMap = "You must provide a valid map type (was %v)!" + shouldHaveBeenEmpty = "Expected %+v to be empty (but it wasn't)!" + shouldNotHaveBeenEmpty = "Expected %+v to NOT be empty (but it was)!" + shouldHaveBeenAValidInteger = "You must provide a valid integer (was %v)!" + shouldHaveBeenAValidLength = "You must provide a valid positive integer (was %v)!" + shouldHaveHadLength = "Expected %+v (length: %v) to have length equal to '%v', but it wasn't!" ) const ( // strings @@ -47,10 +52,11 @@ const ( // strings 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)!" + shouldAllBeStrings = "All arguments to this assertion must be strings (you provided: %v)." 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)!" + shouldNotHaveContainedSubstring = "Expected '%s' NOT to contain substring '%s' (but it did)!" shouldHaveBeenBlank = "Expected '%s' to be blank (but it wasn't)!" shouldNotHaveBeenBlank = "Expected value to NOT be blank (but it was)!" ) diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/panic.go b/vendor/github.com/smartystreets/assertions/panic.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/panic.go rename to vendor/github.com/smartystreets/assertions/panic.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go b/vendor/github.com/smartystreets/assertions/quantity.go similarity index 97% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go rename to vendor/github.com/smartystreets/assertions/quantity.go index bd9eacd8a5c..f28b0a062ba 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/quantity.go +++ b/vendor/github.com/smartystreets/assertions/quantity.go @@ -3,7 +3,7 @@ package assertions import ( "fmt" - "github.com/smartystreets/goconvey/convey/assertions/oglematchers" + "github.com/smartystreets/assertions/internal/oglematchers" ) // ShouldBeGreaterThan receives exactly two parameters and ensures that the first is greater than the second. @@ -43,7 +43,7 @@ func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) stri 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 fmt.Sprintf(shouldHaveBeenLessOrEqual, actual, expected[0]) } return success } diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go b/vendor/github.com/smartystreets/assertions/serializer.go similarity index 66% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go rename to vendor/github.com/smartystreets/assertions/serializer.go index 90c4ae3451a..90ae3e3b692 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/serializer.go +++ b/vendor/github.com/smartystreets/assertions/serializer.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/smartystreets/goconvey/convey/reporting" + "github.com/smartystreets/assertions/internal/go-render/render" ) type Serializer interface { @@ -15,7 +15,11 @@ type Serializer interface { type failureSerializer struct{} func (self *failureSerializer) serializeDetailed(expected, actual interface{}, message string) string { - view := self.format(expected, actual, message, "%#v") + view := FailureView{ + Message: message, + Expected: render.Render(expected), + Actual: render.Render(actual), + } serialized, err := json.Marshal(view) if err != nil { return message @@ -24,7 +28,11 @@ func (self *failureSerializer) serializeDetailed(expected, actual interface{}, m } func (self *failureSerializer) serialize(expected, actual interface{}, message string) string { - view := self.format(expected, actual, message, "%+v") + view := FailureView{ + Message: message, + Expected: fmt.Sprintf("%+v", expected), + Actual: fmt.Sprintf("%+v", actual), + } serialized, err := json.Marshal(view) if err != nil { return message @@ -32,18 +40,20 @@ func (self *failureSerializer) serialize(expected, actual interface{}, message s 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{} } +/////////////////////////////////////////////////////////////////////////////// + +// This struct is also declared in github.com/smartystreets/goconvey/convey/reporting. +// The json struct tags should be equal in both declarations. +type FailureView struct { + Message string `json:"Message"` + Expected string `json:"Expected"` + Actual string `json:"Actual"` +} + /////////////////////////////////////////////////////// // noopSerializer just gives back the original message. This is useful when we are using diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go b/vendor/github.com/smartystreets/assertions/strings.go similarity index 77% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go rename to vendor/github.com/smartystreets/assertions/strings.go index 1b887b1191e..dbc3f04790e 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions/strings.go +++ b/vendor/github.com/smartystreets/assertions/strings.go @@ -181,3 +181,47 @@ func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string { } return success } + +// ShouldEqualWithout receives exactly 3 string parameters and ensures that the first is equal to the second +// after removing all instances of the third from the first using strings.Replace(first, third, "", -1). +func ShouldEqualWithout(actual interface{}, expected ...interface{}) string { + if fail := need(2, expected); fail != success { + return fail + } + actualString, ok1 := actual.(string) + expectedString, ok2 := expected[0].(string) + replace, ok3 := expected[1].(string) + + if !ok1 || !ok2 || !ok3 { + return fmt.Sprintf(shouldAllBeStrings, []reflect.Type{ + reflect.TypeOf(actual), + reflect.TypeOf(expected[0]), + reflect.TypeOf(expected[1]), + }) + } + + replaced := strings.Replace(actualString, replace, "", -1) + if replaced == expectedString { + return "" + } + + return fmt.Sprintf("Expected '%s' to equal '%s' but without any '%s' (but it didn't).", actualString, expectedString, replace) +} + +// ShouldEqualTrimSpace receives exactly 2 string parameters and ensures that the first is equal to the second +// after removing all leading and trailing whitespace using strings.TrimSpace(first). +func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) string { + if fail := need(1, expected); fail != success { + return fail + } + + actualString, valueIsString := actual.(string) + _, value2IsString := expected[0].(string) + + if !valueIsString || !value2IsString { + return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0])) + } + + actualString = strings.TrimSpace(actualString) + return ShouldEqual(actualString, expected[0]) +} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/time.go b/vendor/github.com/smartystreets/assertions/time.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/time.go rename to vendor/github.com/smartystreets/assertions/time.go diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions/type.go b/vendor/github.com/smartystreets/assertions/type.go similarity index 100% rename from vendor/github.com/smartystreets/goconvey/convey/assertions/type.go rename to vendor/github.com/smartystreets/assertions/type.go diff --git a/vendor/github.com/smartystreets/goconvey/LICENSE.md b/vendor/github.com/smartystreets/goconvey/LICENSE.md index 55b77008282..3f87a40e773 100644 --- a/vendor/github.com/smartystreets/goconvey/LICENSE.md +++ b/vendor/github.com/smartystreets/goconvey/LICENSE.md @@ -1,21 +1,21 @@ -Copyright (c) 2014 SmartyStreets, LLC +Copyright (c) 2016 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 +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 +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 +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 diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions.go b/vendor/github.com/smartystreets/goconvey/convey/assertions.go index a7c1028564f..1e87b826dff 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions.go +++ b/vendor/github.com/smartystreets/goconvey/convey/assertions.go @@ -1,6 +1,6 @@ package convey -import "github.com/smartystreets/goconvey/convey/assertions" +import "github.com/smartystreets/assertions" var ( ShouldEqual = assertions.ShouldEqual @@ -26,12 +26,15 @@ var ( ShouldBeBetweenOrEqual = assertions.ShouldBeBetweenOrEqual ShouldNotBeBetweenOrEqual = assertions.ShouldNotBeBetweenOrEqual - ShouldContain = assertions.ShouldContain - ShouldNotContain = assertions.ShouldNotContain - ShouldBeIn = assertions.ShouldBeIn - ShouldNotBeIn = assertions.ShouldNotBeIn - ShouldBeEmpty = assertions.ShouldBeEmpty - ShouldNotBeEmpty = assertions.ShouldNotBeEmpty + ShouldContain = assertions.ShouldContain + ShouldNotContain = assertions.ShouldNotContain + ShouldContainKey = assertions.ShouldContainKey + ShouldNotContainKey = assertions.ShouldNotContainKey + ShouldBeIn = assertions.ShouldBeIn + ShouldNotBeIn = assertions.ShouldNotBeIn + ShouldBeEmpty = assertions.ShouldBeEmpty + ShouldNotBeEmpty = assertions.ShouldNotBeEmpty + ShouldHaveLength = assertions.ShouldHaveLength ShouldStartWith = assertions.ShouldStartWith ShouldNotStartWith = assertions.ShouldNotStartWith 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/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/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/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/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/doc.go b/vendor/github.com/smartystreets/goconvey/convey/doc.go index 3670e4c5d2f..2562ce4c284 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/doc.go +++ b/vendor/github.com/smartystreets/goconvey/convey/doc.go @@ -3,6 +3,8 @@ // packages from this project as they serve internal purposes. package convey +import "github.com/smartystreets/goconvey/convey/reporting" + ////////////////////////////////// suite ////////////////////////////////// // C is the Convey context which you can optionally obtain in your action @@ -191,3 +193,26 @@ func Println(items ...interface{}) (written int, err error) { func Printf(format string, items ...interface{}) (written int, err error) { return mustGetCurrentContext().Printf(format, items...) } + +/////////////////////////////////////////////////////////////////////////////// + +// SuppressConsoleStatistics prevents automatic printing of console statistics. +// Calling PrintConsoleStatistics explicitly will force printing of statistics. +func SuppressConsoleStatistics() { + reporting.SuppressConsoleStatistics() +} + +// ConsoleStatistics may be called at any time to print assertion statistics. +// Generally, the best place to do this would be in a TestMain function, +// after all tests have been run. Something like this: +// +// func TestMain(m *testing.M) { +// convey.SuppressConsoleStatistics() +// result := m.Run() +// convey.PrintConsoleStatistics() +// os.Exit(result) +// } +// +func PrintConsoleStatistics() { + reporting.PrintConsoleStatistics() +} 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 index b370f1e4cd0..3a5c848a445 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go +++ b/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go @@ -4,26 +4,17 @@ 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") { + if strings.HasSuffix(file, "_test.go") || strings.HasSuffix(file, "_tests.go") { name = runtime.FuncForPC(caller_id).Name() return } diff --git a/vendor/github.com/smartystreets/goconvey/convey/init.go b/vendor/github.com/smartystreets/goconvey/convey/init.go index fef92266317..1d77ff3dcdb 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/init.go +++ b/vendor/github.com/smartystreets/goconvey/convey/init.go @@ -5,19 +5,22 @@ import ( "os" "github.com/jtolds/gls" + "github.com/smartystreets/assertions" "github.com/smartystreets/goconvey/convey/reporting" ) func init() { + assertions.GoConveyMode(true) + 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") + flag.BoolVar(&json, "convey-json", false, "When true, emits results in JSON blocks. Default: 'false'") + flag.BoolVar(&silent, "convey-silent", false, "When true, all output from GoConvey is suppressed.") + flag.BoolVar(&story, "convey-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 @@ -31,14 +34,19 @@ func noStoryFlagProvided() bool { } func buildReporter() reporting.Reporter { + selectReporter := os.Getenv("GOCONVEY_REPORTER") + switch { case testReporter != nil: return testReporter - case json: + case json || selectReporter == "json": return reporting.BuildJsonReporter() - case silent: + case silent || selectReporter == "silent": return reporting.BuildSilentReporter() - case story: + case selectReporter == "dot": + // Story is turned on when verbose is set, so we need to check for dot reporter first. + return reporting.BuildDotReporter() + case story || selectReporter == "story": return reporting.BuildStoryReporter() default: return reporting.BuildDotReporter() 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/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_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 index ea7a4be075f..44d080e90e6 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go +++ b/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go @@ -1,14 +1,13 @@ package reporting import ( - "fmt" "os" "runtime" "strings" ) func init() { - if !isXterm() { + if !isColorableTerminal() { monochrome() } @@ -43,7 +42,7 @@ func BuildSilentReporter() Reporter { out := NewPrinter(NewConsole()) return NewReporters( NewGoTestReporter(), - NewProblemReporter(out)) + NewSilentProblemReporter(out)) } var ( @@ -69,6 +68,9 @@ var ( var consoleStatistics = NewStatisticsReporter(NewPrinter(NewConsole())) +func SuppressConsoleStatistics() { consoleStatistics.Suppress() } +func PrintConsoleStatistics() { consoleStatistics.PrintSummary() } + // 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. @@ -80,10 +82,8 @@ 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") +func isColorableTerminal() bool { + return strings.Contains(os.Getenv("TERM"), "color") } // This interface allows us to pass the *testing.T struct 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 index c610ba88693..9ae493ac3b7 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go +++ b/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go @@ -3,6 +3,7 @@ package reporting import "fmt" type problem struct { + silent bool out *Printer errors []*AssertionResult failures []*AssertionResult @@ -28,9 +29,13 @@ func (self *problem) EndStory() { self.prepareForNextStory() } func (self *problem) show(display func(), color string) { - fmt.Print(color) + if !self.silent { + fmt.Print(color) + } display() - fmt.Print(resetColor) + if !self.silent { + fmt.Print(resetColor) + } self.out.Dedent() } func (self *problem) showErrors() { @@ -62,6 +67,13 @@ func NewProblemReporter(out *Printer) *problem { self.prepareForNextStory() return self } + +func NewSilentProblemReporter(out *Printer) *problem { + self := NewProblemReporter(out) + self.silent = true + 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_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/reports.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go index 659a0ec98b4..712e6ade625 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go +++ b/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go @@ -76,10 +76,12 @@ func removePackagePath(name string) string { /////////////////// FailureView //////////////////////// +// This struct is also declared in github.com/smartystreets/assertions. +// The json struct tags should be equal in both declarations. type FailureView struct { - Message string - Expected string - Actual string + Message string `json:"Message"` + Expected string `json:"Expected"` + Actual string `json:"Actual"` } ////////////////////AssertionResult ////////////////////// diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go index e015031c3a3..c3ccd056a0b 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go +++ b/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go @@ -1,12 +1,18 @@ package reporting -import "fmt" +import ( + "fmt" + "sync" +) func (self *statistics) BeginStory(story *StoryReport) {} func (self *statistics) Enter(scope *ScopeReport) {} func (self *statistics) Report(report *AssertionResult) { + self.Lock() + defer self.Unlock() + if !self.failing && report.Failure != "" { self.failing = true } @@ -23,15 +29,36 @@ func (self *statistics) Report(report *AssertionResult) { func (self *statistics) Exit() {} func (self *statistics) EndStory() { - self.reportAssertions() - self.reportSkippedSections() - self.completeReport() + self.Lock() + defer self.Unlock() + + if !self.suppressed { + self.printSummaryLocked() + } } -func (self *statistics) reportAssertions() { - self.decideColor() - self.out.Print("\n%d %s thus far", self.total, plural("assertion", self.total)) + +func (self *statistics) Suppress() { + self.Lock() + defer self.Unlock() + self.suppressed = true } -func (self *statistics) decideColor() { + +func (self *statistics) PrintSummary() { + self.Lock() + defer self.Unlock() + self.printSummaryLocked() +} + +func (self *statistics) printSummaryLocked() { + self.reportAssertionsLocked() + self.reportSkippedSectionsLocked() + self.completeReportLocked() +} +func (self *statistics) reportAssertionsLocked() { + self.decideColorLocked() + self.out.Print("\n%d total %s", self.total, plural("assertion", self.total)) +} +func (self *statistics) decideColorLocked() { if self.failing && !self.erroring { fmt.Print(yellowColor) } else if self.erroring { @@ -40,14 +67,13 @@ func (self *statistics) decideColor() { fmt.Print(greenColor) } } -func (self *statistics) reportSkippedSections() { +func (self *statistics) reportSkippedSectionsLocked() { if self.skipped > 0 { fmt.Print(yellowColor) self.out.Print(" (one or more sections skipped)") - self.skipped = 0 } } -func (self *statistics) completeReport() { +func (self *statistics) completeReportLocked() { fmt.Print(resetColor) self.out.Print("\n") self.out.Print("\n") @@ -64,11 +90,14 @@ func NewStatisticsReporter(out *Printer) *statistics { } type statistics struct { - out *Printer - total int - failing bool - erroring bool - skipped int + sync.Mutex + + out *Printer + total int + failing bool + erroring bool + skipped int + suppressed bool } func plural(word string, count int) string { 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) -} diff --git a/vendor/vendor.json b/vendor/vendor.json index 4bc76ca4d73..aea55c068fb 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1,6 +1,43 @@ { "comment": "", "ignore": "test", - "package": [], + "package": [ + { + "checksumSHA1": "6AYg4fjEvFuAVN3wHakGApjhZAM=", + "path": "github.com/smartystreets/assertions", + "revision": "2063fd1cc7c975db70502811a34b06ad034ccdf2", + "revisionTime": "2016-07-07T19:03:55Z" + }, + { + "checksumSHA1": "Vzb+dEH/LTYbvr8RXHmt6xJHz04=", + "path": "github.com/smartystreets/assertions/internal/go-render/render", + "revision": "2063fd1cc7c975db70502811a34b06ad034ccdf2", + "revisionTime": "2016-07-07T19:03:55Z" + }, + { + "checksumSHA1": "SLC6TfV4icQA9l8YJQu8acJYbuo=", + "path": "github.com/smartystreets/assertions/internal/oglematchers", + "revision": "2063fd1cc7c975db70502811a34b06ad034ccdf2", + "revisionTime": "2016-07-07T19:03:55Z" + }, + { + "checksumSHA1": "/mwAihy9AmznMzmbPQ5nWJXBiRU=", + "path": "github.com/smartystreets/goconvey/convey", + "revision": "5db88ed452e937f2fd557de6f4f1af7f2eabed0b", + "revisionTime": "2016-08-23T18:01:44Z" + }, + { + "checksumSHA1": "9LakndErFi5uCXtY1KWl0iRnT4c=", + "path": "github.com/smartystreets/goconvey/convey/gotest", + "revision": "5db88ed452e937f2fd557de6f4f1af7f2eabed0b", + "revisionTime": "2016-08-23T18:01:44Z" + }, + { + "checksumSHA1": "FWDhk37bhAwZ2363D/L2xePwR64=", + "path": "github.com/smartystreets/goconvey/convey/reporting", + "revision": "5db88ed452e937f2fd557de6f4f1af7f2eabed0b", + "revisionTime": "2016-08-23T18:01:44Z" + } + ], "rootPath": "github.com/grafana/grafana" }