From 25d8780d68bdf0abd61bac1af80536e554182e57 Mon Sep 17 00:00:00 2001 From: Alexandr Ivanov Date: Thu, 27 Jun 2019 15:43:12 +0300 Subject: [PATCH 01/80] expvar flag compatibilti fix hot fix for compatibility with old yandex-tank versions --- cli/cli.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli/cli.go b/cli/cli.go index cfc0317ff..2163f1ced 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -90,10 +90,16 @@ func Run() { } var ( example bool + expvar bool ) flag.BoolVar(&example, "example", false, "print example config to STDOUT and exit") + flag.BoolVar(&expvar, "expvar", false, "stab for compatibility") flag.Parse() + if expvar { + fmt.Fprintf(os.Stderr, "-expvar flag is a stab. Use monitoring section in config to turn it on\n") + } + if example { panic("Not implemented yet") // TODO: print example config file content From 8d558ef50e0d57e5cd6b3bff61dc6090d59a6d7c Mon Sep 17 00:00:00 2001 From: Alexandr Ivanov Date: Thu, 27 Jun 2019 16:42:17 +0300 Subject: [PATCH 02/80] messages fix --- cli/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 2163f1ced..3f60bbcc9 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -93,11 +93,11 @@ func Run() { expvar bool ) flag.BoolVar(&example, "example", false, "print example config to STDOUT and exit") - flag.BoolVar(&expvar, "expvar", false, "stab for compatibility") + flag.BoolVar(&expvar, "expvar", false, "enable expvar service (DEPRECATED, use monitoring config section instead)") flag.Parse() if expvar { - fmt.Fprintf(os.Stderr, "-expvar flag is a stab. Use monitoring section in config to turn it on\n") + fmt.Fprintf(os.Stderr, "-expvar flag is DEPRECATED. Use monitoring config section instead\n") } if example { From 18593a2e38954506fbbba1cf87faf9adc8ee4de2 Mon Sep 17 00:00:00 2001 From: Alexandr Ivanov Date: Thu, 22 Aug 2019 13:22:01 +0300 Subject: [PATCH 03/80] getter for afero.Fs with this, you can avoid afero dependency in custom guns --- core/import/import.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/import/import.go b/core/import/import.go index 3bf142802..a1e9fde0e 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -29,6 +29,10 @@ const ( fileDataKey = "file" compositeScheduleKey = "composite" ) +//getter for fs to avoid afero dependency in custom guns +func GetFs() afero.Fs { + return afero.NewOsFs() +} func Import(fs afero.Fs) { From e06163467e74b9fd808a9c39435943c29c49e7dd Mon Sep 17 00:00:00 2001 From: dkostin Date: Thu, 28 Nov 2019 16:58:05 +0300 Subject: [PATCH 04/80] continue on error feature for json --- components/phttp/ammo/simple/ammo.go | 11 ++++++++++- components/phttp/ammo/simple/jsonline/provider.go | 11 ++++++++--- components/phttp/base.go | 6 ++++++ components/phttp/core.go | 1 + 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 4c01e8575..1398174b0 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -18,6 +18,7 @@ type Ammo struct { req *http.Request tag string id int + isInvalidated bool } func (a *Ammo) Request() (*http.Request, *netsample.Sample) { @@ -27,7 +28,7 @@ func (a *Ammo) Request() (*http.Request, *netsample.Sample) { } func (a *Ammo) Reset(req *http.Request, tag string) { - *a = Ammo{req, tag, -1} + *a = Ammo{req, tag, -1, false} } func (a *Ammo) SetId(id int) { @@ -38,4 +39,12 @@ func (a *Ammo) Id() int { return a.id } +func (a *Ammo) Invalidate() { + a.isInvalidated = true +} + +func (a *Ammo) IsInvalidate() bool { + return a.isInvalidated +} + var _ phttp.Ammo = (*Ammo)(nil) diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 98810f4ec..1ca1903d7 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -36,6 +36,7 @@ type Config struct { Limit int `validate:"min=0"` // Passes limits ammo file passes. Unlimited if zero. Passes int `validate:"min=0"` + ContinueOnError bool } func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { @@ -47,7 +48,11 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { data := scanner.Bytes() a, err := decodeAmmo(data, p.Pool.Get().(*simple.Ammo)) if err != nil { - return errors.Wrapf(err, "failed to decode ammo at line: %v; data: %q", line, data) + if p.Config.ContinueOnError == true { + a.Invalidate() + } else { + return errors.Wrapf(err, "failed to decode ammo at line: %v; data: %q", line, data) + } } ammoNum++ select { @@ -68,11 +73,11 @@ func decodeAmmo(jsonDoc []byte, am *simple.Ammo) (*simple.Ammo, error) { var data data err := data.UnmarshalJSON(jsonDoc) if err != nil { - return nil, errors.WithStack(err) + return am, errors.WithStack(err) } req, err := data.ToRequest() if err != nil { - return nil, err + return am, err } am.Reset(req, data.Tag) return am, nil diff --git a/components/phttp/base.go b/components/phttp/base.go index bf8eba67d..f08712cb9 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -90,6 +90,12 @@ func (b *BaseGun) Shoot(ammo Ammo) { } req, sample := ammo.Request() + if ammo.IsInvalidate() { + sample.AddTag(EmptyTag) + sample.SetProtoCode(0) + b.Aggregator.Report(sample) + return + } if b.DebugLog { b.Log.Debug("Prepared ammo to shoot", zap.Stringer("url", req.URL)) } diff --git a/components/phttp/core.go b/components/phttp/core.go index 0615255ed..781ace651 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -23,6 +23,7 @@ type Ammo interface { Request() (*http.Request, *netsample.Sample) // Id unique ammo id. Usually equals to ammo num got from provider. Id() int + IsInvalidate() bool } type Gun interface { From 7ae155b7115a8d2d4d93879b767a25c9cbdbf5a6 Mon Sep 17 00:00:00 2001 From: dkostin Date: Thu, 28 Nov 2019 17:52:30 +0300 Subject: [PATCH 05/80] invalid ammo logging --- components/phttp/ammo/simple/ammo.go | 12 ++++++++---- components/phttp/base.go | 3 ++- components/phttp/core.go | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 1398174b0..c1f1d0a87 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -18,7 +18,7 @@ type Ammo struct { req *http.Request tag string id int - isInvalidated bool + isInvalid bool } func (a *Ammo) Request() (*http.Request, *netsample.Sample) { @@ -40,11 +40,15 @@ func (a *Ammo) Id() int { } func (a *Ammo) Invalidate() { - a.isInvalidated = true + a.isInvalid = true } -func (a *Ammo) IsInvalidate() bool { - return a.isInvalidated +func (a *Ammo) IsInvalid() bool { + return a.isInvalid +} + +func (a *Ammo) IsValid() bool { + return !a.isInvalid } var _ phttp.Ammo = (*Ammo)(nil) diff --git a/components/phttp/base.go b/components/phttp/base.go index f08712cb9..4e5c29cb2 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -90,10 +90,11 @@ func (b *BaseGun) Shoot(ammo Ammo) { } req, sample := ammo.Request() - if ammo.IsInvalidate() { + if ammo.IsInvalid() { sample.AddTag(EmptyTag) sample.SetProtoCode(0) b.Aggregator.Report(sample) + b.Log.Warn("Invalid ammo", zap.Int("request", ammo.Id())) return } if b.DebugLog { diff --git a/components/phttp/core.go b/components/phttp/core.go index 781ace651..c4a104fb2 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -23,7 +23,7 @@ type Ammo interface { Request() (*http.Request, *netsample.Sample) // Id unique ammo id. Usually equals to ammo num got from provider. Id() int - IsInvalidate() bool + IsInvalid() bool } type Gun interface { From be16e051d0d926a843e3a8d5cf0d2157ee44c05e Mon Sep 17 00:00:00 2001 From: Nurlan Date: Tue, 14 Apr 2020 21:19:58 +0300 Subject: [PATCH 06/80] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b02541986..a87640db3 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,7 @@ pandora myconfig.yaml Or use Pandora with [Yandex.Tank](http://yandextank.readthedocs.org/en/latest/configuration.html#pandora) and [Overload](https://overload.yandex.net). + +### Documentation +[ReadTheDocs](https://yandexpandora.readthedocs.io/en/develop/) + From 8521575fa818ae442e34968c79e427bfe58ac157 Mon Sep 17 00:00:00 2001 From: Alexandr Ivanov Date: Thu, 30 Apr 2020 01:09:05 +0300 Subject: [PATCH 07/80] ammo mock fix --- components/phttp/mocks/ammo.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index 533d7fccc..d30709d0d 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -8,6 +8,7 @@ import netsample "github.com/yandex/pandora/core/aggregator/netsample" // Ammo is an autogenerated mock type for the Ammo type type Ammo struct { mock.Mock + isInvalid bool } // Id provides a mock function with given fields: @@ -48,3 +49,15 @@ func (_m *Ammo) Request() (*http.Request, *netsample.Sample) { return r0, r1 } + +func (_m *Ammo) Invalidate() { + _m.isInvalid = true +} + +func (_m *Ammo) IsInvalid() bool { + return _m.isInvalid +} + +func (_m *Ammo) IsValid() bool { + return !_m.isInvalid +} From a19ffee357ce66a4f72453040348c86a34c2c7ac Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Thu, 30 Apr 2020 01:38:22 +0300 Subject: [PATCH 08/80] version bump --- .goxc.json | 2 +- cli/cli.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.goxc.json b/.goxc.json index adc9960bb..16491bd6c 100644 --- a/.goxc.json +++ b/.goxc.json @@ -5,7 +5,7 @@ ], "Arch": "amd64", "Os": "linux darwin windows", - "PackageVersion": "0.1.3", + "PackageVersion": "0.3.1", "TaskSettings": { "publish-github": { "owner": "yandex", diff --git a/cli/cli.go b/cli/cli.go index 3f60bbcc9..7e1d7d3ee 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -25,7 +25,7 @@ import ( "github.com/yandex/pandora/lib/zaputil" ) -const Version = "0.3.0" +const Version = "0.3.1" const defaultConfigFile = "load" const stdinConfigSelector = "-" From 7d1aa5e8989c12d2aa597f452fd53b7d34a410b3 Mon Sep 17 00:00:00 2001 From: Igor Perikov Date: Mon, 15 Jun 2020 12:58:54 +0300 Subject: [PATCH 09/80] Delete guns.rst --- docs/guns.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/guns.rst diff --git a/docs/guns.rst b/docs/guns.rst deleted file mode 100644 index e69de29bb..000000000 From 8e0008e310987103fe5421089658ec37a8d09911 Mon Sep 17 00:00:00 2001 From: Igor Perikov Date: Mon, 15 Jun 2020 12:59:35 +0300 Subject: [PATCH 10/80] remove guns from docs index --- docs/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index ccb6a6d76..d7273bdce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,7 +15,6 @@ Pandora is a high-performance load generator in Go language. It has built-in HTT install tutorial advanced - guns custom performance architecture From 3efb3c42fc8fe131b95330ddd6c36de478891044 Mon Sep 17 00:00:00 2001 From: ival83 Date: Tue, 16 Jun 2020 19:24:33 +0300 Subject: [PATCH 11/80] fix fmt to make travis green --- components/phttp/ammo/simple/ammo.go | 6 +++--- components/phttp/ammo/simple/jsonline/provider.go | 3 ++- components/phttp/mock_client_test.go | 7 +++++-- components/phttp/mocks/ammo.go | 9 ++++++--- core/aggregator/mocks/sample_encode_closer.go | 7 +++++-- core/aggregator/mocks/sample_encoder.go | 6 ++++-- core/import/import.go | 3 ++- core/mocks/aggregator.go | 9 ++++++--- core/mocks/data_sink.go | 7 +++++-- core/mocks/data_source.go | 7 +++++-- core/mocks/gun.go | 6 ++++-- core/mocks/provider.go | 9 ++++++--- core/mocks/schedule.go | 7 +++++-- lib/netutil/mocks/conn.go | 8 +++++--- lib/netutil/mocks/dialer.go | 9 ++++++--- 15 files changed, 69 insertions(+), 34 deletions(-) diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index c1f1d0a87..8862b1964 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -15,9 +15,9 @@ import ( type Ammo struct { // OPTIMIZE(skipor): reuse *http.Request. // Need to research is it possible. http.Transport can hold reference to http.Request. - req *http.Request - tag string - id int + req *http.Request + tag string + id int isInvalid bool } diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 1ca1903d7..97f27c48c 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -12,6 +12,7 @@ import ( "strings" "github.com/pkg/errors" + "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" ) @@ -35,7 +36,7 @@ type Config struct { // Limit limits total num of ammo. Unlimited if zero. Limit int `validate:"min=0"` // Passes limits ammo file passes. Unlimited if zero. - Passes int `validate:"min=0"` + Passes int `validate:"min=0"` ContinueOnError bool } diff --git a/components/phttp/mock_client_test.go b/components/phttp/mock_client_test.go index a56da548a..bee5eca6a 100644 --- a/components/phttp/mock_client_test.go +++ b/components/phttp/mock_client_test.go @@ -1,8 +1,11 @@ // Code generated by mockery v1.0.0 package phttp -import "net/http" -import "github.com/stretchr/testify/mock" +import ( + "net/http" + + "github.com/stretchr/testify/mock" +) // MockClient is an autogenerated mock type for the Client type type MockClient struct { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index d30709d0d..96ac62c26 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -1,9 +1,12 @@ // Code generated by mockery v1.0.0 package ammomock -import http "net/http" -import mock "github.com/stretchr/testify/mock" -import netsample "github.com/yandex/pandora/core/aggregator/netsample" +import ( + http "net/http" + + mock "github.com/stretchr/testify/mock" + netsample "github.com/yandex/pandora/core/aggregator/netsample" +) // Ammo is an autogenerated mock type for the Ammo type type Ammo struct { diff --git a/core/aggregator/mocks/sample_encode_closer.go b/core/aggregator/mocks/sample_encode_closer.go index 65735cf03..5e152cc15 100644 --- a/core/aggregator/mocks/sample_encode_closer.go +++ b/core/aggregator/mocks/sample_encode_closer.go @@ -1,8 +1,11 @@ // Code generated by mockery v1.0.0 package aggregatemock -import core "github.com/yandex/pandora/core" -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" + + core "github.com/yandex/pandora/core" +) // SampleEncodeCloser is an autogenerated mock type for the SampleEncodeCloser type type SampleEncodeCloser struct { diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 344213eb5..8e1dd9474 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -1,8 +1,10 @@ // Code generated by mockery v1.0.0 package aggregatemock -import core "github.com/yandex/pandora/core" -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" +) // SampleEncoder is an autogenerated mock type for the SampleEncoder type type SampleEncoder struct { diff --git a/core/import/import.go b/core/import/import.go index a1e9fde0e..358d1b05d 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -29,9 +29,10 @@ const ( fileDataKey = "file" compositeScheduleKey = "composite" ) + //getter for fs to avoid afero dependency in custom guns func GetFs() afero.Fs { - return afero.NewOsFs() + return afero.NewOsFs() } func Import(fs afero.Fs) { diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index ecead2740..b325dcbc9 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -1,9 +1,12 @@ // Code generated by mockery v1.0.0 package coremock -import "context" -import "github.com/yandex/pandora/core" -import "github.com/stretchr/testify/mock" +import ( + "context" + + "github.com/stretchr/testify/mock" + "github.com/yandex/pandora/core" +) // Aggregator is an autogenerated mock type for the Aggregator type type Aggregator struct { diff --git a/core/mocks/data_sink.go b/core/mocks/data_sink.go index ada729f56..24ed8be47 100644 --- a/core/mocks/data_sink.go +++ b/core/mocks/data_sink.go @@ -1,8 +1,11 @@ // Code generated by mockery v1.0.0 package coremock -import io "io" -import mock "github.com/stretchr/testify/mock" +import ( + io "io" + + mock "github.com/stretchr/testify/mock" +) // DataSink is an autogenerated mock type for the DataSink type type DataSink struct { diff --git a/core/mocks/data_source.go b/core/mocks/data_source.go index 854c923c0..e89eb4855 100644 --- a/core/mocks/data_source.go +++ b/core/mocks/data_source.go @@ -1,8 +1,11 @@ // Code generated by mockery v1.0.0 package coremock -import io "io" -import mock "github.com/stretchr/testify/mock" +import ( + io "io" + + mock "github.com/stretchr/testify/mock" +) // DataSource is an autogenerated mock type for the DataSource type type DataSource struct { diff --git a/core/mocks/gun.go b/core/mocks/gun.go index c93ff36b2..aa69c41d7 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -1,8 +1,10 @@ // Code generated by mockery v1.0.0 package coremock -import core "github.com/yandex/pandora/core" -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" +) // Gun is an autogenerated mock type for the Gun type type Gun struct { diff --git a/core/mocks/provider.go b/core/mocks/provider.go index d94bd028a..fd3cb0b1e 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -1,9 +1,12 @@ // Code generated by mockery v1.0.0 package coremock -import context "context" -import core "github.com/yandex/pandora/core" -import mock "github.com/stretchr/testify/mock" +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" +) // Provider is an autogenerated mock type for the Provider type type Provider struct { diff --git a/core/mocks/schedule.go b/core/mocks/schedule.go index 291b4554c..080509065 100644 --- a/core/mocks/schedule.go +++ b/core/mocks/schedule.go @@ -1,8 +1,11 @@ // Code generated by mockery v1.0.0 package coremock -import mock "github.com/stretchr/testify/mock" -import time "time" +import ( + time "time" + + mock "github.com/stretchr/testify/mock" +) // Schedule is an autogenerated mock type for the Schedule type type Schedule struct { diff --git a/lib/netutil/mocks/conn.go b/lib/netutil/mocks/conn.go index 7f10c79c0..c71a21ce7 100644 --- a/lib/netutil/mocks/conn.go +++ b/lib/netutil/mocks/conn.go @@ -1,10 +1,12 @@ // Code generated by mockery v1.0.0 package netmock -import "github.com/stretchr/testify/mock" -import "net" +import ( + "net" + "time" -import "time" + "github.com/stretchr/testify/mock" +) // Conn is an autogenerated mock type for the Conn type type Conn struct { diff --git a/lib/netutil/mocks/dialer.go b/lib/netutil/mocks/dialer.go index 27e1ea755..77007eb9b 100644 --- a/lib/netutil/mocks/dialer.go +++ b/lib/netutil/mocks/dialer.go @@ -1,9 +1,12 @@ // Code generated by mockery v1.0.0 package netmock -import "context" -import "github.com/stretchr/testify/mock" -import "net" +import ( + "context" + "net" + + "github.com/stretchr/testify/mock" +) // Dialer is an autogenerated mock type for the Dialer type type Dialer struct { From e8e524a38a6844fcc63a88f1403b3b90ee5c027c Mon Sep 17 00:00:00 2001 From: ival83 Date: Wed, 24 Jun 2020 17:07:53 +0300 Subject: [PATCH 12/80] add version flag --- cli/cli.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index 7e1d7d3ee..edba67d33 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -25,7 +25,7 @@ import ( "github.com/yandex/pandora/lib/zaputil" ) -const Version = "0.3.1" +const Version = "0.3.2" const defaultConfigFile = "load" const stdinConfigSelector = "-" @@ -91,8 +91,10 @@ func Run() { var ( example bool expvar bool + version bool ) flag.BoolVar(&example, "example", false, "print example config to STDOUT and exit") + flag.BoolVar(&version, "version", false, "print pandora core version") flag.BoolVar(&expvar, "expvar", false, "enable expvar service (DEPRECATED, use monitoring config section instead)") flag.Parse() @@ -105,6 +107,11 @@ func Run() { // TODO: print example config file content } + if version { + fmt.Fprintf(os.Stderr, "Pandora core/%s\n", Version) + return + } + conf := readConfig() log := newLogger(conf.Log) zap.ReplaceGlobals(log) From d91711a578ab6ed3e1bc5d7af605c709e3432c34 Mon Sep 17 00:00:00 2001 From: ival83 Date: Mon, 29 Jun 2020 22:23:35 +0300 Subject: [PATCH 13/80] User define values in sample --- core/aggregator/netsample/sample.go | 12 ++++++++++++ core/aggregator/netsample/sample_test.go | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index e74ed75f6..bdcbadc5f 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -88,6 +88,18 @@ func (s *Sample) setRTT() { } } +func (s *Sample) SetUserDuration(d time.Duration) { + s.setDuration(keyRTTMicro, d) +} + +func (s *Sample) SetUserProto(code int) { + s.set(keyProtoCode, code) +} + +func (s *Sample) SetUserNet(code int) { + s.set(keyErrno, code) +} + func (s *Sample) String() string { return string(appendPhout(s, nil, true)) } diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index 64948fba4..e2e9ebdfd 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -51,6 +51,26 @@ func TestSampleBehaviour(t *testing.T) { assert.Equal(t, expected, sample.String()) } +func TestCustomSets(t *testing.T) { + const tag = "UserDefine" + s := Acquire(tag) + s.SetUserDuration(100 * time.Millisecond) + s.SetUserProto(0) + s.SetUserNet(110) + expectedTimeStamp := fmt.Sprintf("%v.%3.f", + s.timeStamp.Unix(), + float32((s.timeStamp.UnixNano()/1e6)%1000)) + expectedTimeStamp = strings.Replace(expectedTimeStamp, " ", "0", -1) + expected := fmt.Sprintf("%s\t%s#0\t%v\t0\t0\t0\t0\t0\t0\t0\t%v\t%v", + expectedTimeStamp, + tag, + 100000, + 110, + 0, + ) + assert.Equal(t, expected, s.String()) +} + func TestGetErrno(t *testing.T) { var err error = syscall.EINVAL err = &os.SyscallError{Err: err} From 69d91e6294922896f796cfcee10e3f81a4f41383 Mon Sep 17 00:00:00 2001 From: Naidenov Ivan Date: Fri, 31 Jul 2020 14:41:51 +0300 Subject: [PATCH 14/80] Add ability to set latency and req/resp sizes in sample --- core/aggregator/netsample/sample.go | 12 ++++++++++++ core/aggregator/netsample/sample_test.go | 24 ++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index bdcbadc5f..f3a9198f8 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -100,6 +100,18 @@ func (s *Sample) SetUserNet(code int) { s.set(keyErrno, code) } +func (s *Sample) SetLatency(d time.Duration) { + s.setDuration(keyLatencyMicro, d) +} + +func (s *Sample) SetRequestBytes(b int) { + s.set(keyRequestBytes, b) +} + +func (s *Sample) SetResponceBytes(b int) { + s.set(keyResponseBytes, b) +} + func (s *Sample) String() string { return string(appendPhout(s, nil, true)) } diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index e2e9ebdfd..ad9f1688c 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -54,21 +54,37 @@ func TestSampleBehaviour(t *testing.T) { func TestCustomSets(t *testing.T) { const tag = "UserDefine" s := Acquire(tag) - s.SetUserDuration(100 * time.Millisecond) + + userDuration := 100 * time.Millisecond + s.SetUserDuration(userDuration) + s.SetUserProto(0) s.SetUserNet(110) + + latency := 200 * time.Millisecond + s.SetLatency(latency) + + reqBytes := 4 + s.SetRequestBytes(reqBytes) + + respBytes := 8 + s.SetResponceBytes(respBytes) + expectedTimeStamp := fmt.Sprintf("%v.%3.f", s.timeStamp.Unix(), float32((s.timeStamp.UnixNano()/1e6)%1000)) expectedTimeStamp = strings.Replace(expectedTimeStamp, " ", "0", -1) - expected := fmt.Sprintf("%s\t%s#0\t%v\t0\t0\t0\t0\t0\t0\t0\t%v\t%v", + expected := fmt.Sprintf("%s\t%s#0\t%v\t0\t0\t%v\t0\t0\t%v\t%v\t%v\t%v", expectedTimeStamp, tag, - 100000, + int(userDuration.Nanoseconds()/1000), // keyRTTMicro + int(latency.Nanoseconds()/1000), // keyLatencyMicro + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) - assert.Equal(t, expected, s.String()) + assert.Equal(t, s.String(), expected) } func TestGetErrno(t *testing.T) { From c98ed8059adcc0c1e3b1e41ac32b37439d6bba6a Mon Sep 17 00:00:00 2001 From: dkostin Date: Wed, 28 Oct 2020 18:33:56 +0300 Subject: [PATCH 15/80] added MaxAmmoSize option to the http/json ammo provider --- components/phttp/ammo/simple/jsonline/provider.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 97f27c48c..aa20bdd84 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -38,6 +38,8 @@ type Config struct { // Passes limits ammo file passes. Unlimited if zero. Passes int `validate:"min=0"` ContinueOnError bool + //Maximum number of byte in an ammo. Default is bufio.MaxScanTokenSize + MaxAmmoSize int } func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { @@ -45,6 +47,10 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { for { passNum++ scanner := bufio.NewScanner(ammoFile) + if p.Config.MaxAmmoSize != 0 { + var buffer []byte + scanner.Buffer(buffer, p.Config.MaxAmmoSize) + } for line := 1; scanner.Scan() && (p.Limit == 0 || ammoNum < p.Limit); line++ { data := scanner.Bytes() a, err := decodeAmmo(data, p.Pool.Get().(*simple.Ammo)) From ceccce54dbbfc425b1e623e8e70a02331a98b749 Mon Sep 17 00:00:00 2001 From: arcadia-devtools Date: Fri, 22 Jan 2021 14:37:31 +0300 Subject: [PATCH 16/80] intermediate changes ref:9b6022997321d324cf8a8d3bf0c5ca1a6ee0a5ca --- .gitignore | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6b8081823..000000000 --- a/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof -======= -.pc -*.coverprofile -.goxc.local.json -.idea/ -pandora.iml -*.log -*.out -out/ - -vendor/ - -docs/_* -.DS_Store From 761c35019359ee66a98a7dab84f9b15b7487e6cf Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 22 Jan 2021 14:37:38 +0300 Subject: [PATCH 17/80] PR from branch users/ligreen/pandora-tire0 add pandora into projects ya.make, resolve conflict add pandora into projects ya.make experiment with RECURSE_FOR_TESTS another govet test fixes for core & lib another govet test fixes new portion of govet test fixes another govet test fixes fixed 14 govet errors govet fixes for core another portion of style fixes for components some test fix owner fix fix unhandled error & go fmt fo cli/cli.go fix unhandled error for jsonline provider add make files & style fixes ref:9dcdef47fdfde4f3ba9311ea8b31b50ec7ffeaad --- acceptance_tests/acceptance_suite_test.go | 4 +- acceptance_tests/http_test.go | 2 +- cli/cli.go | 20 ++++++-- components/example/import/import.go | 6 +-- .../example/import/import_suite_test.go | 2 +- components/phttp/ammo/simple/ammo.go | 6 +-- components/phttp/ammo/simple/jsonline/data.go | 2 +- .../phttp/ammo/simple/jsonline/data_ffjson.go | 2 +- .../simple/jsonline/jsonline_suite_test.go | 12 ++--- .../phttp/ammo/simple/jsonline/provider.go | 13 ++++-- components/phttp/ammo/simple/provider.go | 2 +- .../ammo/simple/raw/decoder_bench_test.go | 2 +- .../phttp/ammo/simple/raw/decoder_test.go | 2 +- components/phttp/ammo/simple/raw/provider.go | 9 +++- components/phttp/ammo/simple/uri/provider.go | 7 ++- .../phttp/ammo/simple/uri/provider_test.go | 2 +- components/phttp/base.go | 2 +- components/phttp/base_test.go | 8 ++-- components/phttp/client.go | 2 +- components/phttp/connect.go | 4 +- components/phttp/connect_test.go | 6 +-- components/phttp/core.go | 2 +- components/phttp/http_test.go | 14 +++--- components/phttp/import/import.go | 30 ++++++------ components/phttp/import/import_suite_test.go | 4 +- components/phttp/mocks/ammo.go | 4 +- core/aggregator/encoder.go | 2 +- core/aggregator/encoder_test.go | 4 +- core/aggregator/jsonlines.go | 4 +- core/aggregator/jsonlines_test.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/phout.go | 14 +++--- core/aggregator/netsample/phout_test.go | 8 ++-- core/aggregator/netsample/sample.go | 4 +- core/aggregator/netsample/sample_test.go | 2 +- core/aggregator/reporter_test.go | 2 +- core/config/hooks.go | 6 +-- core/config/validator.go | 4 +- core/config/validator_test.go | 2 +- core/core.go | 2 +- core/coretest/config.go | 2 +- core/coretest/schedule.go | 10 ++-- core/coretest/sink.go | 6 +-- core/coretest/source.go | 6 +-- core/coreutil/waiter.go | 2 +- core/datasink/file.go | 2 +- core/datasource/file.go | 2 +- core/datasource/file_test.go | 2 +- core/engine/engine.go | 29 ++++++------ core/engine/instance.go | 2 +- core/engine/instance_test.go | 10 ++-- core/import/import_suite_test.go | 2 +- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/pluginconfig/hooks_test.go | 4 +- core/provider/decoder.go | 2 +- core/provider/json_test.go | 6 +-- core/provider/provider_suite_test.go | 2 +- lib/errutil/errutil_suite_test.go | 2 +- lib/ginkgoutil/ginkgo.go | 16 +++---- lib/ginkgoutil/matchers.go | 4 +- lib/ioutil2/reader.go | 6 +-- lib/netutil/dial.go | 4 +- lib/netutil/netutil_suite_test.go | 46 +++++++++---------- lib/testutil/matchers.go | 2 +- lib/zaputil/stack_extract_core.go | 2 +- lib/zaputil/stack_extract_core_test.go | 22 ++++----- 68 files changed, 228 insertions(+), 198 deletions(-) diff --git a/acceptance_tests/acceptance_suite_test.go b/acceptance_tests/acceptance_suite_test.go index d3d22e4fb..6b14bb506 100644 --- a/acceptance_tests/acceptance_suite_test.go +++ b/acceptance_tests/acceptance_suite_test.go @@ -112,7 +112,7 @@ func NewInstansePoolConfig() *InstancePoolConfig { } type InstancePoolConfig struct { - Id string + ID string Provider map[string]interface{} `json:"ammo"` Aggregator map[string]interface{} `json:"result"` Gun map[string]interface{} `json:"gun"` @@ -185,5 +185,5 @@ func (pt *PandoraTester) ExitCode() int { func (pt *PandoraTester) Close() { pt.Terminate() - os.RemoveAll(pt.TestDir) + _ = os.RemoveAll(pt.TestDir) } diff --git a/acceptance_tests/http_test.go b/acceptance_tests/http_test.go index cfdccd44c..ab71fd37d 100644 --- a/acceptance_tests/http_test.go +++ b/acceptance_tests/http_test.go @@ -133,7 +133,7 @@ var _ = Describe("http", func() { }) func startHTTP2(server *httptest.Server) { - http2.ConfigureServer(server.Config, nil) + _ = http2.ConfigureServer(server.Config, nil) server.TLS = server.Config.TLSConfig server.StartTLS() } diff --git a/cli/cli.go b/cli/cli.go index edba67d33..8c9c3c033 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -275,10 +275,16 @@ func startMonitoring(conf monitoringConfig) (stop func()) { zap.L().Fatal("CPU profile file create fail", zap.Error(err)) } zap.L().Info("Starting CPU profiling") - pprof.StartCPUProfile(f) + err = pprof.StartCPUProfile(f) + if err != nil { + zap.L().Info("CPU profiling is already enabled") + } stops = append(stops, func() { pprof.StopCPUProfile() - f.Close() + err := f.Close() + if err != nil { + zap.L().Info("Error closing CPUProfile file") + } }) } if conf.MemProfile.Enabled { @@ -289,8 +295,14 @@ func startMonitoring(conf monitoringConfig) (stop func()) { stops = append(stops, func() { zap.L().Info("Writing memory profile") runtime.GC() - pprof.WriteHeapProfile(f) - f.Close() + err := pprof.WriteHeapProfile(f) + if err != nil { + zap.L().Info("Error writing HeapProfile file") + } + err = f.Close() + if err != nil { + zap.L().Info("Error closing HeapProfile file") + } }) } stop = func() { diff --git a/components/example/import/import.go b/components/example/import/import.go index c5c99c73d..d7c622c0d 100644 --- a/components/example/import/import.go +++ b/components/example/import/import.go @@ -6,11 +6,11 @@ package example import ( - . "github.com/yandex/pandora/components/example" + "github.com/yandex/pandora/components/example" "github.com/yandex/pandora/core/register" ) func Import() { - register.Provider("example", NewProvider, DefaultProviderConfig) - register.Gun("example", NewGun) + register.Provider("example", example.NewProvider, example.DefaultProviderConfig) + register.Gun("example", example.NewGun) } diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index e1432a1c3..6c231f751 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" + "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 8862b1964..6db888e39 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -23,7 +23,7 @@ type Ammo struct { func (a *Ammo) Request() (*http.Request, *netsample.Sample) { sample := netsample.Acquire(a.tag) - sample.SetId(a.id) + sample.SetID(a.id) return a.req, sample } @@ -31,11 +31,11 @@ func (a *Ammo) Reset(req *http.Request, tag string) { *a = Ammo{req, tag, -1, false} } -func (a *Ammo) SetId(id int) { +func (a *Ammo) SetID(id int) { a.id = id } -func (a *Ammo) Id() int { +func (a *Ammo) ID() int { return a.id } diff --git a/components/phttp/ammo/simple/jsonline/data.go b/components/phttp/ammo/simple/jsonline/data.go index c95b0b802..b0b256a98 100644 --- a/components/phttp/ammo/simple/jsonline/data.go +++ b/components/phttp/ammo/simple/jsonline/data.go @@ -8,7 +8,7 @@ type data struct { // Request endpoint is defied by gun config. Host string `json:"host"` Method string `json:"method"` - Uri string `json:"uri"` + URI string `json:"uri"` // Headers defines headers to send. // NOTE: Host header will be silently ignored. Headers map[string]string `json:"headers"` diff --git a/components/phttp/ammo/simple/jsonline/data_ffjson.go b/components/phttp/ammo/simple/jsonline/data_ffjson.go index 56f4327f6..c2102b56b 100644 --- a/components/phttp/ammo/simple/jsonline/data_ffjson.go +++ b/components/phttp/ammo/simple/jsonline/data_ffjson.go @@ -302,7 +302,7 @@ handle_Uri: outBuf := fs.Output.Bytes() - j.Uri = string(string(outBuf)) + j.URI = string(string(outBuf)) } } diff --git a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go index 3f22584a4..d149cd1b7 100644 --- a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go +++ b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go @@ -34,13 +34,13 @@ var testData = []data{ { Host: "example.com", Method: "GET", - Uri: "/00", + URI: "/00", Headers: map[string]string{"Accept": "*/*", "Accept-Encoding": "gzip, deflate", "User-Agent": "Pandora/0.0.1"}, }, { Host: "ya.ru", Method: "HEAD", - Uri: "/01", + URI: "/01", Headers: map[string]string{"Accept": "*/*", "Accept-Encoding": "gzip, brotli", "User-Agent": "YaBro/0.1"}, Tag: "head", }, @@ -73,7 +73,7 @@ var _ = Describe("data", func() { data := data{ Host: "ya.ru", Method: "GET", - Uri: "/00", + URI: "/00", Headers: map[string]string{"A": "a", "B": "b"}, Tag: "tag", } @@ -86,7 +86,7 @@ var _ = Describe("data", func() { "URL": PointTo(MatchFields(IgnoreExtras, Fields{ "Scheme": Equal("http"), "Host": Equal(data.Host), - "Path": Equal(data.Uri), + "Path": Equal(data.URI), })), "Header": Equal(http.Header{ "A": []string{"a"}, @@ -227,13 +227,13 @@ func Benchmark(b *testing.B) { } b.Run("Decode", func(b *testing.B) { for n := 0; n < b.N; n++ { - decodeAmmo(jsonDoc, &simple.Ammo{}) + _, _ = decodeAmmo(jsonDoc, &simple.Ammo{}) } }) b.Run("DecodeWithPool", func(b *testing.B) { for n := 0; n < b.N; n++ { h := pool.Get().(*simple.Ammo) - decodeAmmo(jsonDoc, h) + _, _ = decodeAmmo(jsonDoc, h) pool.Put(h) } }) diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index aa20bdd84..9912eef1d 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -12,9 +12,10 @@ import ( "strings" "github.com/pkg/errors" + "go.uber.org/zap" - "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/spf13/afero" ) func NewProvider(fs afero.Fs, conf Config) *Provider { @@ -29,6 +30,7 @@ func NewProvider(fs afero.Fs, conf Config) *Provider { type Provider struct { simple.Provider Config + log *zap.Logger } type Config struct { @@ -55,7 +57,7 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { data := scanner.Bytes() a, err := decodeAmmo(data, p.Pool.Get().(*simple.Ammo)) if err != nil { - if p.Config.ContinueOnError == true { + if p.Config.ContinueOnError { a.Invalidate() } else { return errors.Wrapf(err, "failed to decode ammo at line: %v; data: %q", line, data) @@ -71,7 +73,10 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { if p.Passes != 0 && passNum >= p.Passes { break } - ammoFile.Seek(0, 0) + _, err := ammoFile.Seek(0, 0) + if err != nil { + p.log.Info("Failed to seek ammo file", zap.Error(err)) + } } return nil } @@ -91,7 +96,7 @@ func decodeAmmo(jsonDoc []byte, am *simple.Ammo) (*simple.Ammo, error) { } func (d *data) ToRequest() (req *http.Request, err error) { - uri := "http://" + d.Host + d.Uri + uri := "http://" + d.Host + d.URI req, err = http.NewRequest(d.Method, uri, strings.NewReader(d.Body)) if err != nil { return nil, errors.WithStack(err) diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index cd4167e5f..dab3d110e 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -39,7 +39,7 @@ type Provider struct { func (p *Provider) Acquire() (core.Ammo, bool) { ammo, ok := <-p.Sink if ok { - ammo.SetId(int(p.idCounter.Inc() - 1)) + ammo.SetID(int(p.idCounter.Inc() - 1)) } return ammo, ok } diff --git a/components/phttp/ammo/simple/raw/decoder_bench_test.go b/components/phttp/ammo/simple/raw/decoder_bench_test.go index f622bfa1c..6b6745572 100644 --- a/components/phttp/ammo/simple/raw/decoder_bench_test.go +++ b/components/phttp/ammo/simple/raw/decoder_bench_test.go @@ -21,7 +21,7 @@ const ( func BenchmarkRawDecoder(b *testing.B) { for i := 0; i < b.N; i++ { - decodeRequest([]byte(benchTestRequest)) + _, _ = decodeRequest([]byte(benchTestRequest)) } } diff --git a/components/phttp/ammo/simple/raw/decoder_test.go b/components/phttp/ammo/simple/raw/decoder_test.go index 9f8288306..5f8fb7673 100644 --- a/components/phttp/ammo/simple/raw/decoder_test.go +++ b/components/phttp/ammo/simple/raw/decoder_test.go @@ -62,7 +62,7 @@ var _ = Describe("Decoder", func() { if req.Body != nil { _, err := io.Copy(&bout, req.Body) Expect(err).To(BeNil()) - req.Body.Close() + _ = req.Body.Close() } Expect(bout.String()).To(Equal("foobar")) }) diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index e1b66c6b0..428f42a95 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" + "go.uber.org/zap" "github.com/yandex/pandora/components/phttp/ammo/simple" ) @@ -68,6 +69,7 @@ func NewProvider(fs afero.Fs, conf Config) *Provider { type Provider struct { simple.Provider Config + log *zap.Logger } func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { @@ -95,7 +97,7 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { if len(data) == 0 { continue // skip empty lines } - reqSize, tag, err := decodeHeader(data) + reqSize, tag, _ := decodeHeader(data) if reqSize == 0 { break // start over from the beginning of file if ammo size is 0 } @@ -134,7 +136,10 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { if p.Passes != 0 && passNum >= p.Passes { break } - ammoFile.Seek(0, 0) + _, err := ammoFile.Seek(0, 0) + if err != nil { + p.log.Info("Failed to seek ammo file", zap.Error(err)) + } } return nil } diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index 643cfe300..c6070e980 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -11,6 +11,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" + "go.uber.org/zap" "github.com/yandex/pandora/components/phttp/ammo/simple" ) @@ -38,6 +39,7 @@ func NewProvider(fs afero.Fs, conf Config) *Provider { type Provider struct { simple.Provider Config + log *zap.Logger decoder *decoder // Initialized on start. } @@ -70,7 +72,10 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { if p.Passes != 0 && passNum >= p.Passes { break } - ammoFile.Seek(0, 0) + _, err := ammoFile.Seek(0, 0) + if err != nil { + p.log.Info("Failed to seek ammo file", zap.Error(err)) + } p.decoder.ResetHeader() } return nil diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index a0d05411b..ca2785e58 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/pkg/errors" "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" + "github.com/pkg/errors" ) const testFile = "./ammo.uri" diff --git a/components/phttp/base.go b/components/phttp/base.go index 4e5c29cb2..1409327ca 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -94,7 +94,7 @@ func (b *BaseGun) Shoot(ammo Ammo) { sample.AddTag(EmptyTag) sample.SetProtoCode(0) b.Aggregator.Report(sample) - b.Log.Warn("Invalid ammo", zap.Int("request", ammo.Id())) + b.Log.Warn("Invalid ammo", zap.Int("request", ammo.ID())) return } if b.DebugLog { diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index 1b28186f8..7effd2ddd 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -45,15 +45,15 @@ var _ = Describe("BaseGun", func() { Context("BindResultTo", func() { It("nil panics", func() { Expect(func() { - base.Bind(nil, testDeps()) + _ = base.Bind(nil, testDeps()) }).To(Panic()) }) It("second time panics", func() { res := &netsample.TestAggregator{} - base.Bind(res, testDeps()) + _ = base.Bind(res, testDeps()) Expect(base.Aggregator).To(Equal(res)) Expect(func() { - base.Bind(&netsample.TestAggregator{}, testDeps()) + _ = base.Bind(&netsample.TestAggregator{}, testDeps()) }).To(Panic()) }) }) @@ -90,7 +90,7 @@ var _ = Describe("BaseGun", func() { req = httptest.NewRequest("GET", "/1/2/3/4", nil) tag = "" results = &netsample.TestAggregator{} - base.Bind(results, testDeps()) + _ = base.Bind(results, testDeps()) }) JustBeforeEach(func() { diff --git a/components/phttp/client.go b/components/phttp/client.go index 0aea86e07..a0eefdf65 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - "github.com/pkg/errors" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" + "github.com/pkg/errors" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index bac6a8b5f..1f94c6707 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" - "github.com/pkg/errors" "github.com/yandex/pandora/lib/netutil" + "github.com/pkg/errors" ) type ConnectGunConfig struct { @@ -88,7 +88,7 @@ func newConnectDialFunc(target string, connectSSL bool, dialer netutil.Dialer) n } defer func() { if err != nil && conn != nil { - conn.Close() + _ = conn.Close() conn = nil } }() diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index 39339e6d5..7492fa7ca 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -35,8 +35,8 @@ var _ = Describe("connect", func() { "Current implementation should not send requested data before got response.") _, err = io.WriteString(conn, "HTTP/1.1 200 Connection established\r\n\r\n") Expect(err).To(BeNil()) - go func() { io.Copy(toOrigin, conn) }() - go func() { io.Copy(conn, toOrigin) }() + go func() { _, _ = io.Copy(toOrigin, conn) }() + go func() { _, _ = io.Copy(conn, toOrigin) }() }) } @@ -90,7 +90,7 @@ var _ = Describe("connect", func() { connectGun := NewConnectGun(conf) results := &netsample.TestAggregator{} - connectGun.Bind(results, testDeps()) + _ = connectGun.Bind(results, testDeps()) connectGun.Shoot(newAmmoURL(origin.URL)) Expect(results.Samples[0].Err()).To(BeNil()) diff --git a/components/phttp/core.go b/components/phttp/core.go index c4a104fb2..eeac62fd5 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -22,7 +22,7 @@ type Ammo interface { // TODO(skipor): instead of sample use it wrapper with httptrace and more usable interface. Request() (*http.Request, *netsample.Sample) // Id unique ammo id. Usually equals to ammo num got from provider. - Id() int + ID() int IsInvalid() bool } diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index 3ffa0db23..f9a18d51b 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -49,7 +49,7 @@ var _ = Describe("BaseGun", func() { conf.Gun.Target = strings.TrimPrefix(server.URL, "http://") results := &netsample.TestAggregator{} httpGun := NewHTTPGun(conf) - httpGun.Bind(results, testDeps()) + _ = httpGun.Bind(results, testDeps()) am := newAmmoReq(expectedReq) httpGun.Shoot(am) @@ -99,7 +99,7 @@ var _ = Describe("HTTP", func() { conf.Gun.SSL = https gun := NewHTTPGun(conf) var aggr netsample.TestAggregator - gun.Bind(&aggr, testDeps()) + _ = gun.Bind(&aggr, testDeps()) gun.Shoot(newAmmoURL("/")) Expect(aggr.Samples).To(HaveLen(1)) @@ -124,7 +124,7 @@ var _ = Describe("HTTP", func() { conf.Client.Redirect = redirect gun := NewHTTPGun(conf) var aggr netsample.TestAggregator - gun.Bind(&aggr, testDeps()) + _ = gun.Bind(&aggr, testDeps()) gun.Shoot(newAmmoURL("/redirect")) Expect(aggr.Samples).To(HaveLen(1)) @@ -161,7 +161,7 @@ var _ = Describe("HTTP", func() { conf.Gun.SSL = true gun := NewHTTPGun(conf) var results netsample.TestAggregator - gun.Bind(&results, testDeps()) + _ = gun.Bind(&results, testDeps()) gun.Shoot(newAmmoURL("/")) Expect(results.Samples).To(HaveLen(1)) @@ -184,7 +184,7 @@ var _ = Describe("HTTP/2", func() { conf.Gun.Target = server.Listener.Addr().String() gun, _ := NewHTTP2Gun(conf) var results netsample.TestAggregator - gun.Bind(&results, testDeps()) + _ = gun.Bind(&results, testDeps()) gun.Shoot(newAmmoURL("/")) Expect(results.Samples[0].ProtoCode()).To(Equal(http.StatusOK)) }) @@ -198,7 +198,7 @@ var _ = Describe("HTTP/2", func() { conf.Gun.Target = server.Listener.Addr().String() gun, _ := NewHTTP2Gun(conf) var results netsample.TestAggregator - gun.Bind(&results, testDeps()) + _ = gun.Bind(&results, testDeps()) var r interface{} func() { defer func() { @@ -230,7 +230,7 @@ func isHTTP2Request(req *http.Request) bool { func newHTTP2TestServer(handler http.Handler) *httptest.Server { server := httptest.NewUnstartedServer(handler) - http2.ConfigureServer(server.Config, nil) + _ = http2.ConfigureServer(server.Config, nil) server.TLS = server.Config.TLSConfig // StartTLS takes TLS configuration from that field. server.StartTLS() return server diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index 3f2d5e1a2..085aee608 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - . "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/components/phttp" "github.com/yandex/pandora/components/phttp/ammo/simple/jsonline" "github.com/yandex/pandora/components/phttp/ammo/simple/raw" "github.com/yandex/pandora/components/phttp/ammo/simple/uri" @@ -33,25 +33,25 @@ func Import(fs afero.Fs) { return raw.NewProvider(fs, conf) }) - register.Gun("http", func(conf HTTPGunConfig) func() core.Gun { - preResolveTargetAddr(&conf.Client, &conf.Gun.Target) - return func() core.Gun { return WrapGun(NewHTTPGun(conf)) } - }, DefaultHTTPGunConfig) + register.Gun("http", func(conf phttp.HTTPGunConfig) func() core.Gun { + _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) + return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf)) } + }, phttp.DefaultHTTPGunConfig) - register.Gun("http2", func(conf HTTP2GunConfig) func() (core.Gun, error) { - preResolveTargetAddr(&conf.Client, &conf.Gun.Target) + register.Gun("http2", func(conf phttp.HTTP2GunConfig) func() (core.Gun, error) { + _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) return func() (core.Gun, error) { - gun, err := NewHTTP2Gun(conf) - return WrapGun(gun), err + gun, err := phttp.NewHTTP2Gun(conf) + return phttp.WrapGun(gun), err } - }, DefaultHTTP2GunConfig) + }, phttp.DefaultHTTP2GunConfig) - register.Gun("connect", func(conf ConnectGunConfig) func() core.Gun { - preResolveTargetAddr(&conf.Client, &conf.Target) + register.Gun("connect", func(conf phttp.ConnectGunConfig) func() core.Gun { + _ = preResolveTargetAddr(&conf.Client, &conf.Target) return func() core.Gun { - return WrapGun(NewConnectGun(conf)) + return phttp.WrapGun(phttp.NewConnectGun(conf)) } - }, DefaultConnectGunConfig) + }, phttp.DefaultConnectGunConfig) } // DNS resolve optimisation. @@ -60,7 +60,7 @@ func Import(fs afero.Fs) { // If we can resolve accessible target addr - use it as target, not use caching. // Otherwise just use DNS cache - we should not fail shooting, we should try to // connect on every shoot. DNS cache will save resolved addr after first successful connect. -func preResolveTargetAddr(clientConf *ClientConfig, target *string) (err error) { +func preResolveTargetAddr(clientConf *phttp.ClientConfig, target *string) (err error) { if !clientConf.Dialer.DNSCache { return } diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 3a0b5a844..6b4f5bc49 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -31,7 +31,9 @@ var _ = Describe("preResolveTargetAddr", func() { conf.Dialer.DNSCache = true listener, err := net.ListenTCP("tcp4", nil) - defer listener.Close() + if listener != nil { + defer listener.Close() + } Expect(err).NotTo(HaveOccurred()) port := strconv.Itoa(listener.Addr().(*net.TCPAddr).Port) diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index 96ac62c26..bfde0c8f1 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" - mock "github.com/stretchr/testify/mock" netsample "github.com/yandex/pandora/core/aggregator/netsample" + mock "github.com/stretchr/testify/mock" ) // Ammo is an autogenerated mock type for the Ammo type @@ -15,7 +15,7 @@ type Ammo struct { } // Id provides a mock function with given fields: -func (_m *Ammo) Id() int { +func (_m *Ammo) ID() int { ret := _m.Called() var r0 int diff --git a/core/aggregator/encoder.go b/core/aggregator/encoder.go index 0b0dca75b..8faf680e8 100644 --- a/core/aggregator/encoder.go +++ b/core/aggregator/encoder.go @@ -120,7 +120,7 @@ HandleLoop: if err != nil { return } - case _ = <-flushTick: + case <-flushTick: if previousFlushes == flushes { a.Log.Debug("Flushing") err = encoder.Flush() diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index d9175627e..e55d6fac0 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -70,7 +70,7 @@ func NewEncoderAggregatorTester(t testutil.TestingT) *EncoderAggregatorTester { ReporterConfig: ReporterConfig{100}, } tr.ctx, tr.cancel = context.WithCancel(context.Background()) - tr.deps = core.AggregatorDeps{zap.L()} + tr.deps = core.AggregatorDeps{Log: zap.L()} return tr } @@ -234,7 +234,7 @@ func TestEncoderAggregator_ManualFlush(t *testing.T) { defer writeTicker.Stop() for { select { - case _ = <-writeTicker.C: + case <-writeTicker.C: testee.Report(0) case <-tr.ctx.Done(): return diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 2d4747c7d..efde4eaf4 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,8 +9,8 @@ import ( "bufio" "io" - jsoniter "github.com/json-iterator/go" "github.com/yandex/pandora/lib/ioutil2" + jsoniter "github.com/json-iterator/go" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/config" @@ -75,6 +75,6 @@ func (e *jsonEncoder) Encode(s core.Sample) error { func (e *jsonEncoder) Flush() error { err := e.Stream.Flush() - e.buf.Flush() + _ = e.buf.Flush() return err } diff --git a/core/aggregator/jsonlines_test.go b/core/aggregator/jsonlines_test.go index ec8ae97eb..3c2549f5d 100644 --- a/core/aggregator/jsonlines_test.go +++ b/core/aggregator/jsonlines_test.go @@ -38,7 +38,7 @@ func TestNewJSONLinesAggregator(t *testing.T) { runErr := make(chan error) go func() { - runErr <- testee.Run(ctx, core.AggregatorDeps{zap.L()}) + runErr <- testee.Run(ctx, core.AggregatorDeps{Log: zap.L()}) }() for _, sample := range samples { diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 8e1dd9474..0acfb6465 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( - mock "github.com/stretchr/testify/mock" core "github.com/yandex/pandora/core" + mock "github.com/stretchr/testify/mock" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/phout.go b/core/aggregator/netsample/phout.go index 6be94a31b..7a770982c 100644 --- a/core/aggregator/netsample/phout.go +++ b/core/aggregator/netsample/phout.go @@ -18,7 +18,7 @@ import ( type PhoutConfig struct { Destination string // Destination file name - Id bool // Print ammo ids if true. + ID bool // Print ammo ids if true. FlushTime time.Duration `config:"flush-time"` SampleQueueSize int `config:"sample-queue-size"` Buffer coreutil.BufferSizeConfig `config:",squash"` @@ -67,8 +67,8 @@ func (a *phoutAggregator) Report(s *Sample) { a.sink <- s } func (a *phoutAggregator) Run(ctx context.Context, _ core.AggregatorDeps) error { shouldFlush := time.NewTicker(1 * time.Second) defer func() { - a.writer.Flush() - a.file.Close() + _ = a.writer.Flush() + _ = a.file.Close() shouldFlush.Stop() }() loop: @@ -80,11 +80,11 @@ loop: } select { case <-shouldFlush.C: - a.writer.Flush() + _ = a.writer.Flush() default: } case <-time.After(1 * time.Second): - a.writer.Flush() + _ = a.writer.Flush() case <-ctx.Done(): // Context is done, but we should read all data from sink for { @@ -103,7 +103,7 @@ loop: } func (a *phoutAggregator) handle(s *Sample) error { - a.buf = appendPhout(s, a.buf, a.config.Id) + a.buf = appendPhout(s, a.buf, a.config.ID) a.buf = append(a.buf, '\n') _, err := a.writer.Write(a.buf) a.buf = a.buf[:0] @@ -119,7 +119,7 @@ func appendPhout(s *Sample, dst []byte, id bool) []byte { dst = append(dst, s.tags...) if id { dst = append(dst, '#') - dst = strconv.AppendInt(dst, int64(s.Id()), 10) + dst = strconv.AppendInt(dst, int64(s.ID()), 10) } for _, v := range s.fields { dst = append(dst, phoutDelimiter) diff --git a/core/aggregator/netsample/phout_test.go b/core/aggregator/netsample/phout_test.go index 67f1093e4..95e734758 100644 --- a/core/aggregator/netsample/phout_test.go +++ b/core/aggregator/netsample/phout_test.go @@ -48,11 +48,11 @@ var _ = Describe("Phout", func() { testee.Report(newTestSample()) cancel() Expect(<-runErr).NotTo(HaveOccurred()) - Expect(getOutput()).To(Equal(strings.Repeat(testSampleNoIdPhout+"\n", 2))) + Expect(getOutput()).To(Equal(strings.Repeat(testSampleNoIDPhout+"\n", 2))) }, 1) Context("id option set", func() { BeforeEach(func() { - conf.Id = true + conf.ID = true }) It("id printed", func() { testee.Report(newTestSample()) @@ -67,13 +67,13 @@ var _ = Describe("Phout", func() { const ( testSamplePhout = "1484660999.002 tag1|tag2#42 333333 0 0 0 0 0 0 0 13 999" - testSampleNoIdPhout = "1484660999.002 tag1|tag2 333333 0 0 0 0 0 0 0 13 999" + testSampleNoIDPhout = "1484660999.002 tag1|tag2 333333 0 0 0 0 0 0 0 13 999" ) func newTestSample() *Sample { s := &Sample{} s.timeStamp = time.Unix(1484660999, 002*1000000) - s.SetId(42) + s.SetID(42) s.AddTag("tag1|tag2") s.setDuration(keyRTTMicro, time.Second/3) s.set(keyErrno, 13) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index f3a9198f8..90d790612 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -63,8 +63,8 @@ func (s *Sample) AddTag(tag string) { s.tags += "|" + tag } -func (s *Sample) Id() int { return s.id } -func (s *Sample) SetId(id int) { s.id = id } +func (s *Sample) ID() int { return s.id } +func (s *Sample) SetID(id int) { s.id = id } func (s *Sample) ProtoCode() int { return s.get(keyProtoCode) } func (s *Sample) SetProtoCode(code int) { diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index ad9f1688c..d8f302c8e 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -27,7 +27,7 @@ func TestSampleBehaviour(t *testing.T) { const id = 42 sample := Acquire(tag) sample.AddTag(tag2) - sample.SetId(id) + sample.SetID(id) const sleep = time.Millisecond time.Sleep(sleep) sample.SetErr(syscall.EINVAL) diff --git a/core/aggregator/reporter_test.go b/core/aggregator/reporter_test.go index 1857e7f7b..880ee14da 100644 --- a/core/aggregator/reporter_test.go +++ b/core/aggregator/reporter_test.go @@ -24,7 +24,7 @@ func TestReporter_DroppedErr(t *testing.T) { reporter := NewReporter(ReporterConfig{1}) reporter.Report(1) - assert.Nil(t, reporter.DroppedErr()) + assert.NoError(t, reporter.DroppedErr()) reporter.Report(2) err := reporter.DroppedErr() require.Error(t, err) diff --git a/core/config/hooks.go b/core/config/hooks.go index 7e1238b87..2b4df157a 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -53,7 +53,7 @@ func StringToURLHook(f reflect.Type, t reflect.Type, data interface{}) (interfac return urlPtr, nil } -var InvalidIPError = stderrors.New("string is not valid IP") +var ErrInvalidIP = stderrors.New("string is not valid IP") // StringToIPHook converts string to net.IP func StringToIPHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { @@ -66,7 +66,7 @@ func StringToIPHook(f reflect.Type, t reflect.Type, data interface{}) (interface str := data.(string) ip := net.ParseIP(str) if ip == nil { - return nil, errors.WithStack(InvalidIPError) + return nil, errors.WithStack(ErrInvalidIP) } return ip, nil } @@ -111,7 +111,7 @@ func TextUnmarshallerHook(f reflect.Type, t reflect.Type, data interface{}) (int func unmarhsallText(v reflect.Value, data interface{}) error { unmarshaller := v.Interface().(encoding.TextUnmarshaler) - unmarshaller.UnmarshalText([]byte(data.(string))) + // unmarshaller.UnmarshalText([]byte(data.(string))) err := unmarshaller.UnmarshalText([]byte(data.(string))) return err } diff --git a/core/config/validator.go b/core/config/validator.go index d1abf67a9..d031c5c3b 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -36,10 +36,10 @@ func newValidator() *validator.Validate { validate := validator.New() validate.SetTagName("validate") for _, val := range validations { - validate.RegisterValidation(val.key, val.val) + _ = validate.RegisterValidation(val.key, val.val) } for _, val := range stringValidations { - validate.RegisterValidation(val.key, StringToAbstractValidation(val.val)) + _ = validate.RegisterValidation(val.key, StringToAbstractValidation(val.val)) } return validate } diff --git a/core/config/validator_test.go b/core/config/validator_test.go index f2a7b0396..bbfc6fd35 100644 --- a/core/config/validator_test.go +++ b/core/config/validator_test.go @@ -72,7 +72,7 @@ type D struct { func TestValidateInvalidValidatorName(t *testing.T) { require.Panics(t, func() { - Validate(&D{"test"}) + _ = Validate(&D{"test"}) }) } diff --git a/core/core.go b/core/core.go index 07164e034..6de0bf12a 100644 --- a/core/core.go +++ b/core/core.go @@ -104,7 +104,7 @@ type GunDeps struct { // Pool set's ids to Instances from 0, incrementing it after Instance Run. // There is a race between Instances for Ammo Acquire, so it's not guaranteed, that // Instance with lower InstanceId gets it's Ammo earlier. - InstanceId int + InstanceID int // TODO(skipor): https://github.com/yandex/pandora/issues/71 // Pass parallelism value. InstanceId MUST be -1 if parallelism > 1. } diff --git a/core/coretest/config.go b/core/coretest/config.go index 33204b753..74e5fd527 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( - "github.com/onsi/gomega" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/onsi/gomega" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index 8af768391..e720831d7 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,17 +8,17 @@ package coretest import ( "time" - . "github.com/onsi/gomega" "github.com/yandex/pandora/core" + "github.com/onsi/gomega" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { beforeStartLeft := sched.Left() tokensExpected := len(nexts) - 1 // Last next is finish time. - Expect(beforeStartLeft).To(Equal(tokensExpected)) + gomega.Expect(beforeStartLeft).To(gomega.Equal(tokensExpected)) sched.Start(startAt) actualNexts := DrainScheduleDuration(sched, startAt) - Expect(actualNexts).To(Equal(nexts)) + gomega.Expect(actualNexts).To(gomega.Equal(nexts)) } func ExpectScheduleNexts(sched core.Schedule, nexts ...time.Duration) { @@ -47,11 +47,11 @@ func DrainSchedule(sched core.Schedule) []time.Time { next, ok := sched.Next() nexts = append(nexts, next) if !ok { - Expect(sched.Left()).To(Equal(0)) + gomega.Expect(sched.Left()).To(gomega.Equal(0)) return nexts } expectedLeft-- - Expect(sched.Left()).To(Equal(expectedLeft)) + gomega.Expect(sched.Left()).To(gomega.Equal(expectedLeft)) } panic("drain limit reached") } diff --git a/core/coretest/sink.go b/core/coretest/sink.go index a0158263b..d54c33167 100644 --- a/core/coretest/sink.go +++ b/core/coretest/sink.go @@ -38,13 +38,13 @@ func AssertSinkEqualStdStream(t *testing.T, expectedPtr **os.File, getSink func( err = wc.Close() require.NoError(t, err) - temp.Seek(0, io.SeekStart) - data, err := ioutil.ReadAll(temp) + _, _ = temp.Seek(0, io.SeekStart) + data, _ := ioutil.ReadAll(temp) assert.Equal(t, testdata, string(data)) } func AssertSinkEqualFile(t *testing.T, fs afero.Fs, filename string, sink core.DataSink) { - afero.WriteFile(fs, filename, []byte("should be truncated"), 644) + _ = afero.WriteFile(fs, filename, []byte("should be truncated"), 0644) wc, err := sink.OpenSink() require.NoError(t, err) diff --git a/core/coretest/source.go b/core/coretest/source.go index 23d4acb5c..ae5ac8f4c 100644 --- a/core/coretest/source.go +++ b/core/coretest/source.go @@ -38,14 +38,14 @@ func AssertSourceEqualStdStream(t *testing.T, expectedPtr **os.File, getSource f err = rc.Close() require.NoError(t, err, "std stream should not be closed") - temp.Seek(0, io.SeekStart) - data, err := ioutil.ReadAll(temp) + _, _ = temp.Seek(0, io.SeekStart) + data, _ := ioutil.ReadAll(temp) assert.Equal(t, testdata, string(data)) } func AssertSourceEqualFile(t *testing.T, fs afero.Fs, filename string, source core.DataSource) { const testdata = "abcd" - afero.WriteFile(fs, filename, []byte(testdata), 644) + _ = afero.WriteFile(fs, filename, []byte(testdata), 0644) rc, err := source.OpenSource() require.NoError(t, err) diff --git a/core/coreutil/waiter.go b/core/coreutil/waiter.go index dbebba4b4..06cd1c3fb 100644 --- a/core/coreutil/waiter.go +++ b/core/coreutil/waiter.go @@ -57,7 +57,7 @@ func (w *Waiter) Wait() (ok bool) { w.timer.Reset(waitFor) } select { - case _ = <-w.timer.C: + case <-w.timer.C: return true case <-w.ctx.Done(): return false diff --git a/core/datasink/file.go b/core/datasink/file.go index 7ea859b48..48189f707 100644 --- a/core/datasink/file.go +++ b/core/datasink/file.go @@ -21,7 +21,7 @@ type FileConfig struct { } func NewFile(fs afero.Fs, conf FileConfig) core.DataSink { - return &fileSink{afero.Afero{fs}, conf} + return &fileSink{afero.Afero{Fs: fs}, conf} } type fileSink struct { diff --git a/core/datasource/file.go b/core/datasource/file.go index ab6f4ce1b..0ebb346ef 100644 --- a/core/datasource/file.go +++ b/core/datasource/file.go @@ -21,7 +21,7 @@ type FileConfig struct { } func NewFile(fs afero.Fs, conf FileConfig) core.DataSource { - return &fileSource{afero.Afero{fs}, conf} + return &fileSource{afero.Afero{Fs: fs}, conf} } type fileSource struct { diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index 714655a27..f0c93e0b1 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "github.com/spf13/afero" "github.com/yandex/pandora/core/coretest" + "github.com/spf13/afero" ) func TestFileSource(t *testing.T) { diff --git a/core/engine/engine.go b/core/engine/engine.go index 2e2ef4a47..5979d52a1 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -24,7 +24,7 @@ type Config struct { } type InstancePoolConfig struct { - Id string + ID string Provider core.Provider `config:"ammo" validate:"required"` Aggregator core.Aggregator `config:"result" validate:"required"` NewGun func() (core.Gun, error) `config:"gun" validate:"required"` @@ -67,18 +67,18 @@ func (e *Engine) Run(ctx context.Context) error { runRes := make(chan poolRunResult, 1) for i, conf := range e.config.Pools { - if conf.Id == "" { - conf.Id = fmt.Sprintf("pool_%v", i) + if conf.ID == "" { + conf.ID = fmt.Sprintf("pool_%v", i) } e.wait.Add(1) pool := newPool(e.log, e.metrics, e.wait.Done, conf) go func() { err := pool.Run(ctx) select { - case runRes <- poolRunResult{pool.Id, err}: + case runRes <- poolRunResult{pool.ID, err}: case <-ctx.Done(): pool.log.Info("Pool run result suppressed", - zap.String("id", pool.Id), zap.Error(err)) + zap.String("id", pool.ID), zap.Error(err)) } }() } @@ -87,14 +87,14 @@ func (e *Engine) Run(ctx context.Context) error { select { case res := <-runRes: e.log.Debug("Pool awaited", zap.Int("awaited", i), - zap.String("id", res.Id), zap.Error(res.Err)) + zap.String("id", res.ID), zap.Error(res.Err)) if res.Err != nil { select { case <-ctx.Done(): return ctx.Err() default: } - return errors.WithMessage(res.Err, fmt.Sprintf("%q pool run failed", res.Id)) + return errors.WithMessage(res.Err, fmt.Sprintf("%q pool run failed", res.ID)) } case <-ctx.Done(): e.log.Info("Engine run canceled") @@ -111,7 +111,7 @@ func (e *Engine) Wait() { } func newPool(log *zap.Logger, m Metrics, onWaitDone func(), conf InstancePoolConfig) *instancePool { - log = log.With(zap.String("pool", conf.Id)) + log = log.With(zap.String("pool", conf.ID)) return &instancePool{log, m, onWaitDone, conf} } @@ -178,6 +178,7 @@ type poolAsyncRunHandle struct { func (p *instancePool) runAsync(runCtx context.Context) (*poolAsyncRunHandle, error) { // Canceled in case all instances finish, fail or run runCancel. runCtx, runCancel := context.WithCancel(runCtx) + _ = runCancel // Canceled also on out of ammo, and finish of shared RPS schedule. instanceStartCtx, instanceStartCancel := context.WithCancel(runCtx) newInstanceSchedule, err := p.buildNewInstanceSchedule(instanceStartCtx, instanceStartCancel) @@ -194,11 +195,11 @@ func (p *instancePool) runAsync(runCtx context.Context) (*poolAsyncRunHandle, er runRes = make(chan instanceRunResult, runResultBufSize) ) go func() { - deps := core.ProviderDeps{p.log} + deps := core.ProviderDeps{Log: p.log} providerErr <- p.Provider.Run(runCtx, deps) }() go func() { - deps := core.AggregatorDeps{p.log} + deps := core.AggregatorDeps{Log: p.log} aggregatorErr <- p.Aggregator.Run(runCtx, deps) }() go func() { @@ -288,10 +289,10 @@ func (ah *runAwaitHandle) awaitRun() { case res := <-ah.runRes: ah.awaitedInstances++ if ent := ah.log.Check(zap.DebugLevel, "Instance run awaited"); ent != nil { - ent.Write(zap.Int("id", res.Id), zap.Int("awaited", ah.awaitedInstances), zap.Error(res.Err)) + ent.Write(zap.Int("id", res.ID), zap.Int("awaited", ah.awaitedInstances), zap.Error(res.Err)) } if errutil.IsNotCtxError(ah.runCtx, res.Err) { - ah.onErrAwaited(errors.WithMessage(res.Err, fmt.Sprintf("instance %q run failed", res.Id))) + ah.onErrAwaited(errors.WithMessage(res.Err, fmt.Sprintf("instance %q run failed", res.ID))) } ah.checkAllInstancesAreFinished() } @@ -408,12 +409,12 @@ func runNewInstance(ctx context.Context, log *zap.Logger, id int, deps instanceD } type poolRunResult struct { - Id string + ID string Err error } type instanceRunResult struct { - Id int + ID int Err error } diff --git a/core/engine/instance.go b/core/engine/instance.go index fe93b6c5f..2bb4a6b90 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -27,7 +27,7 @@ type instance struct { func newInstance(ctx context.Context, log *zap.Logger, id int, deps instanceDeps) (*instance, error) { log = log.With(zap.Int("instance", id)) - gunDeps := core.GunDeps{ctx, log, id} + gunDeps := core.GunDeps{Ctx: ctx, Log: log, InstanceID: id} sched, err := deps.newSchedule() if err != nil { return nil, err diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index 23629705d..d7b837f72 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -113,12 +113,12 @@ var _ = Describe("Instance", func() { Context("context canceled after run", func() { BeforeEach(func() { - ctx, _ = context.WithTimeout(ctx, 10*time.Millisecond) + ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/import/import_suite_test.go b/core/import/import_suite_test.go index a39a2163d..2d296839c 100644 --- a/core/import/import_suite_test.go +++ b/core/import/import_suite_test.go @@ -121,7 +121,7 @@ func TestProviderJSONLine(t *testing.T) { conf.Aggregator.Report([]int{0, 1, 2}) ctx, cancel := context.WithCancel(context.Background()) cancel() - err = conf.Aggregator.Run(ctx, core.AggregatorDeps{zap.L()}) + err = conf.Aggregator.Run(ctx, core.AggregatorDeps{Log: zap.L()}) require.NoError(t, err) testutil.AssertFileEqual(t, fs, filename, "[0,1,2]\n") diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index b325dcbc9..600cbca28 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" - "github.com/stretchr/testify/mock" "github.com/yandex/pandora/core" + "github.com/stretchr/testify/mock" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index aa69c41d7..4fbd2b19d 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( - mock "github.com/stretchr/testify/mock" core "github.com/yandex/pandora/core" + mock "github.com/stretchr/testify/mock" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index fd3cb0b1e..e5eaf9ecd 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" - mock "github.com/stretchr/testify/mock" core "github.com/yandex/pandora/core" + mock "github.com/stretchr/testify/mock" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 7237d31e2..727202df5 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/plugin" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func init() { diff --git a/core/provider/decoder.go b/core/provider/decoder.go index f6c8735c4..99beede72 100644 --- a/core/provider/decoder.go +++ b/core/provider/decoder.go @@ -77,7 +77,7 @@ func (p *DecodeProvider) Run(ctx context.Context, deps core.ProviderDeps) (err e return errors.WithMessage(err, "data source open failed") } defer func() { - errutil.Join(err, errors.Wrap(source.Close(), "data source close failed")) + _ = errutil.Join(err, errors.Wrap(source.Close(), "data source close failed")) }() // Problem: can't use decoder after io.EOF, because decoder is invalidated. But decoder recreation diff --git a/core/provider/json_test.go b/core/provider/json_test.go index eca80711a..1bb44f222 100644 --- a/core/provider/json_test.go +++ b/core/provider/json_test.go @@ -19,7 +19,7 @@ import ( ) type testJSONAmmo struct { - Id string + ID string Data string } @@ -158,12 +158,12 @@ func TestDecoderWhitespaces(t *testing.T) { func TestDecoderReset(t *testing.T) { val := testJSONAmmo{ - Id: "id", + ID: "id", } input := strings.NewReader(`{"data":"first"}`) decoder := NewJSONAmmoDecoder(input, 512) err := decoder.Decode(&val) require.NoError(t, err) assert.Equal(t, "first", val.Data) - assert.Zero(t, val.Id) + assert.Zero(t, val.ID) } diff --git a/core/provider/provider_suite_test.go b/core/provider/provider_suite_test.go index 9c500eede..1de38db7a 100644 --- a/core/provider/provider_suite_test.go +++ b/core/provider/provider_suite_test.go @@ -12,5 +12,5 @@ func TestProvider(t *testing.T) { } func testDeps() core.ProviderDeps { - return core.ProviderDeps{ginkgoutil.NewLogger()} + return core.ProviderDeps{Log: ginkgoutil.NewLogger()} } diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index 7a82d5197..85086bde5 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" + "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/ginkgoutil/ginkgo.go b/lib/ginkgoutil/ginkgo.go index 51c2c731e..2d1fac0c0 100644 --- a/lib/ginkgoutil/ginkgo.go +++ b/lib/ginkgoutil/ginkgo.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" "github.com/onsi/gomega/format" "github.com/spf13/viper" "github.com/stretchr/testify/mock" @@ -21,12 +21,12 @@ import ( func SetupSuite() { format.UseStringerRepresentation = true // Otherwise error stacks have binary format. ReplaceGlobalLogger() - RegisterFailHandler(Fail) + gomega.RegisterFailHandler(ginkgo.Fail) } func RunSuite(t *testing.T, description string) { SetupSuite() - RunSpecs(t, description) + ginkgo.RunSpecs(t, description) } func ReplaceGlobalLogger() *zap.Logger { @@ -39,7 +39,7 @@ func ReplaceGlobalLogger() *zap.Logger { func NewLogger() *zap.Logger { conf := zap.NewDevelopmentConfig() enc := zapcore.NewConsoleEncoder(conf.EncoderConfig) - core := zapcore.NewCore(enc, zapcore.AddSync(GinkgoWriter), zap.DebugLevel) + core := zapcore.NewCore(enc, zapcore.AddSync(ginkgo.GinkgoWriter), zap.DebugLevel) log := zap.New(core, zap.AddCaller(), zap.AddStacktrace(zap.DPanicLevel)) return log } @@ -51,18 +51,18 @@ type Mock interface { func AssertExpectations(mocks ...Mock) { for _, m := range mocks { - m.AssertExpectations(GinkgoT(1)) + m.AssertExpectations(ginkgo.GinkgoT(1)) } } func AssertNotCalled(mock Mock, methodName string) { - mock.AssertNotCalled(GinkgoT(1), methodName) + mock.AssertNotCalled(ginkgo.GinkgoT(1), methodName) } func ParseYAML(data string) map[string]interface{} { v := viper.New() v.SetConfigType("yaml") err := v.ReadConfig(strings.NewReader(data)) - Expect(err).NotTo(HaveOccurred()) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) return v.AllSettings() } diff --git a/lib/ginkgoutil/matchers.go b/lib/ginkgoutil/matchers.go index 5ecf59181..8049198d2 100644 --- a/lib/ginkgoutil/matchers.go +++ b/lib/ginkgoutil/matchers.go @@ -8,11 +8,11 @@ package ginkgoutil import ( "reflect" - . "github.com/onsi/gomega" + "github.com/onsi/gomega" ) func ExpectFuncsEqual(f1, f2 interface{}) { val1 := reflect.ValueOf(f1) val2 := reflect.ValueOf(f2) - Expect(val1.Pointer()).To(Equal(val2.Pointer())) + gomega.Expect(val1.Pointer()).To(gomega.Equal(val2.Pointer())) } diff --git a/lib/ioutil2/reader.go b/lib/ioutil2/reader.go index 261e93de7..c70bf25f4 100644 --- a/lib/ioutil2/reader.go +++ b/lib/ioutil2/reader.go @@ -41,9 +41,9 @@ func (r *MultiPassReader) Read(p []byte) (n int, err error) { return } -func (r *MultiPassReader) PassesLeft() int { - return r.PassesLeft() -} +// func (r *MultiPassReader) PassesLeft() int { +// return r.PassesLeft() +// } func (r *MultiPassReader) Unwrap() io.Reader { return r.rs diff --git a/lib/netutil/dial.go b/lib/netutil/dial.go index 71709873f..cc7b7527b 100644 --- a/lib/netutil/dial.go +++ b/lib/netutil/dial.go @@ -42,7 +42,7 @@ func NewDNSCachingDialer(dialer Dialer, cache DNSCache) DialerFunc { remoteAddr := conn.RemoteAddr().(*net.TCPAddr) _, port, err := net.SplitHostPort(addr) if err != nil { - conn.Close() + _ = conn.Close() return nil, errors.Wrap(err, "invalid address, but successful dial - should not happen") } cache.Add(addr, net.JoinHostPort(remoteAddr.IP.String(), port)) @@ -78,7 +78,7 @@ func WarmDNSCache(c DNSCache, addr string) error { if err != nil { return err } - conn.Close() + _ = conn.Close() return nil } diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index baee6a76a..617e0aacd 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -6,32 +6,32 @@ import ( "strconv" "testing" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" - "github.com/pkg/errors" "github.com/yandex/pandora/lib/ginkgoutil" netmock "github.com/yandex/pandora/lib/netutil/mocks" + "github.com/pkg/errors" ) func TestNetutil(t *testing.T) { ginkgoutil.RunSuite(t, "Netutil Suite") } -var _ = Describe("DNS", func() { +var _ = ginkgo.Describe("DNS", func() { - It("lookup reachable", func() { + ginkgo.It("lookup reachable", func() { listener, err := net.ListenTCP("tcp4", nil) - defer listener.Close() - Expect(err).NotTo(HaveOccurred()) + defer func() { _ = listener.Close() }() + gomega.Expect(err).NotTo(gomega.HaveOccurred()) port := strconv.Itoa(listener.Addr().(*net.TCPAddr).Port) addr := "localhost:" + port expectedResolved := "127.0.0.1:" + port resolved, err := LookupReachable(addr) - Expect(err).NotTo(HaveOccurred()) - Expect(resolved).To(Equal(expectedResolved)) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resolved).To(gomega.Equal(expectedResolved)) }) const ( @@ -39,19 +39,19 @@ var _ = Describe("DNS", func() { resolved = "[::1]:8888" ) - It("cache", func() { + ginkgo.It("cache", func() { cache := &SimpleDNSCache{} got, ok := cache.Get(addr) - Expect(ok).To(BeFalse()) - Expect(got).To(BeEmpty()) + gomega.Expect(ok).To(gomega.BeFalse()) + gomega.Expect(got).To(gomega.BeEmpty()) cache.Add(addr, resolved) got, ok = cache.Get(addr) - Expect(ok).To(BeTrue()) - Expect(got).To(Equal(resolved)) + gomega.Expect(ok).To(gomega.BeTrue()) + gomega.Expect(got).To(gomega.Equal(resolved)) }) - It("Dialer cache miss", func() { + ginkgo.It("Dialer cache miss", func() { ctx := context.Background() mockConn := &netmock.Conn{} mockConn.On("RemoteAddr").Return(&net.TCPAddr{ @@ -66,13 +66,13 @@ var _ = Describe("DNS", func() { testee := NewDNSCachingDialer(dialer, cache) conn, err := testee.DialContext(ctx, "tcp", addr) - Expect(err).NotTo(HaveOccurred()) - Expect(conn).To(Equal(mockConn)) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(conn).To(gomega.Equal(mockConn)) ginkgoutil.AssertExpectations(mockConn, cache, dialer) }) - It("Dialer cache hit", func() { + ginkgo.It("Dialer cache hit", func() { ctx := context.Background() mockConn := &netmock.Conn{} cache := &netmock.DNSCache{} @@ -82,13 +82,13 @@ var _ = Describe("DNS", func() { testee := NewDNSCachingDialer(dialer, cache) conn, err := testee.DialContext(ctx, "tcp", addr) - Expect(err).NotTo(HaveOccurred()) - Expect(conn).To(Equal(mockConn)) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(conn).To(gomega.Equal(mockConn)) ginkgoutil.AssertExpectations(mockConn, cache, dialer) }) - It("Dialer cache miss err", func() { + ginkgo.It("Dialer cache miss err", func() { ctx := context.Background() expectedErr := errors.New("dial failed") cache := &netmock.DNSCache{} @@ -98,8 +98,8 @@ var _ = Describe("DNS", func() { testee := NewDNSCachingDialer(dialer, cache) conn, err := testee.DialContext(ctx, "tcp", addr) - Expect(err).To(Equal(expectedErr)) - Expect(conn).To(BeNil()) + gomega.Expect(err).To(gomega.Equal(expectedErr)) + gomega.Expect(conn).To(gomega.BeNil()) ginkgoutil.AssertExpectations(cache, dialer) }) diff --git a/lib/testutil/matchers.go b/lib/testutil/matchers.go index cda57389c..78d6d268d 100644 --- a/lib/testutil/matchers.go +++ b/lib/testutil/matchers.go @@ -26,7 +26,7 @@ var _ TestingT = &flakyT{} func (ff *flakyT) Logf(format string, args ...interface{}) { getHelper(ff.t).Helper() - ff.Logf(format, args...) + ff.t.Logf(format, args...) } func (ff *flakyT) Errorf(format string, args ...interface{}) { diff --git a/lib/zaputil/stack_extract_core.go b/lib/zaputil/stack_extract_core.go index 4387012a6..e596912b9 100644 --- a/lib/zaputil/stack_extract_core.go +++ b/lib/zaputil/stack_extract_core.go @@ -75,7 +75,7 @@ func (c *errStackExtractCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) func (c *errStackExtractCore) cloneBuffer() zapBuffer { clone := getBuffer() - clone.Write(c.stacksBuff.Bytes()) + _, _ = clone.Write(c.stacksBuff.Bytes()) return clone } diff --git a/lib/zaputil/stack_extract_core_test.go b/lib/zaputil/stack_extract_core_test.go index c208c4048..1f09ee8a3 100644 --- a/lib/zaputil/stack_extract_core_test.go +++ b/lib/zaputil/stack_extract_core_test.go @@ -47,11 +47,11 @@ var _ = Describe("stack_extract_core", func() { testee = testee.With(noStackFields1()) entry := zapcore.Entry{Message: "test"} - testee.Write(entry, noStackFields2()) + _ = testee.Write(entry, noStackFields2()) Expect(logs.Len()).To(Equal(1)) Expect(logs.All()[0]).To(Equal( - observer.LoggedEntry{entry, append(noStackFields1(), noStackFields2()...)}, + observer.LoggedEntry{Entry: entry, Context: append(noStackFields1(), noStackFields2()...)}, )) }) @@ -67,15 +67,15 @@ var _ = Describe("stack_extract_core", func() { fieldsCopy := make([]zapcore.Field, len(fields)) copy(fieldsCopy, fields) entry := zapcore.Entry{Message: "test"} - testee.Write(entry, fields) + _ = testee.Write(entry, fields) expectedEntry := entry expectedEntry.Stack = "error stacktrace:" + sampleStack Expect(logs.Len()).To(Equal(1)) Expect(logs.All()[0]).To(Equal( observer.LoggedEntry{ - expectedEntry, - append(noStackFields1(), zap.String("error", sampleErrMsg)), + Entry: expectedEntry, + Context: append(noStackFields1(), zap.String("error", sampleErrMsg)), }, )) Expect(fields).To(Equal(fieldsCopy)) @@ -95,15 +95,15 @@ var _ = Describe("stack_extract_core", func() { copy(fieldsCopy, fields) entry := zapcore.Entry{Message: "test"} testee = testee.With(fields) - testee.Write(entry, nil) + _ = testee.Write(entry, nil) expectedEntry := entry expectedEntry.Stack = "error stacktrace:" + sampleStack Expect(logs.Len()).To(Equal(1)) Expect(logs.All()[0]).To(Equal( observer.LoggedEntry{ - expectedEntry, - append(noStackFields1(), zap.Error(sampleCause)), + Entry: expectedEntry, + Context: append(noStackFields1(), zap.Error(sampleCause)), }, )) Expect(fields).To(Equal(fieldsCopy)) @@ -120,15 +120,15 @@ var _ = Describe("stack_extract_core", func() { const entryStack = "entry stack" entry := zapcore.Entry{Message: "test", Stack: entryStack} const customKey = "custom-key" - testee.Write(entry, []zapcore.Field{zap.NamedError(customKey, sampleErr)}) + _ = testee.Write(entry, []zapcore.Field{zap.NamedError(customKey, sampleErr)}) expectedEntry := entry expectedEntry.Stack = entryStack + "\n" + customKey + " stacktrace:" + sampleStack Expect(logs.Len()).To(Equal(1)) Expect(logs.All()[0]).To(Equal( observer.LoggedEntry{ - expectedEntry, - []zapcore.Field{zap.String(customKey, sampleErrMsg)}, + Entry: expectedEntry, + Context: []zapcore.Field{zap.String(customKey, sampleErrMsg)}, }, )) }) From bd0f57785d6dc0957c77ce5d562ce5b9bd6ef111 Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 22 Jan 2021 14:37:44 +0300 Subject: [PATCH 18/80] change atomic import ref:bf729f984b64237237db2eadb01cadd252f637c2 --- lib/monitoring/counter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/monitoring/counter.go b/lib/monitoring/counter.go index 405e52cb4..17d4e8972 100644 --- a/lib/monitoring/counter.go +++ b/lib/monitoring/counter.go @@ -9,7 +9,7 @@ import ( "expvar" "strconv" - "github.com/uber-go/atomic" + "go.uber.org/atomic" ) // TODO: use one rcrowley/go-metrics instead. From 3de6d2ccf5cdcca511b1e8e1b8ac7e8432401161 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 2 Feb 2021 16:31:05 +0300 Subject: [PATCH 19/80] add step schedule for pandora ref:0fa995d105e62dbe182c30c0343dd689f814269d --- core/import/import.go | 1 + core/schedule/step.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 core/schedule/step.go diff --git a/core/import/import.go b/core/import/import.go index 358d1b05d..cbf1a440c 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -87,6 +87,7 @@ func Import(fs afero.Fs) { register.Limiter("const", schedule.NewConstConf) register.Limiter("once", schedule.NewOnceConf) register.Limiter("unlimited", schedule.NewUnlimitedConf) + register.Limiter("step", schedule.NewStepConf) register.Limiter(compositeScheduleKey, schedule.NewCompositeConf) config.AddTypeHook(sinkStringHook) diff --git a/core/schedule/step.go b/core/schedule/step.go new file mode 100644 index 000000000..aca5b2e6e --- /dev/null +++ b/core/schedule/step.go @@ -0,0 +1,37 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package schedule + +import ( + "time" + + "github.com/yandex/pandora/core" +) + +func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule { + var nexts []core.Schedule + + if from == to { + return NewConst(from, duration) + } + + for i := from; i <= to; i += float64(step) { + nexts = append(nexts, NewConst(i, duration)) + } + + return NewCompositeConf(CompositeConf{nexts}) +} + +type StepConfig struct { + From float64 `validate:"min=0"` + To float64 `validate:"min=0"` + Step int64 + Duration time.Duration `validate:"min-time=1ms"` +} + +func NewStepConf(conf StepConfig) core.Schedule { + return NewStep(conf.From, conf.To, conf.Step, conf.Duration) +} From 19a2794c851bad214a17b61893e3b29a31506412 Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 4 Feb 2021 17:41:57 +0300 Subject: [PATCH 20/80] add step validation and test ref:10b664892da638e82ce5aa82013c55ef07217037 --- core/schedule/schedule_suite_test.go | 15 +++++++++++++++ core/schedule/step.go | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index 0658482bd..b63469a7a 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -192,6 +192,21 @@ var _ = Describe("line", func() { }) +var _ = Describe("step", func() { + It("", func() { + conf := StepConfig{ + From: 1, + To: 2, + Step: 1, + Duration: 2 * time.Second, + } + testee := NewStepConf(conf) + Expect(testee.Left()).To(Equal(6)) + + }) + +}) + func BenchmarkLineSchedule(b *testing.B) { schedule := NewLine(0, float64(b.N), 2*time.Second) benchmarkScheduleNext(b, schedule) diff --git a/core/schedule/step.go b/core/schedule/step.go index aca5b2e6e..7f48598ca 100644 --- a/core/schedule/step.go +++ b/core/schedule/step.go @@ -26,9 +26,9 @@ func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule } type StepConfig struct { - From float64 `validate:"min=0"` - To float64 `validate:"min=0"` - Step int64 + From float64 `validate:"min=0"` + To float64 `validate:"min=0"` + Step int64 `validate:"min=1"` Duration time.Duration `validate:"min-time=1ms"` } From f8583593e2b10cd4f3f0a25e423a6e7c13371ab5 Mon Sep 17 00:00:00 2001 From: ligreen Date: Wed, 3 Mar 2021 15:21:29 +0300 Subject: [PATCH 21/80] allow wrong uri-style format ref:6e67a06893544d01c9aa27fc001d93a713a6ccbe --- components/phttp/ammo/simple/uri/decoder.go | 8 +++----- components/phttp/ammo/simple/uri/decoder_test.go | 1 - go.mod | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index 5980fb466..4a66b2a2e 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -48,13 +48,11 @@ func (d *decoder) Decode(line []byte) error { return errors.New("empty line") } line = bytes.TrimSpace(line) - switch line[0] { - case '/': - return d.decodeURI(line) - case '[': + if line[0] == '[' { return d.decodeHeader(line) + } else { + return d.decodeURI(line) } - return errors.New("every line should begin with '[' or '/'") } func (d *decoder) decodeURI(line []byte) error { diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index 37f6cf647..4a35ebcdd 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -43,7 +43,6 @@ var _ = Describe("Decoder", func() { Expect(decoder.header).To(BeEmpty()) }, Entry("empty line", ""), - Entry("line start", "test"), Entry("empty header", "[ ]"), Entry("no closing brace", "[key: val "), Entry("no header key", "[ : val ]"), diff --git a/go.mod b/go.mod index 838b874e3..eeba8ce32 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/yandex/pandora +go 1.15 + require ( github.com/BurntSushi/toml v0.3.1 // indirect github.com/asaskevich/govalidator v0.0.0-20171111151018-521b25f4b05f @@ -33,7 +35,6 @@ require ( github.com/spf13/viper v1.0.0 github.com/stretchr/objx v0.1.0 // indirect github.com/stretchr/testify v1.2.1 - github.com/uber-go/atomic v1.3.0 go.uber.org/atomic v1.3.1 go.uber.org/multierr v1.1.0 // indirect go.uber.org/zap v1.7.1 From 46808db12d74ea1abd5b2528df2751f0c4e51ce1 Mon Sep 17 00:00:00 2001 From: ligreen Date: Sat, 15 May 2021 00:27:57 +0300 Subject: [PATCH 22/80] pandora grpc gun ref:79b63189a1efd28115e60f53c22d2e8b8535a655 --- components/grpc/core.go | 142 +++++++++++++++++++++++++++++++ components/grpc/import/import.go | 23 +++++ main.go | 2 + 3 files changed, 167 insertions(+) create mode 100644 components/grpc/core.go create mode 100644 components/grpc/import/import.go diff --git a/components/grpc/core.go b/components/grpc/core.go new file mode 100644 index 000000000..d3b5f45bd --- /dev/null +++ b/components/grpc/core.go @@ -0,0 +1,142 @@ +package grpc + +import ( + "context" + "encoding/json" + "log" + "time" + + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/jhump/protoreflect/desc" + "github.com/jhump/protoreflect/dynamic" + "github.com/jhump/protoreflect/dynamic/grpcdynamic" + "github.com/jhump/protoreflect/grpcreflect" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" +) + +type Ammo struct { + Tag string `json:"tag"` + Call string `json:"call"` + Metadata map[string]string `json:"metadata"` + Payload map[string]interface{} `json:"payload"` +} + +type Sample struct { + URL string + ShootTimeSeconds float64 +} + +type GunConfig struct { + Target string `validate:"required"` +} + +type Gun struct { + client *grpc.ClientConn + conf GunConfig + aggr core.Aggregator + core.GunDeps + + stub grpcdynamic.Stub + services map[string]desc.MethodDescriptor +} + +func NewGun(conf GunConfig) *Gun { + return &Gun{conf: conf} +} + +func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { + conn, err := grpc.Dial( + g.conf.Target, + grpc.WithInsecure(), + grpc.WithTimeout(time.Second), + grpc.WithUserAgent("load test, pandora universal grpc shooter")) + if err != nil { + log.Fatalf("FATAL: grpc.Dial failed\n %s\n", err) + } + g.client = conn + g.aggr = aggr + g.GunDeps = deps + g.stub = grpcdynamic.NewStub(conn) + + meta := make(metadata.MD) + refCtx := metadata.NewOutgoingContext(context.Background(), meta) + refClient := grpcreflect.NewClient(refCtx, reflectpb.NewServerReflectionClient(conn)) + listServices, err := refClient.ListServices() + if err != nil { + log.Fatalf("Fatal: failed to get services list\n %s\n", err) + } + g.services = make(map[string]desc.MethodDescriptor) + for _, s := range listServices { + service, err := refClient.ResolveService(s) + if err != nil { + log.Fatalf("FATAL ResolveService: %s", err) + } + listMethods := service.GetMethods() + for _, m := range listMethods { + g.services[m.GetFullyQualifiedName()] = *m + } + } + + return nil +} + +func (g *Gun) Shoot(ammo core.Ammo) { + customAmmo := ammo.(*Ammo) + g.shoot(customAmmo) +} + +func (g *Gun) shoot(ammo *Ammo) { + + code := 0 + sample := netsample.Acquire(ammo.Tag) + defer func() { + sample.SetProtoCode(code) + g.aggr.Report(sample) + }() + + method, ok := g.services[ammo.Call] + if !ok { + log.Fatalf("Fatal: No such method %s\n", ammo.Call) + return + } + + log.Printf("MethodDescriptor: %s", method.GetInputType()) + payloadJSON, err := json.Marshal(ammo.Payload) + if err != nil { + log.Fatalf("FATAL: Payload parsing error %s\n", err) + return + } + + md := method.GetInputType() + message := dynamic.NewMessage(md) + err = message.UnmarshalJSON(payloadJSON) + if err != nil { + code = 400 + log.Printf("BAD REQUEST: %s", err) + return + } + + meta := make(metadata.MD) + if ammo.Metadata != nil && len(ammo.Metadata) > 0 { + for key, value := range ammo.Metadata { + meta = metadata.Pairs(key, value) + } + } + + ctx := metadata.NewOutgoingContext(context.Background(), meta) + + out, err := g.stub.InvokeRpc(ctx, &method, message) + if err != nil { + code = 0 + log.Printf("BAD REQUEST: %s\n", err) + } + if out != nil { + code = 200 + } else { + code = 400 + } + +} diff --git a/components/grpc/import/import.go b/components/grpc/import/import.go new file mode 100644 index 000000000..9271e4281 --- /dev/null +++ b/components/grpc/import/import.go @@ -0,0 +1,23 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package example + +import ( + "github.com/yandex/pandora/components/grpc" + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" + "github.com/yandex/pandora/core/register" +) + +func Import() { + coreimport.RegisterCustomJSONProvider("grpc/json", func() core.Ammo { return &grpc.Ammo{} }) + + register.Gun("grpc", grpc.NewGun, func() grpc.GunConfig { + return grpc.GunConfig{ + Target: "default target", + } + }) +} diff --git a/main.go b/main.go index be760ad7b..744067b8b 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "github.com/yandex/pandora/cli" example "github.com/yandex/pandora/components/example/import" + grpc "github.com/yandex/pandora/components/grpc/import" phttp "github.com/yandex/pandora/components/phttp/import" coreimport "github.com/yandex/pandora/core/import" ) @@ -21,6 +22,7 @@ func main() { coreimport.Import(fs) phttp.Import(fs) example.Import() + grpc.Import() cli.Run() } From cae5667f398306ad46ba9392603d36264e77f360 Mon Sep 17 00:00:00 2001 From: ligreen Date: Mon, 24 May 2021 22:22:41 +0300 Subject: [PATCH 23/80] fix for Services, that does not expose the ServiceDescriptor ref:96e9fd88edab9ab47240002d9cd1d17691687deb --- components/grpc/core.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index d3b5f45bd..dd2fa7484 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -8,10 +8,12 @@ import ( "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" "github.com/jhump/protoreflect/dynamic/grpcdynamic" "github.com/jhump/protoreflect/grpcreflect" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/metadata" reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" @@ -61,18 +63,23 @@ func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { g.GunDeps = deps g.stub = grpcdynamic.NewStub(conn) + log := deps.Log + meta := make(metadata.MD) refCtx := metadata.NewOutgoingContext(context.Background(), meta) refClient := grpcreflect.NewClient(refCtx, reflectpb.NewServerReflectionClient(conn)) listServices, err := refClient.ListServices() if err != nil { - log.Fatalf("Fatal: failed to get services list\n %s\n", err) + log.Fatal("Fatal: failed to get services list\n %s\n", zap.Error(err)) } g.services = make(map[string]desc.MethodDescriptor) for _, s := range listServices { service, err := refClient.ResolveService(s) if err != nil { - log.Fatalf("FATAL ResolveService: %s", err) + if grpcreflect.IsElementNotFoundError(err) { + continue + } + log.Fatal("FATAL ResolveService: %s", zap.Error(err)) } listMethods := service.GetMethods() for _, m := range listMethods { @@ -103,7 +110,6 @@ func (g *Gun) shoot(ammo *Ammo) { return } - log.Printf("MethodDescriptor: %s", method.GetInputType()) payloadJSON, err := json.Marshal(ammo.Payload) if err != nil { log.Fatalf("FATAL: Payload parsing error %s\n", err) @@ -115,7 +121,7 @@ func (g *Gun) shoot(ammo *Ammo) { err = message.UnmarshalJSON(payloadJSON) if err != nil { code = 400 - log.Printf("BAD REQUEST: %s", err) + log.Printf("BAD REQUEST: %s\n", err) return } From 7d42290c9326d18bcb6af3058dfa51492bdc6247 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 25 May 2021 13:39:33 +0300 Subject: [PATCH 24/80] add grpc call and response logging ref:5f85587231371af5843891c4b354f7a649e41f46 --- components/grpc/core.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index dd2fa7484..cc9157cb0 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -36,9 +36,10 @@ type GunConfig struct { } type Gun struct { - client *grpc.ClientConn - conf GunConfig - aggr core.Aggregator + DebugLog bool + client *grpc.ClientConn + conf GunConfig + aggr core.Aggregator core.GunDeps stub grpcdynamic.Stub @@ -65,6 +66,11 @@ func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { log := deps.Log + if ent := log.Check(zap.DebugLevel, "Gun bind"); ent != nil { + // Enable debug level logging during shooting. Creating log entries isn't free. + g.DebugLog = true + } + meta := make(metadata.MD) refCtx := metadata.NewOutgoingContext(context.Background(), meta) refClient := grpcreflect.NewClient(refCtx, reflectpb.NewServerReflectionClient(conn)) @@ -144,5 +150,9 @@ func (g *Gun) shoot(ammo *Ammo) { } else { code = 400 } + if g.DebugLog { + g.Log.Debug("Request:", zap.Stringer("method", &method), zap.Stringer("message", message)) + g.Log.Debug("Response:", zap.Stringer("resp", out)) + } } From 2393f364537a3b5153d66852af345e7f28fe05c2 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 25 May 2021 16:46:49 +0300 Subject: [PATCH 25/80] bump version ref:67e34873c76b1c01b20afdbfa5b6cb6bb9dc0465 --- cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index 8c9c3c033..3ac6dd7c7 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -25,7 +25,7 @@ import ( "github.com/yandex/pandora/lib/zaputil" ) -const Version = "0.3.2" +const Version = "0.3.3" const defaultConfigFile = "load" const stdinConfigSelector = "-" From fbfa7ef9a2e00c10514ae5935ccd91c7e250ee29 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 1 Jun 2021 19:35:13 +0300 Subject: [PATCH 26/80] fixing goimports ref:d121f7ad7b438ba92fc7f561cee4575d09920851 --- components/example/import/import_suite_test.go | 2 +- components/phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/uri/provider_test.go | 2 +- components/phttp/client.go | 2 +- components/phttp/connect.go | 2 +- components/phttp/mocks/ammo.go | 2 +- core/aggregator/encoder_test.go | 1 - core/aggregator/jsonlines.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/config/validations.go | 1 - core/config/validator.go | 1 - core/coretest/config.go | 2 +- core/coretest/schedule.go | 2 +- core/datasource/file_test.go | 2 +- core/engine/instance_test.go | 8 ++++---- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/pluginconfig/hooks_test.go | 4 ++-- lib/errutil/errutil.go | 1 - lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 2 +- 23 files changed, 24 insertions(+), 28 deletions(-) diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index 6c231f751..e1432a1c3 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 9912eef1d..0a999a8b5 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/spf13/afero" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index ca2785e58..a0d05411b 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" + "github.com/pkg/errors" "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" - "github.com/pkg/errors" ) const testFile = "./ammo.uri" diff --git a/components/phttp/client.go b/components/phttp/client.go index a0eefdf65..0aea86e07 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" + "github.com/pkg/errors" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" - "github.com/pkg/errors" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index 1f94c6707..bf8340cdb 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" - "github.com/yandex/pandora/lib/netutil" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/netutil" ) type ConnectGunConfig struct { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index bfde0c8f1..cb43bff1b 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" - netsample "github.com/yandex/pandora/core/aggregator/netsample" mock "github.com/stretchr/testify/mock" + netsample "github.com/yandex/pandora/core/aggregator/netsample" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index e55d6fac0..a9389eb15 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -12,7 +12,6 @@ import ( "testing" "time" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index efde4eaf4..065a721cd 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,8 +9,8 @@ import ( "bufio" "io" - "github.com/yandex/pandora/lib/ioutil2" jsoniter "github.com/json-iterator/go" + "github.com/yandex/pandora/lib/ioutil2" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/config" diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 0acfb6465..8e1dd9474 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( - core "github.com/yandex/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index d8f302c8e..b084a510b 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/config/validations.go b/core/config/validations.go index 18eaff0b1..110e597ec 100644 --- a/core/config/validations.go +++ b/core/config/validations.go @@ -10,7 +10,6 @@ import ( "github.com/asaskevich/govalidator" "github.com/c2h5oh/datasize" - "gopkg.in/bluesuncorp/validator.v9" ) func MinTimeValidation(fl validator.FieldLevel) bool { diff --git a/core/config/validator.go b/core/config/validator.go index d031c5c3b..3fbc51eb7 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -5,7 +5,6 @@ package config import ( "github.com/pkg/errors" - "gopkg.in/bluesuncorp/validator.v9" ) var validations = []struct { diff --git a/core/coretest/config.go b/core/coretest/config.go index 74e5fd527..33204b753 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( + "github.com/onsi/gomega" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/onsi/gomega" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index e720831d7..73d9511d2 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" - "github.com/yandex/pandora/core" "github.com/onsi/gomega" + "github.com/yandex/pandora/core" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index f0c93e0b1..714655a27 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "github.com/yandex/pandora/core/coretest" "github.com/spf13/afero" + "github.com/yandex/pandora/core/coretest" ) func TestFileSource(t *testing.T) { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index d7b837f72..e13287b1c 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index 600cbca28..b325dcbc9 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" - "github.com/yandex/pandora/core" "github.com/stretchr/testify/mock" + "github.com/yandex/pandora/core" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index 4fbd2b19d..aa69c41d7 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( - core "github.com/yandex/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index e5eaf9ecd..fd3cb0b1e 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" - core "github.com/yandex/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 727202df5..7237d31e2 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/plugin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/plugin" ) func init() { diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index bffd469b7..4aa97551e 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,7 +8,6 @@ package errutil import ( "context" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index 85086bde5..7a82d5197 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 617e0aacd..8103e13d0 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" + "github.com/pkg/errors" "github.com/yandex/pandora/lib/ginkgoutil" netmock "github.com/yandex/pandora/lib/netutil/mocks" - "github.com/pkg/errors" ) func TestNetutil(t *testing.T) { From ab9104ad1267815dd8f85f141128b1669d6bd980 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 1 Jun 2021 19:35:19 +0300 Subject: [PATCH 27/80] add grpc status codes converter ref:c312d2f527fb793f2e0ac3d3ba3a3fe7e6d6e818 --- components/grpc/core.go | 51 ++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index cc9157cb0..097ada8cf 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -15,8 +15,10 @@ import ( "github.com/jhump/protoreflect/grpcreflect" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" + "google.golang.org/grpc/status" ) type Ammo struct { @@ -139,20 +141,53 @@ func (g *Gun) shoot(ammo *Ammo) { } ctx := metadata.NewOutgoingContext(context.Background(), meta) - out, err := g.stub.InvokeRpc(ctx, &method, message) + code = convertGrpcStatus(err) + if err != nil { - code = 0 - log.Printf("BAD REQUEST: %s\n", err) - } - if out != nil { - code = 200 - } else { - code = 400 + log.Printf("Response error: %s\n", err) } + if g.DebugLog { g.Log.Debug("Request:", zap.Stringer("method", &method), zap.Stringer("message", message)) g.Log.Debug("Response:", zap.Stringer("resp", out)) } } + +func convertGrpcStatus(err error) int { + s := status.Convert(err) + + switch s.Code() { + case codes.OK: + return 200 + case codes.Canceled: + return 499 + case codes.InvalidArgument: + return 400 + case codes.DeadlineExceeded: + return 504 + case codes.NotFound: + return 404 + case codes.AlreadyExists: + return 409 + case codes.PermissionDenied: + return 403 + case codes.ResourceExhausted: + return 429 + case codes.FailedPrecondition: + return 400 + case codes.Aborted: + return 409 + case codes.OutOfRange: + return 400 + case codes.Unimplemented: + return 501 + case codes.Unavailable: + return 503 + case codes.Unauthenticated: + return 401 + default: + return 500 + } +} From 9e62a276528fe94b00220e6569e1e4cd6e5cfae5 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 1 Jun 2021 21:43:13 +0300 Subject: [PATCH 28/80] update go version ref:c8807e59c2c0eee27e3fc7ed27bec98c0203285e --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9679cc1b5..2fbdf73d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.11.x + - 1.15.x env: - GO111MODULE=on From 9999ba816fc737399a6f2187b0c6bc15a67fbbff Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 3 Jun 2021 23:23:55 +0300 Subject: [PATCH 29/80] debug experiment ref:ddc9f43688820d1408057c1d3be57e555c8284dc --- acceptance_tests/acceptance_suite_test.go | 6 ++--- cli/cli.go | 6 ++--- cli/expvar.go | 4 ++-- components/example/example.go | 4 ++-- components/example/import/import.go | 4 ++-- .../example/import/import_suite_test.go | 2 +- components/grpc/core.go | 4 ++-- components/grpc/import/import.go | 8 +++---- components/phttp/ammo/simple/ammo.go | 4 ++-- .../simple/jsonline/jsonline_suite_test.go | 6 ++--- .../phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/provider.go | 2 +- components/phttp/ammo/simple/raw/provider.go | 2 +- .../phttp/ammo/simple/raw/provider_test.go | 4 ++-- .../phttp/ammo/simple/raw/raw_suite_test.go | 2 +- components/phttp/ammo/simple/uri/decoder.go | 2 +- .../phttp/ammo/simple/uri/decoder_test.go | 4 ++-- components/phttp/ammo/simple/uri/provider.go | 2 +- .../phttp/ammo/simple/uri/provider_test.go | 4 ++-- .../phttp/ammo/simple/uri/uri_suite_test.go | 2 +- components/phttp/base.go | 4 ++-- components/phttp/base_test.go | 10 ++++---- components/phttp/client.go | 4 ++-- components/phttp/connect.go | 2 +- components/phttp/connect_test.go | 2 +- components/phttp/core.go | 4 ++-- components/phttp/http_test.go | 6 ++--- components/phttp/import/import.go | 14 +++++------ components/phttp/import/import_suite_test.go | 4 ++-- components/phttp/mocks/ammo.go | 2 +- components/phttp/phttp_suite_test.go | 2 +- core/aggregator/discard.go | 4 ++-- core/aggregator/encoder.go | 6 ++--- core/aggregator/encoder_test.go | 11 +++++---- core/aggregator/jsonlines.go | 8 +++---- core/aggregator/jsonlines_test.go | 4 ++-- core/aggregator/log.go | 2 +- core/aggregator/mocks/sample_encode_closer.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/aggregator.go | 2 +- .../netsample/netsample_suite_test.go | 2 +- core/aggregator/netsample/phout.go | 4 ++-- core/aggregator/netsample/phout_test.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/aggregator/netsample/test.go | 2 +- core/aggregator/reporter.go | 4 ++-- core/aggregator/reporter_test.go | 4 ++-- core/aggregator/test.go | 2 +- core/config/hooks.go | 2 +- core/config/validations.go | 1 + core/config/validator.go | 1 + core/core.go | 2 +- core/coretest/config.go | 4 ++-- core/coretest/schedule.go | 2 +- core/coretest/sink.go | 2 +- core/coretest/source.go | 4 ++-- core/coreutil/ammo.go | 2 +- core/coreutil/data.go | 2 +- core/coreutil/sample.go | 2 +- core/coreutil/schedule.go | 2 +- core/coreutil/schedule_test.go | 2 +- core/coreutil/waiter.go | 2 +- core/coreutil/waiter_test.go | 2 +- core/datasink/file.go | 2 +- core/datasink/file_test.go | 2 +- core/datasink/std.go | 4 ++-- core/datasource/file.go | 2 +- core/datasource/file_test.go | 2 +- core/datasource/std.go | 4 ++-- core/engine/engine.go | 8 +++---- core/engine/engine_suite_test.go | 4 ++-- core/engine/engine_test.go | 14 +++++------ core/engine/instance.go | 6 ++--- core/engine/instance_test.go | 16 ++++++------- core/import/import.go | 24 +++++++++---------- core/import/import_suite_test.go | 12 +++++----- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/example_test.go | 2 +- core/plugin/plugin_suite_test.go | 2 +- core/plugin/pluginconfig/hooks.go | 6 ++--- core/plugin/pluginconfig/hooks_test.go | 4 ++-- core/plugin/ptest_test.go | 2 +- core/provider/chunk_decoder.go | 2 +- core/provider/decoder.go | 6 ++--- core/provider/json.go | 6 ++--- core/provider/json_test.go | 4 ++-- core/provider/num.go | 2 +- core/provider/num_test.go | 2 +- core/provider/provider_suite_test.go | 4 ++-- core/provider/queue.go | 2 +- core/register/register.go | 4 ++-- core/schedule/composite.go | 2 +- core/schedule/composite_test.go | 4 ++-- core/schedule/const.go | 2 +- core/schedule/do_at.go | 2 +- core/schedule/line.go | 2 +- core/schedule/once.go | 2 +- core/schedule/schedule_suite_test.go | 6 ++--- core/schedule/step.go | 2 +- core/schedule/unlilmited.go | 2 +- examples/custom_pandora/custom_main.go | 10 ++++---- go.mod | 2 +- lib/errutil/errutil.go | 1 + lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 4 ++-- lib/zaputil/zaputil_suite_test.go | 2 +- main.go | 10 ++++---- 109 files changed, 219 insertions(+), 215 deletions(-) diff --git a/acceptance_tests/acceptance_suite_test.go b/acceptance_tests/acceptance_suite_test.go index 6b14bb506..ec25a8fec 100644 --- a/acceptance_tests/acceptance_suite_test.go +++ b/acceptance_tests/acceptance_suite_test.go @@ -16,8 +16,8 @@ import ( "github.com/onsi/gomega/gexec" "go.uber.org/zap" - "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) var pandoraBin string @@ -34,7 +34,7 @@ func TestAcceptanceTests(t *testing.T) { args = append(args, "-tags", "debug") } var err error - pandoraBin, err = gexec.Build("github.com/yandex/pandora", args...) + pandoraBin, err = gexec.Build("a.yandex-team.ru/load/projects/pandora", args...) if err != nil { t.Fatal(err) } diff --git a/cli/cli.go b/cli/cli.go index 3ac6dd7c7..ee820193d 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -20,9 +20,9 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/engine" - "github.com/yandex/pandora/lib/zaputil" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/engine" + "a.yandex-team.ru/load/projects/pandora/lib/zaputil" ) const Version = "0.3.3" diff --git a/cli/expvar.go b/cli/expvar.go index ed8f436d9..6f3ca2f69 100644 --- a/cli/expvar.go +++ b/cli/expvar.go @@ -5,8 +5,8 @@ import ( "go.uber.org/zap" - "github.com/yandex/pandora/core/engine" - "github.com/yandex/pandora/lib/monitoring" + "a.yandex-team.ru/load/projects/pandora/core/engine" + "a.yandex-team.ru/load/projects/pandora/lib/monitoring" ) func newEngineMetrics() engine.Metrics { diff --git a/components/example/example.go b/components/example/example.go index f6dab2222..0e4cabb39 100644 --- a/components/example/example.go +++ b/components/example/example.go @@ -12,8 +12,8 @@ import ( "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/example/import/import.go b/components/example/import/import.go index d7c622c0d..a1f2257a3 100644 --- a/components/example/import/import.go +++ b/components/example/import/import.go @@ -6,8 +6,8 @@ package example import ( - "github.com/yandex/pandora/components/example" - "github.com/yandex/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/components/example" + "a.yandex-team.ru/load/projects/pandora/core/register" ) func Import() { diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index e1432a1c3..cec6a22cd 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/grpc/core.go b/components/grpc/core.go index 097ada8cf..cb7bd30be 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" diff --git a/components/grpc/import/import.go b/components/grpc/import/import.go index 9271e4281..19eda6ae8 100644 --- a/components/grpc/import/import.go +++ b/components/grpc/import/import.go @@ -6,10 +6,10 @@ package example import ( - "github.com/yandex/pandora/components/grpc" - "github.com/yandex/pandora/core" - coreimport "github.com/yandex/pandora/core/import" - "github.com/yandex/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/components/grpc" + "a.yandex-team.ru/load/projects/pandora/core" + coreimport "a.yandex-team.ru/load/projects/pandora/core/import" + "a.yandex-team.ru/load/projects/pandora/core/register" ) func Import() { diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 6db888e39..6bd30e2f7 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -8,8 +8,8 @@ package simple import ( "net/http" - "github.com/yandex/pandora/components/phttp" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/components/phttp" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go index d149cd1b7..15b4feae1 100644 --- a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go +++ b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go @@ -18,9 +18,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestJsonline(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 0a999a8b5..e40d37efd 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index dab3d110e..e671f9543 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index 428f42a95..ed4bfb288 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" ) /* diff --git a/components/phttp/ammo/simple/raw/provider_test.go b/components/phttp/ammo/simple/raw/provider_test.go index 547068f39..e75463d71 100644 --- a/components/phttp/ammo/simple/raw/provider_test.go +++ b/components/phttp/ammo/simple/raw/provider_test.go @@ -14,8 +14,8 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" ) const testFile = "./ammo.stpd" diff --git a/components/phttp/ammo/simple/raw/raw_suite_test.go b/components/phttp/ammo/simple/raw/raw_suite_test.go index a49bf9d98..dab54e31b 100644 --- a/components/phttp/ammo/simple/raw/raw_suite_test.go +++ b/components/phttp/ammo/simple/raw/raw_suite_test.go @@ -3,7 +3,7 @@ package raw import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestRaw(t *testing.T) { diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index 4a66b2a2e..3de592fa6 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" ) type decoder struct { diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index 4a35ebcdd..d7270016b 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -10,8 +10,8 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" ) func newAmmoPool() *sync.Pool { diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index c6070e980..2e97216a5 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" ) type Config struct { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index a0d05411b..ae7b0db69 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" "github.com/pkg/errors" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" ) const testFile = "./ammo.uri" diff --git a/components/phttp/ammo/simple/uri/uri_suite_test.go b/components/phttp/ammo/simple/uri/uri_suite_test.go index 43d23b7b3..d5b3b4072 100644 --- a/components/phttp/ammo/simple/uri/uri_suite_test.go +++ b/components/phttp/ammo/simple/uri/uri_suite_test.go @@ -3,7 +3,7 @@ package uri import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestUri(t *testing.T) { diff --git a/components/phttp/base.go b/components/phttp/base.go index 1409327ca..280a40542 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -15,8 +15,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) const ( diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index 7effd2ddd..1cd59d570 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -19,11 +19,11 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - ammomock "github.com/yandex/pandora/components/phttp/mocks" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" - "github.com/yandex/pandora/core/coretest" - "github.com/yandex/pandora/lib/ginkgoutil" + ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func testDeps() core.GunDeps { diff --git a/components/phttp/client.go b/components/phttp/client.go index 0aea86e07..74c809a06 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/lib/netutil" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index bf8340cdb..77c24e214 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" + "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/netutil" ) type ConnectGunConfig struct { diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index 7492fa7ca..b05a3565d 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -16,7 +16,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) var _ = Describe("connect", func() { diff --git a/components/phttp/core.go b/components/phttp/core.go index eeac62fd5..9138cff5c 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -8,8 +8,8 @@ package phttp import ( "net/http" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) //go:generate mockery -name=Ammo -case=underscore -outpkg=ammomock diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index f9a18d51b..01f012df4 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -18,9 +18,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - ammomock "github.com/yandex/pandora/components/phttp/mocks" - "github.com/yandex/pandora/core/aggregator/netsample" - "github.com/yandex/pandora/core/config" + ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/config" ) var _ = Describe("BaseGun", func() { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index 085aee608..f3e1e6f86 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -11,13 +11,13 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp" - "github.com/yandex/pandora/components/phttp/ammo/simple/jsonline" - "github.com/yandex/pandora/components/phttp/ammo/simple/raw" - "github.com/yandex/pandora/components/phttp/ammo/simple/uri" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/register" - "github.com/yandex/pandora/lib/netutil" + "a.yandex-team.ru/load/projects/pandora/components/phttp" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/jsonline" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/raw" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uri" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/lib/netutil" ) func Import(fs afero.Fs) { diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 6b4f5bc49..819bcd74b 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -9,8 +9,8 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - . "github.com/yandex/pandora/components/phttp" - "github.com/yandex/pandora/lib/ginkgoutil" + . "a.yandex-team.ru/load/projects/pandora/components/phttp" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index cb43bff1b..552710dab 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" + netsample "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" mock "github.com/stretchr/testify/mock" - netsample "github.com/yandex/pandora/core/aggregator/netsample" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/components/phttp/phttp_suite_test.go b/components/phttp/phttp_suite_test.go index 2dc671a62..7a4abc1f7 100644 --- a/components/phttp/phttp_suite_test.go +++ b/components/phttp/phttp_suite_test.go @@ -8,7 +8,7 @@ package phttp import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestPhttp(t *testing.T) { diff --git a/core/aggregator/discard.go b/core/aggregator/discard.go index 6dae8647f..91147cf3b 100644 --- a/core/aggregator/discard.go +++ b/core/aggregator/discard.go @@ -8,8 +8,8 @@ package aggregator import ( "context" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) // NewDiscard returns Aggregator that just throws reported ammo away. diff --git a/core/aggregator/encoder.go b/core/aggregator/encoder.go index 8faf680e8..eee7228e0 100644 --- a/core/aggregator/encoder.go +++ b/core/aggregator/encoder.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/errutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/errutil" ) type NewSampleEncoder func(w io.Writer, onFlush func()) SampleEncoder diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index a9389eb15..58adfe227 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -12,17 +12,18 @@ import ( "testing" "time" + "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/yandex/pandora/core" - aggregatemock "github.com/yandex/pandora/core/aggregator/mocks" - coremock "github.com/yandex/pandora/core/mocks" - iomock "github.com/yandex/pandora/lib/ioutil2/mocks" - "github.com/yandex/pandora/lib/testutil" + "a.yandex-team.ru/load/projects/pandora/core" + aggregatemock "a.yandex-team.ru/load/projects/pandora/core/aggregator/mocks" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + iomock "a.yandex-team.ru/load/projects/pandora/lib/ioutil2/mocks" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) type EncoderAggregatorTester struct { diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 065a721cd..68a31e44b 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,12 +9,12 @@ import ( "bufio" "io" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" jsoniter "github.com/json-iterator/go" - "github.com/yandex/pandora/lib/ioutil2" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) type JSONLineAggregatorConfig struct { diff --git a/core/aggregator/jsonlines_test.go b/core/aggregator/jsonlines_test.go index 3c2549f5d..b22575303 100644 --- a/core/aggregator/jsonlines_test.go +++ b/core/aggregator/jsonlines_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/datasink" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/datasink" ) type jsonTestData struct { diff --git a/core/aggregator/log.go b/core/aggregator/log.go index cf40e5ca3..a66c0dc9e 100644 --- a/core/aggregator/log.go +++ b/core/aggregator/log.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewLog() core.Aggregator { diff --git a/core/aggregator/mocks/sample_encode_closer.go b/core/aggregator/mocks/sample_encode_closer.go index 5e152cc15..befba9bda 100644 --- a/core/aggregator/mocks/sample_encode_closer.go +++ b/core/aggregator/mocks/sample_encode_closer.go @@ -4,7 +4,7 @@ package aggregatemock import ( mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" + core "a.yandex-team.ru/load/projects/pandora/core" ) // SampleEncodeCloser is an autogenerated mock type for the SampleEncodeCloser type diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 8e1dd9474..decef2669 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( + core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/aggregator.go b/core/aggregator/netsample/aggregator.go index 5295892ee..36240bdb9 100644 --- a/core/aggregator/netsample/aggregator.go +++ b/core/aggregator/netsample/aggregator.go @@ -3,7 +3,7 @@ package netsample import ( "context" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type Aggregator interface { diff --git a/core/aggregator/netsample/netsample_suite_test.go b/core/aggregator/netsample/netsample_suite_test.go index a243696ba..12c026191 100644 --- a/core/aggregator/netsample/netsample_suite_test.go +++ b/core/aggregator/netsample/netsample_suite_test.go @@ -3,7 +3,7 @@ package netsample import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestNetsample(t *testing.T) { diff --git a/core/aggregator/netsample/phout.go b/core/aggregator/netsample/phout.go index 7a770982c..066c3c616 100644 --- a/core/aggregator/netsample/phout.go +++ b/core/aggregator/netsample/phout.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) type PhoutConfig struct { diff --git a/core/aggregator/netsample/phout_test.go b/core/aggregator/netsample/phout_test.go index 95e734758..ea18777ba 100644 --- a/core/aggregator/netsample/phout_test.go +++ b/core/aggregator/netsample/phout_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) var _ = Describe("Phout", func() { diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index b084a510b..d8f302c8e 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/aggregator/netsample/test.go b/core/aggregator/netsample/test.go index 268bdc146..98d087df4 100644 --- a/core/aggregator/netsample/test.go +++ b/core/aggregator/netsample/test.go @@ -8,7 +8,7 @@ package netsample import ( "context" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type TestAggregator struct { diff --git a/core/aggregator/reporter.go b/core/aggregator/reporter.go index 5a3cfed1b..a47100a12 100644 --- a/core/aggregator/reporter.go +++ b/core/aggregator/reporter.go @@ -11,8 +11,8 @@ import ( "go.uber.org/atomic" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) type ReporterConfig struct { diff --git a/core/aggregator/reporter_test.go b/core/aggregator/reporter_test.go index 880ee14da..74f9592e1 100644 --- a/core/aggregator/reporter_test.go +++ b/core/aggregator/reporter_test.go @@ -13,8 +13,8 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" - coremock "github.com/yandex/pandora/core/mocks" - "github.com/yandex/pandora/lib/testutil" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) func TestReporter_DroppedErr(t *testing.T) { diff --git a/core/aggregator/test.go b/core/aggregator/test.go index a57b667f7..36f7f4bda 100644 --- a/core/aggregator/test.go +++ b/core/aggregator/test.go @@ -9,7 +9,7 @@ import ( "context" "sync" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewTest() *Test { diff --git a/core/config/hooks.go b/core/config/hooks.go index 2b4df157a..3d627d53a 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) var InvalidURLError = errors.New("string is not valid URL") diff --git a/core/config/validations.go b/core/config/validations.go index 110e597ec..18eaff0b1 100644 --- a/core/config/validations.go +++ b/core/config/validations.go @@ -10,6 +10,7 @@ import ( "github.com/asaskevich/govalidator" "github.com/c2h5oh/datasize" + "gopkg.in/bluesuncorp/validator.v9" ) func MinTimeValidation(fl validator.FieldLevel) bool { diff --git a/core/config/validator.go b/core/config/validator.go index 3fbc51eb7..d031c5c3b 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -5,6 +5,7 @@ package config import ( "github.com/pkg/errors" + "gopkg.in/bluesuncorp/validator.v9" ) var validations = []struct { diff --git a/core/core.go b/core/core.go index 6de0bf12a..9bb4588e5 100644 --- a/core/core.go +++ b/core/core.go @@ -105,7 +105,7 @@ type GunDeps struct { // There is a race between Instances for Ammo Acquire, so it's not guaranteed, that // Instance with lower InstanceId gets it's Ammo earlier. InstanceID int - // TODO(skipor): https://github.com/yandex/pandora/issues/71 + // TODO(skipor): https://a.yandex-team.ru/load/projects/pandora/issues/71 // Pass parallelism value. InstanceId MUST be -1 if parallelism > 1. } diff --git a/core/coretest/config.go b/core/coretest/config.go index 33204b753..7dce710fb 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" "github.com/onsi/gomega" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/lib/ginkgoutil" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index 73d9511d2..8e4550a11 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" + "a.yandex-team.ru/load/projects/pandora/core" "github.com/onsi/gomega" - "github.com/yandex/pandora/core" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/coretest/sink.go b/core/coretest/sink.go index d54c33167..81c839406 100644 --- a/core/coretest/sink.go +++ b/core/coretest/sink.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func AssertSinkEqualStdStream(t *testing.T, expectedPtr **os.File, getSink func() core.DataSink) { diff --git a/core/coretest/source.go b/core/coretest/source.go index ae5ac8f4c..cd1e26ba0 100644 --- a/core/coretest/source.go +++ b/core/coretest/source.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/testutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) func AssertSourceEqualStdStream(t *testing.T, expectedPtr **os.File, getSource func() core.DataSource) { diff --git a/core/coreutil/ammo.go b/core/coreutil/ammo.go index a2ce8a667..83d8ccd9b 100644 --- a/core/coreutil/ammo.go +++ b/core/coreutil/ammo.go @@ -8,7 +8,7 @@ package coreutil import ( "reflect" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // ResetReusedAmmo sets to zero any ammo. diff --git a/core/coreutil/data.go b/core/coreutil/data.go index 241e8ca31..00f8bbd3b 100644 --- a/core/coreutil/data.go +++ b/core/coreutil/data.go @@ -8,7 +8,7 @@ package coreutil import ( "io" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type DataSinkFunc func() (wc io.WriteCloser, err error) diff --git a/core/coreutil/sample.go b/core/coreutil/sample.go index 5c56c5c1b..fc2e35cc3 100644 --- a/core/coreutil/sample.go +++ b/core/coreutil/sample.go @@ -5,7 +5,7 @@ package coreutil -import "github.com/yandex/pandora/core" +import "a.yandex-team.ru/load/projects/pandora/core" func ReturnSampleIfBorrowed(s core.Sample) { borrowed, ok := s.(core.BorrowedSample) diff --git a/core/coreutil/schedule.go b/core/coreutil/schedule.go index f56537858..d84989c33 100644 --- a/core/coreutil/schedule.go +++ b/core/coreutil/schedule.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewCallbackOnFinishSchedule returns schedule that calls back once onFinish diff --git a/core/coreutil/schedule_test.go b/core/coreutil/schedule_test.go index 93d84f3c5..6f3f40dc4 100644 --- a/core/coreutil/schedule_test.go +++ b/core/coreutil/schedule_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/core/schedule" ) var _ = Describe("callback on finish schedule", func() { diff --git a/core/coreutil/waiter.go b/core/coreutil/waiter.go index 06cd1c3fb..60bfe3679 100644 --- a/core/coreutil/waiter.go +++ b/core/coreutil/waiter.go @@ -9,7 +9,7 @@ import ( "context" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // Waiter goroutine unsafe wrapper for efficient waiting schedule. diff --git a/core/coreutil/waiter_test.go b/core/coreutil/waiter_test.go index 4cb0309e8..3f7e4e23b 100644 --- a/core/coreutil/waiter_test.go +++ b/core/coreutil/waiter_test.go @@ -12,7 +12,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/core/schedule" ) var _ = Describe("waiter", func() { diff --git a/core/datasink/file.go b/core/datasink/file.go index 48189f707..1d6b92374 100644 --- a/core/datasink/file.go +++ b/core/datasink/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // TODO(skipor): gzip on flag diff --git a/core/datasink/file_test.go b/core/datasink/file_test.go index 018ba9720..558b1ccca 100644 --- a/core/datasink/file_test.go +++ b/core/datasink/file_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "github.com/yandex/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/core/coretest" ) func TestFileSink(t *testing.T) { diff --git a/core/datasink/std.go b/core/datasink/std.go index cfae62f7d..d225aad47 100644 --- a/core/datasink/std.go +++ b/core/datasink/std.go @@ -9,8 +9,8 @@ import ( "bytes" "io" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) type Buffer struct { diff --git a/core/datasource/file.go b/core/datasource/file.go index 0ebb346ef..8efa3c6c3 100644 --- a/core/datasource/file.go +++ b/core/datasource/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // TODO(skipor): auto unzip with option to turn this behaviour off. diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index 714655a27..eeaa601ca 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" + "a.yandex-team.ru/load/projects/pandora/core/coretest" "github.com/spf13/afero" - "github.com/yandex/pandora/core/coretest" ) func TestFileSource(t *testing.T) { diff --git a/core/datasource/std.go b/core/datasource/std.go index a9f0aa222..aafafecc3 100644 --- a/core/datasource/std.go +++ b/core/datasource/std.go @@ -11,8 +11,8 @@ import ( "io/ioutil" "strings" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) func NewBuffer(buf *bytes.Buffer) core.DataSource { diff --git a/core/engine/engine.go b/core/engine/engine.go index 5979d52a1..547f3869e 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -13,10 +13,10 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/errutil" - "github.com/yandex/pandora/lib/monitoring" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/errutil" + "a.yandex-team.ru/load/projects/pandora/lib/monitoring" ) type Config struct { diff --git a/core/engine/engine_suite_test.go b/core/engine/engine_suite_test.go index 752baf610..04d1f07c6 100644 --- a/core/engine/engine_suite_test.go +++ b/core/engine/engine_suite_test.go @@ -3,8 +3,8 @@ package engine import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/yandex/pandora/lib/monitoring" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/monitoring" ) func TestEngine(t *testing.T) { diff --git a/core/engine/engine_test.go b/core/engine/engine_test.go index 187434156..68715b7bf 100644 --- a/core/engine/engine_test.go +++ b/core/engine/engine_test.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/mock" "go.uber.org/atomic" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator" - "github.com/yandex/pandora/core/config" - coremock "github.com/yandex/pandora/core/mocks" - "github.com/yandex/pandora/core/provider" - "github.com/yandex/pandora/core/schedule" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator" + "a.yandex-team.ru/load/projects/pandora/core/config" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + "a.yandex-team.ru/load/projects/pandora/core/provider" + "a.yandex-team.ru/load/projects/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) var _ = Describe("config validation", func() { diff --git a/core/engine/instance.go b/core/engine/instance.go index 2bb4a6b90..acc8b61f4 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) type instance struct { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index e13287b1c..4e1e447eb 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -9,10 +9,10 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - "github.com/yandex/pandora/core" - coremock "github.com/yandex/pandora/core/mocks" - "github.com/yandex/pandora/core/schedule" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + "a.yandex-team.ru/load/projects/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) var _ = Describe("Instance", func() { @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/import/import.go b/core/import/import.go index cbf1a440c..87c4eeef8 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -11,18 +11,18 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator" - "github.com/yandex/pandora/core/aggregator/netsample" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/datasink" - "github.com/yandex/pandora/core/datasource" - "github.com/yandex/pandora/core/plugin" - "github.com/yandex/pandora/core/plugin/pluginconfig" - "github.com/yandex/pandora/core/provider" - "github.com/yandex/pandora/core/register" - "github.com/yandex/pandora/core/schedule" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/datasink" + "a.yandex-team.ru/load/projects/pandora/core/datasource" + "a.yandex-team.ru/load/projects/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/core/plugin/pluginconfig" + "a.yandex-team.ru/load/projects/pandora/core/provider" + "a.yandex-team.ru/load/projects/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) const ( diff --git a/core/import/import_suite_test.go b/core/import/import_suite_test.go index 2d296839c..b90f2cebd 100644 --- a/core/import/import_suite_test.go +++ b/core/import/import_suite_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/coretest" - "github.com/yandex/pandora/core/plugin" - "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/yandex/pandora/lib/testutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) func TestImport(t *testing.T) { diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index b325dcbc9..1b5371070 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" + "a.yandex-team.ru/load/projects/pandora/core" "github.com/stretchr/testify/mock" - "github.com/yandex/pandora/core" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index aa69c41d7..f7674c8bd 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( + core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index fd3cb0b1e..d763d781b 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" + core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/example_test.go b/core/plugin/example_test.go index b2f1954cb..af23be9a7 100644 --- a/core/plugin/example_test.go +++ b/core/plugin/example_test.go @@ -5,7 +5,7 @@ package plugin_test -import "github.com/yandex/pandora/core/plugin" +import "a.yandex-team.ru/load/projects/pandora/core/plugin" type Plugin interface { DoSmth() diff --git a/core/plugin/plugin_suite_test.go b/core/plugin/plugin_suite_test.go index 0cb918eb6..f2a662c6f 100644 --- a/core/plugin/plugin_suite_test.go +++ b/core/plugin/plugin_suite_test.go @@ -8,7 +8,7 @@ package plugin import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestPlugin(t *testing.T) { diff --git a/core/plugin/pluginconfig/hooks.go b/core/plugin/pluginconfig/hooks.go index fe669bb49..11245f59d 100644 --- a/core/plugin/pluginconfig/hooks.go +++ b/core/plugin/pluginconfig/hooks.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/plugin" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) func AddHooks() { diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 7237d31e2..9ef832259 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/plugin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/plugin" ) func init() { diff --git a/core/plugin/ptest_test.go b/core/plugin/ptest_test.go index cfae16f84..c675988c8 100644 --- a/core/plugin/ptest_test.go +++ b/core/plugin/ptest_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/config" ) // ptest contains examples and utils for testing plugin pkg diff --git a/core/provider/chunk_decoder.go b/core/provider/chunk_decoder.go index 0904b4497..79b52e692 100644 --- a/core/provider/chunk_decoder.go +++ b/core/provider/chunk_decoder.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) var ErrNoAmmoDecoded = fmt.Errorf("no ammo has been decoded from chunk") diff --git a/core/provider/decoder.go b/core/provider/decoder.go index 99beede72..e85a11d2a 100644 --- a/core/provider/decoder.go +++ b/core/provider/decoder.go @@ -13,9 +13,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/errutil" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/errutil" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) type NewAmmoDecoder func(deps core.ProviderDeps, source io.Reader) (AmmoDecoder, error) diff --git a/core/provider/json.go b/core/provider/json.go index 586935c58..f77d6d3ff 100644 --- a/core/provider/json.go +++ b/core/provider/json.go @@ -10,9 +10,9 @@ import ( jsoniter "github.com/json-iterator/go" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) // NewJSONProvider returns generic core.Provider that reads JSON data from source and decodes it diff --git a/core/provider/json_test.go b/core/provider/json_test.go index 1bb44f222..4ef65874b 100644 --- a/core/provider/json_test.go +++ b/core/provider/json_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/datasource" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/datasource" ) type testJSONAmmo struct { diff --git a/core/provider/num.go b/core/provider/num.go index 401ca41af..5d553887f 100644 --- a/core/provider/num.go +++ b/core/provider/num.go @@ -8,7 +8,7 @@ package provider import ( "context" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewNum returns dummy provider, that provides 0, 1 .. n int sequence as ammo. diff --git a/core/provider/num_test.go b/core/provider/num_test.go index a7722cb67..c705028d7 100644 --- a/core/provider/num_test.go +++ b/core/provider/num_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) var _ = Describe("Num", func() { diff --git a/core/provider/provider_suite_test.go b/core/provider/provider_suite_test.go index 1de38db7a..ba5e4654c 100644 --- a/core/provider/provider_suite_test.go +++ b/core/provider/provider_suite_test.go @@ -3,8 +3,8 @@ package provider import ( "testing" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestProvider(t *testing.T) { diff --git a/core/provider/queue.go b/core/provider/queue.go index ef208d5d6..a517379b6 100644 --- a/core/provider/queue.go +++ b/core/provider/queue.go @@ -8,7 +8,7 @@ package provider import ( "sync" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type AmmoQueueConfig struct { diff --git a/core/register/register.go b/core/register/register.go index 3fd301d0e..f109bc34e 100644 --- a/core/register/register.go +++ b/core/register/register.go @@ -6,8 +6,8 @@ package register import ( - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/plugin" ) func RegisterPtr(ptr interface{}, name string, newPlugin interface{}, defaultConfigOptional ...interface{}) { diff --git a/core/schedule/composite.go b/core/schedule/composite.go index 249ab70c7..3ab7cdbec 100644 --- a/core/schedule/composite.go +++ b/core/schedule/composite.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type CompositeConf struct { diff --git a/core/schedule/composite_test.go b/core/schedule/composite_test.go index e4e0dc86c..4e39dd83c 100644 --- a/core/schedule/composite_test.go +++ b/core/schedule/composite_test.go @@ -12,8 +12,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coretest" "go.uber.org/atomic" ) diff --git a/core/schedule/const.go b/core/schedule/const.go index c7dc92fb0..e736c208c 100644 --- a/core/schedule/const.go +++ b/core/schedule/const.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type ConstConfig struct { diff --git a/core/schedule/do_at.go b/core/schedule/do_at.go index e33b8ae23..b73c100b9 100644 --- a/core/schedule/do_at.go +++ b/core/schedule/do_at.go @@ -10,7 +10,7 @@ import ( "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // DoAt returns when i'th operation should be performed, assuming that schedule diff --git a/core/schedule/line.go b/core/schedule/line.go index 4e9860ebe..a78209fce 100644 --- a/core/schedule/line.go +++ b/core/schedule/line.go @@ -9,7 +9,7 @@ import ( "math" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewLine(from, to float64, duration time.Duration) core.Schedule { diff --git a/core/schedule/once.go b/core/schedule/once.go index 67e3be2e9..bd00d4a40 100644 --- a/core/schedule/once.go +++ b/core/schedule/once.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewOnce returns schedule that emits all passed operation token at start time. diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index b63469a7a..b448855e5 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -8,9 +8,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coretest" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestSchedule(t *testing.T) { diff --git a/core/schedule/step.go b/core/schedule/step.go index 7f48598ca..8af4b7ed7 100644 --- a/core/schedule/step.go +++ b/core/schedule/step.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule { diff --git a/core/schedule/unlilmited.go b/core/schedule/unlilmited.go index bd9ee8913..9918976ba 100644 --- a/core/schedule/unlilmited.go +++ b/core/schedule/unlilmited.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewUnlimited returns schedule that generates unlimited ops for passed duration. diff --git a/examples/custom_pandora/custom_main.go b/examples/custom_pandora/custom_main.go index b5304501d..4147bb91e 100644 --- a/examples/custom_pandora/custom_main.go +++ b/examples/custom_pandora/custom_main.go @@ -12,11 +12,11 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/cli" - phttp "github.com/yandex/pandora/components/phttp/import" - "github.com/yandex/pandora/core" - coreimport "github.com/yandex/pandora/core/import" - "github.com/yandex/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/cli" + phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" + "a.yandex-team.ru/load/projects/pandora/core" + coreimport "a.yandex-team.ru/load/projects/pandora/core/import" + "a.yandex-team.ru/load/projects/pandora/core/register" ) type Ammo struct { diff --git a/go.mod b/go.mod index eeba8ce32..3076b4a78 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/yandex/pandora +module a.yandex-team.ru/load/projects/pandora go 1.15 diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index 4aa97551e..bffd469b7 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,6 +8,7 @@ package errutil import ( "context" + "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index 7a82d5197..a51b72db9 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 8103e13d0..4efe94ed9 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + netmock "a.yandex-team.ru/load/projects/pandora/lib/netutil/mocks" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/ginkgoutil" - netmock "github.com/yandex/pandora/lib/netutil/mocks" ) func TestNetutil(t *testing.T) { diff --git a/lib/zaputil/zaputil_suite_test.go b/lib/zaputil/zaputil_suite_test.go index fbeff291d..4ebe7ae42 100644 --- a/lib/zaputil/zaputil_suite_test.go +++ b/lib/zaputil/zaputil_suite_test.go @@ -8,7 +8,7 @@ package zaputil import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestZaputilSuite(t *testing.T) { diff --git a/main.go b/main.go index 744067b8b..abad729c6 100644 --- a/main.go +++ b/main.go @@ -8,11 +8,11 @@ package main import ( "github.com/spf13/afero" - "github.com/yandex/pandora/cli" - example "github.com/yandex/pandora/components/example/import" - grpc "github.com/yandex/pandora/components/grpc/import" - phttp "github.com/yandex/pandora/components/phttp/import" - coreimport "github.com/yandex/pandora/core/import" + "a.yandex-team.ru/load/projects/pandora/cli" + example "a.yandex-team.ru/load/projects/pandora/components/example/import" + grpc "a.yandex-team.ru/load/projects/pandora/components/grpc/import" + phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" + coreimport "a.yandex-team.ru/load/projects/pandora/core/import" ) func main() { From a8f3a59bf74accd3250544da33599c6eca8ab4a3 Mon Sep 17 00:00:00 2001 From: ligreen Date: Sat, 5 Jun 2021 01:44:58 +0300 Subject: [PATCH 30/80] another experiment ref:7bcda321f821924eeebc7473d3144f81eec4f497 --- acceptance_tests/acceptance_suite_test.go | 6 ++--- cli/cli.go | 6 ++--- cli/expvar.go | 4 ++-- components/example/example.go | 4 ++-- components/example/import/import.go | 4 ++-- .../example/import/import_suite_test.go | 2 +- components/grpc/core.go | 4 ++-- components/grpc/import/import.go | 8 +++---- components/phttp/ammo/simple/ammo.go | 4 ++-- .../simple/jsonline/jsonline_suite_test.go | 6 ++--- .../phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/provider.go | 2 +- components/phttp/ammo/simple/raw/provider.go | 2 +- .../phttp/ammo/simple/raw/provider_test.go | 4 ++-- .../phttp/ammo/simple/raw/raw_suite_test.go | 2 +- components/phttp/ammo/simple/uri/decoder.go | 2 +- .../phttp/ammo/simple/uri/decoder_test.go | 4 ++-- components/phttp/ammo/simple/uri/provider.go | 2 +- .../phttp/ammo/simple/uri/provider_test.go | 4 ++-- .../phttp/ammo/simple/uri/uri_suite_test.go | 2 +- components/phttp/base.go | 4 ++-- components/phttp/base_test.go | 10 ++++---- components/phttp/client.go | 4 ++-- components/phttp/connect.go | 2 +- components/phttp/connect_test.go | 2 +- components/phttp/core.go | 4 ++-- components/phttp/http_test.go | 6 ++--- components/phttp/import/import.go | 14 +++++------ components/phttp/import/import_suite_test.go | 4 ++-- components/phttp/mocks/ammo.go | 2 +- components/phttp/phttp_suite_test.go | 2 +- core/aggregator/discard.go | 4 ++-- core/aggregator/encoder.go | 6 ++--- core/aggregator/encoder_test.go | 11 ++++----- core/aggregator/jsonlines.go | 8 +++---- core/aggregator/jsonlines_test.go | 4 ++-- core/aggregator/log.go | 2 +- core/aggregator/mocks/sample_encode_closer.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/aggregator.go | 2 +- .../netsample/netsample_suite_test.go | 2 +- core/aggregator/netsample/phout.go | 4 ++-- core/aggregator/netsample/phout_test.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/aggregator/netsample/test.go | 2 +- core/aggregator/reporter.go | 4 ++-- core/aggregator/reporter_test.go | 4 ++-- core/aggregator/test.go | 2 +- core/config/hooks.go | 2 +- core/config/validations.go | 1 - core/config/validator.go | 1 - core/core.go | 2 +- core/coretest/config.go | 4 ++-- core/coretest/schedule.go | 2 +- core/coretest/sink.go | 2 +- core/coretest/source.go | 4 ++-- core/coreutil/ammo.go | 2 +- core/coreutil/data.go | 2 +- core/coreutil/sample.go | 2 +- core/coreutil/schedule.go | 2 +- core/coreutil/schedule_test.go | 2 +- core/coreutil/waiter.go | 2 +- core/coreutil/waiter_test.go | 2 +- core/datasink/file.go | 2 +- core/datasink/file_test.go | 2 +- core/datasink/std.go | 4 ++-- core/datasource/file.go | 2 +- core/datasource/file_test.go | 2 +- core/datasource/std.go | 4 ++-- core/engine/engine.go | 8 +++---- core/engine/engine_suite_test.go | 4 ++-- core/engine/engine_test.go | 14 +++++------ core/engine/instance.go | 6 ++--- core/engine/instance_test.go | 16 ++++++------- core/import/import.go | 24 +++++++++---------- core/import/import_suite_test.go | 12 +++++----- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/example_test.go | 2 +- core/plugin/plugin_suite_test.go | 2 +- core/plugin/pluginconfig/hooks.go | 6 ++--- core/plugin/pluginconfig/hooks_test.go | 4 ++-- core/plugin/ptest_test.go | 2 +- core/provider/chunk_decoder.go | 2 +- core/provider/decoder.go | 6 ++--- core/provider/json.go | 6 ++--- core/provider/json_test.go | 4 ++-- core/provider/num.go | 2 +- core/provider/num_test.go | 2 +- core/provider/provider_suite_test.go | 4 ++-- core/provider/queue.go | 2 +- core/register/register.go | 4 ++-- core/schedule/composite.go | 2 +- core/schedule/composite_test.go | 4 ++-- core/schedule/const.go | 2 +- core/schedule/do_at.go | 2 +- core/schedule/line.go | 2 +- core/schedule/once.go | 2 +- core/schedule/schedule_suite_test.go | 6 ++--- core/schedule/step.go | 2 +- core/schedule/unlilmited.go | 2 +- examples/custom_pandora/custom_main.go | 10 ++++---- go.mod | 2 +- lib/errutil/errutil.go | 1 - lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 4 ++-- lib/zaputil/zaputil_suite_test.go | 2 +- main.go | 10 ++++---- 109 files changed, 215 insertions(+), 219 deletions(-) diff --git a/acceptance_tests/acceptance_suite_test.go b/acceptance_tests/acceptance_suite_test.go index ec25a8fec..6b14bb506 100644 --- a/acceptance_tests/acceptance_suite_test.go +++ b/acceptance_tests/acceptance_suite_test.go @@ -16,8 +16,8 @@ import ( "github.com/onsi/gomega/gexec" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/tag" ) var pandoraBin string @@ -34,7 +34,7 @@ func TestAcceptanceTests(t *testing.T) { args = append(args, "-tags", "debug") } var err error - pandoraBin, err = gexec.Build("a.yandex-team.ru/load/projects/pandora", args...) + pandoraBin, err = gexec.Build("github.com/yandex/pandora", args...) if err != nil { t.Fatal(err) } diff --git a/cli/cli.go b/cli/cli.go index ee820193d..3ac6dd7c7 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -20,9 +20,9 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/engine" - "a.yandex-team.ru/load/projects/pandora/lib/zaputil" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/engine" + "github.com/yandex/pandora/lib/zaputil" ) const Version = "0.3.3" diff --git a/cli/expvar.go b/cli/expvar.go index 6f3ca2f69..ed8f436d9 100644 --- a/cli/expvar.go +++ b/cli/expvar.go @@ -5,8 +5,8 @@ import ( "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core/engine" - "a.yandex-team.ru/load/projects/pandora/lib/monitoring" + "github.com/yandex/pandora/core/engine" + "github.com/yandex/pandora/lib/monitoring" ) func newEngineMetrics() engine.Metrics { diff --git a/components/example/example.go b/components/example/example.go index 0e4cabb39..f6dab2222 100644 --- a/components/example/example.go +++ b/components/example/example.go @@ -12,8 +12,8 @@ import ( "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/example/import/import.go b/components/example/import/import.go index a1f2257a3..d7c622c0d 100644 --- a/components/example/import/import.go +++ b/components/example/import/import.go @@ -6,8 +6,8 @@ package example import ( - "a.yandex-team.ru/load/projects/pandora/components/example" - "a.yandex-team.ru/load/projects/pandora/core/register" + "github.com/yandex/pandora/components/example" + "github.com/yandex/pandora/core/register" ) func Import() { diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index cec6a22cd..e1432a1c3 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/grpc/core.go b/components/grpc/core.go index cb7bd30be..097ada8cf 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -6,8 +6,8 @@ import ( "log" "time" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" diff --git a/components/grpc/import/import.go b/components/grpc/import/import.go index 19eda6ae8..9271e4281 100644 --- a/components/grpc/import/import.go +++ b/components/grpc/import/import.go @@ -6,10 +6,10 @@ package example import ( - "a.yandex-team.ru/load/projects/pandora/components/grpc" - "a.yandex-team.ru/load/projects/pandora/core" - coreimport "a.yandex-team.ru/load/projects/pandora/core/import" - "a.yandex-team.ru/load/projects/pandora/core/register" + "github.com/yandex/pandora/components/grpc" + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" + "github.com/yandex/pandora/core/register" ) func Import() { diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 6bd30e2f7..6db888e39 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -8,8 +8,8 @@ package simple import ( "net/http" - "a.yandex-team.ru/load/projects/pandora/components/phttp" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go index 15b4feae1..d149cd1b7 100644 --- a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go +++ b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go @@ -18,9 +18,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestJsonline(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index e40d37efd..0a999a8b5 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" "github.com/spf13/afero" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index e671f9543..dab3d110e 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/atomic" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index ed4bfb288..428f42a95 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) /* diff --git a/components/phttp/ammo/simple/raw/provider_test.go b/components/phttp/ammo/simple/raw/provider_test.go index e75463d71..547068f39 100644 --- a/components/phttp/ammo/simple/raw/provider_test.go +++ b/components/phttp/ammo/simple/raw/provider_test.go @@ -14,8 +14,8 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" ) const testFile = "./ammo.stpd" diff --git a/components/phttp/ammo/simple/raw/raw_suite_test.go b/components/phttp/ammo/simple/raw/raw_suite_test.go index dab54e31b..a49bf9d98 100644 --- a/components/phttp/ammo/simple/raw/raw_suite_test.go +++ b/components/phttp/ammo/simple/raw/raw_suite_test.go @@ -3,7 +3,7 @@ package raw import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestRaw(t *testing.T) { diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index 3de592fa6..4a66b2a2e 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) type decoder struct { diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index d7270016b..4a35ebcdd 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -10,8 +10,8 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" ) func newAmmoPool() *sync.Pool { diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index 2e97216a5..c6070e980 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) type Config struct { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index ae7b0db69..a0d05411b 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" "github.com/pkg/errors" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" ) const testFile = "./ammo.uri" diff --git a/components/phttp/ammo/simple/uri/uri_suite_test.go b/components/phttp/ammo/simple/uri/uri_suite_test.go index d5b3b4072..43d23b7b3 100644 --- a/components/phttp/ammo/simple/uri/uri_suite_test.go +++ b/components/phttp/ammo/simple/uri/uri_suite_test.go @@ -3,7 +3,7 @@ package uri import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestUri(t *testing.T) { diff --git a/components/phttp/base.go b/components/phttp/base.go index 280a40542..1409327ca 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -15,8 +15,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" ) const ( diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index 1cd59d570..7effd2ddd 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -19,11 +19,11 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" - "a.yandex-team.ru/load/projects/pandora/core/coretest" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + ammomock "github.com/yandex/pandora/components/phttp/mocks" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/coretest" + "github.com/yandex/pandora/lib/ginkgoutil" ) func testDeps() core.GunDeps { diff --git a/components/phttp/client.go b/components/phttp/client.go index 74c809a06..0aea86e07 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/lib/netutil" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index 77c24e214..bf8340cdb 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" - "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/netutil" ) type ConnectGunConfig struct { diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index b05a3565d..7492fa7ca 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -16,7 +16,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/aggregator/netsample" ) var _ = Describe("connect", func() { diff --git a/components/phttp/core.go b/components/phttp/core.go index 9138cff5c..eeac62fd5 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -8,8 +8,8 @@ package phttp import ( "net/http" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" ) //go:generate mockery -name=Ammo -case=underscore -outpkg=ammomock diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index 01f012df4..f9a18d51b 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -18,9 +18,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" - "a.yandex-team.ru/load/projects/pandora/core/config" + ammomock "github.com/yandex/pandora/components/phttp/mocks" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/config" ) var _ = Describe("BaseGun", func() { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index f3e1e6f86..085aee608 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -11,13 +11,13 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/jsonline" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/raw" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uri" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/register" - "a.yandex-team.ru/load/projects/pandora/lib/netutil" + "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/components/phttp/ammo/simple/jsonline" + "github.com/yandex/pandora/components/phttp/ammo/simple/raw" + "github.com/yandex/pandora/components/phttp/ammo/simple/uri" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/register" + "github.com/yandex/pandora/lib/netutil" ) func Import(fs afero.Fs) { diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 819bcd74b..6b4f5bc49 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -9,8 +9,8 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - . "a.yandex-team.ru/load/projects/pandora/components/phttp" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + . "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index 552710dab..cb43bff1b 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" - netsample "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" mock "github.com/stretchr/testify/mock" + netsample "github.com/yandex/pandora/core/aggregator/netsample" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/components/phttp/phttp_suite_test.go b/components/phttp/phttp_suite_test.go index 7a4abc1f7..2dc671a62 100644 --- a/components/phttp/phttp_suite_test.go +++ b/components/phttp/phttp_suite_test.go @@ -8,7 +8,7 @@ package phttp import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestPhttp(t *testing.T) { diff --git a/core/aggregator/discard.go b/core/aggregator/discard.go index 91147cf3b..6dae8647f 100644 --- a/core/aggregator/discard.go +++ b/core/aggregator/discard.go @@ -8,8 +8,8 @@ package aggregator import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" ) // NewDiscard returns Aggregator that just throws reported ammo away. diff --git a/core/aggregator/encoder.go b/core/aggregator/encoder.go index eee7228e0..8faf680e8 100644 --- a/core/aggregator/encoder.go +++ b/core/aggregator/encoder.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/errutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/errutil" ) type NewSampleEncoder func(w io.Writer, onFlush func()) SampleEncoder diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index 58adfe227..a9389eb15 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -12,18 +12,17 @@ import ( "testing" "time" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - aggregatemock "a.yandex-team.ru/load/projects/pandora/core/aggregator/mocks" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - iomock "a.yandex-team.ru/load/projects/pandora/lib/ioutil2/mocks" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + "github.com/yandex/pandora/core" + aggregatemock "github.com/yandex/pandora/core/aggregator/mocks" + coremock "github.com/yandex/pandora/core/mocks" + iomock "github.com/yandex/pandora/lib/ioutil2/mocks" + "github.com/yandex/pandora/lib/testutil" ) type EncoderAggregatorTester struct { diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 68a31e44b..065a721cd 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,12 +9,12 @@ import ( "bufio" "io" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" jsoniter "github.com/json-iterator/go" + "github.com/yandex/pandora/lib/ioutil2" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/coreutil" ) type JSONLineAggregatorConfig struct { diff --git a/core/aggregator/jsonlines_test.go b/core/aggregator/jsonlines_test.go index b22575303..3c2549f5d 100644 --- a/core/aggregator/jsonlines_test.go +++ b/core/aggregator/jsonlines_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/datasink" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/datasink" ) type jsonTestData struct { diff --git a/core/aggregator/log.go b/core/aggregator/log.go index a66c0dc9e..cf40e5ca3 100644 --- a/core/aggregator/log.go +++ b/core/aggregator/log.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewLog() core.Aggregator { diff --git a/core/aggregator/mocks/sample_encode_closer.go b/core/aggregator/mocks/sample_encode_closer.go index befba9bda..5e152cc15 100644 --- a/core/aggregator/mocks/sample_encode_closer.go +++ b/core/aggregator/mocks/sample_encode_closer.go @@ -4,7 +4,7 @@ package aggregatemock import ( mock "github.com/stretchr/testify/mock" - core "a.yandex-team.ru/load/projects/pandora/core" + core "github.com/yandex/pandora/core" ) // SampleEncodeCloser is an autogenerated mock type for the SampleEncodeCloser type diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index decef2669..8e1dd9474 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( - core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/aggregator.go b/core/aggregator/netsample/aggregator.go index 36240bdb9..5295892ee 100644 --- a/core/aggregator/netsample/aggregator.go +++ b/core/aggregator/netsample/aggregator.go @@ -3,7 +3,7 @@ package netsample import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type Aggregator interface { diff --git a/core/aggregator/netsample/netsample_suite_test.go b/core/aggregator/netsample/netsample_suite_test.go index 12c026191..a243696ba 100644 --- a/core/aggregator/netsample/netsample_suite_test.go +++ b/core/aggregator/netsample/netsample_suite_test.go @@ -3,7 +3,7 @@ package netsample import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestNetsample(t *testing.T) { diff --git a/core/aggregator/netsample/phout.go b/core/aggregator/netsample/phout.go index 066c3c616..7a770982c 100644 --- a/core/aggregator/netsample/phout.go +++ b/core/aggregator/netsample/phout.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" ) type PhoutConfig struct { diff --git a/core/aggregator/netsample/phout_test.go b/core/aggregator/netsample/phout_test.go index ea18777ba..95e734758 100644 --- a/core/aggregator/netsample/phout_test.go +++ b/core/aggregator/netsample/phout_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) var _ = Describe("Phout", func() { diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index d8f302c8e..b084a510b 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/aggregator/netsample/test.go b/core/aggregator/netsample/test.go index 98d087df4..268bdc146 100644 --- a/core/aggregator/netsample/test.go +++ b/core/aggregator/netsample/test.go @@ -8,7 +8,7 @@ package netsample import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type TestAggregator struct { diff --git a/core/aggregator/reporter.go b/core/aggregator/reporter.go index a47100a12..5a3cfed1b 100644 --- a/core/aggregator/reporter.go +++ b/core/aggregator/reporter.go @@ -11,8 +11,8 @@ import ( "go.uber.org/atomic" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" ) type ReporterConfig struct { diff --git a/core/aggregator/reporter_test.go b/core/aggregator/reporter_test.go index 74f9592e1..880ee14da 100644 --- a/core/aggregator/reporter_test.go +++ b/core/aggregator/reporter_test.go @@ -13,8 +13,8 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + coremock "github.com/yandex/pandora/core/mocks" + "github.com/yandex/pandora/lib/testutil" ) func TestReporter_DroppedErr(t *testing.T) { diff --git a/core/aggregator/test.go b/core/aggregator/test.go index 36f7f4bda..a57b667f7 100644 --- a/core/aggregator/test.go +++ b/core/aggregator/test.go @@ -9,7 +9,7 @@ import ( "context" "sync" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewTest() *Test { diff --git a/core/config/hooks.go b/core/config/hooks.go index 3d627d53a..2b4df157a 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/lib/tag" ) var InvalidURLError = errors.New("string is not valid URL") diff --git a/core/config/validations.go b/core/config/validations.go index 18eaff0b1..110e597ec 100644 --- a/core/config/validations.go +++ b/core/config/validations.go @@ -10,7 +10,6 @@ import ( "github.com/asaskevich/govalidator" "github.com/c2h5oh/datasize" - "gopkg.in/bluesuncorp/validator.v9" ) func MinTimeValidation(fl validator.FieldLevel) bool { diff --git a/core/config/validator.go b/core/config/validator.go index d031c5c3b..3fbc51eb7 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -5,7 +5,6 @@ package config import ( "github.com/pkg/errors" - "gopkg.in/bluesuncorp/validator.v9" ) var validations = []struct { diff --git a/core/core.go b/core/core.go index 9bb4588e5..6de0bf12a 100644 --- a/core/core.go +++ b/core/core.go @@ -105,7 +105,7 @@ type GunDeps struct { // There is a race between Instances for Ammo Acquire, so it's not guaranteed, that // Instance with lower InstanceId gets it's Ammo earlier. InstanceID int - // TODO(skipor): https://a.yandex-team.ru/load/projects/pandora/issues/71 + // TODO(skipor): https://github.com/yandex/pandora/issues/71 // Pass parallelism value. InstanceId MUST be -1 if parallelism > 1. } diff --git a/core/coretest/config.go b/core/coretest/config.go index 7dce710fb..33204b753 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" "github.com/onsi/gomega" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/lib/ginkgoutil" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index 8e4550a11..73d9511d2 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" "github.com/onsi/gomega" + "github.com/yandex/pandora/core" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/coretest/sink.go b/core/coretest/sink.go index 81c839406..d54c33167 100644 --- a/core/coretest/sink.go +++ b/core/coretest/sink.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func AssertSinkEqualStdStream(t *testing.T, expectedPtr **os.File, getSink func() core.DataSink) { diff --git a/core/coretest/source.go b/core/coretest/source.go index cd1e26ba0..ae5ac8f4c 100644 --- a/core/coretest/source.go +++ b/core/coretest/source.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/testutil" ) func AssertSourceEqualStdStream(t *testing.T, expectedPtr **os.File, getSource func() core.DataSource) { diff --git a/core/coreutil/ammo.go b/core/coreutil/ammo.go index 83d8ccd9b..a2ce8a667 100644 --- a/core/coreutil/ammo.go +++ b/core/coreutil/ammo.go @@ -8,7 +8,7 @@ package coreutil import ( "reflect" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // ResetReusedAmmo sets to zero any ammo. diff --git a/core/coreutil/data.go b/core/coreutil/data.go index 00f8bbd3b..241e8ca31 100644 --- a/core/coreutil/data.go +++ b/core/coreutil/data.go @@ -8,7 +8,7 @@ package coreutil import ( "io" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type DataSinkFunc func() (wc io.WriteCloser, err error) diff --git a/core/coreutil/sample.go b/core/coreutil/sample.go index fc2e35cc3..5c56c5c1b 100644 --- a/core/coreutil/sample.go +++ b/core/coreutil/sample.go @@ -5,7 +5,7 @@ package coreutil -import "a.yandex-team.ru/load/projects/pandora/core" +import "github.com/yandex/pandora/core" func ReturnSampleIfBorrowed(s core.Sample) { borrowed, ok := s.(core.BorrowedSample) diff --git a/core/coreutil/schedule.go b/core/coreutil/schedule.go index d84989c33..f56537858 100644 --- a/core/coreutil/schedule.go +++ b/core/coreutil/schedule.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewCallbackOnFinishSchedule returns schedule that calls back once onFinish diff --git a/core/coreutil/schedule_test.go b/core/coreutil/schedule_test.go index 6f3f40dc4..93d84f3c5 100644 --- a/core/coreutil/schedule_test.go +++ b/core/coreutil/schedule_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core/schedule" + "github.com/yandex/pandora/core/schedule" ) var _ = Describe("callback on finish schedule", func() { diff --git a/core/coreutil/waiter.go b/core/coreutil/waiter.go index 60bfe3679..06cd1c3fb 100644 --- a/core/coreutil/waiter.go +++ b/core/coreutil/waiter.go @@ -9,7 +9,7 @@ import ( "context" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // Waiter goroutine unsafe wrapper for efficient waiting schedule. diff --git a/core/coreutil/waiter_test.go b/core/coreutil/waiter_test.go index 3f7e4e23b..4cb0309e8 100644 --- a/core/coreutil/waiter_test.go +++ b/core/coreutil/waiter_test.go @@ -12,7 +12,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core/schedule" + "github.com/yandex/pandora/core/schedule" ) var _ = Describe("waiter", func() { diff --git a/core/datasink/file.go b/core/datasink/file.go index 1d6b92374..48189f707 100644 --- a/core/datasink/file.go +++ b/core/datasink/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // TODO(skipor): gzip on flag diff --git a/core/datasink/file_test.go b/core/datasink/file_test.go index 558b1ccca..018ba9720 100644 --- a/core/datasink/file_test.go +++ b/core/datasink/file_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core/coretest" + "github.com/yandex/pandora/core/coretest" ) func TestFileSink(t *testing.T) { diff --git a/core/datasink/std.go b/core/datasink/std.go index d225aad47..cfae62f7d 100644 --- a/core/datasink/std.go +++ b/core/datasink/std.go @@ -9,8 +9,8 @@ import ( "bytes" "io" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ioutil2" ) type Buffer struct { diff --git a/core/datasource/file.go b/core/datasource/file.go index 8efa3c6c3..0ebb346ef 100644 --- a/core/datasource/file.go +++ b/core/datasource/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // TODO(skipor): auto unzip with option to turn this behaviour off. diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index eeaa601ca..714655a27 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "a.yandex-team.ru/load/projects/pandora/core/coretest" "github.com/spf13/afero" + "github.com/yandex/pandora/core/coretest" ) func TestFileSource(t *testing.T) { diff --git a/core/datasource/std.go b/core/datasource/std.go index aafafecc3..a9f0aa222 100644 --- a/core/datasource/std.go +++ b/core/datasource/std.go @@ -11,8 +11,8 @@ import ( "io/ioutil" "strings" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ioutil2" ) func NewBuffer(buf *bytes.Buffer) core.DataSource { diff --git a/core/engine/engine.go b/core/engine/engine.go index 547f3869e..5979d52a1 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -13,10 +13,10 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/errutil" - "a.yandex-team.ru/load/projects/pandora/lib/monitoring" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/errutil" + "github.com/yandex/pandora/lib/monitoring" ) type Config struct { diff --git a/core/engine/engine_suite_test.go b/core/engine/engine_suite_test.go index 04d1f07c6..752baf610 100644 --- a/core/engine/engine_suite_test.go +++ b/core/engine/engine_suite_test.go @@ -3,8 +3,8 @@ package engine import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - "a.yandex-team.ru/load/projects/pandora/lib/monitoring" + "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/monitoring" ) func TestEngine(t *testing.T) { diff --git a/core/engine/engine_test.go b/core/engine/engine_test.go index 68715b7bf..187434156 100644 --- a/core/engine/engine_test.go +++ b/core/engine/engine_test.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/mock" "go.uber.org/atomic" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator" - "a.yandex-team.ru/load/projects/pandora/core/config" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - "a.yandex-team.ru/load/projects/pandora/core/provider" - "a.yandex-team.ru/load/projects/pandora/core/schedule" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator" + "github.com/yandex/pandora/core/config" + coremock "github.com/yandex/pandora/core/mocks" + "github.com/yandex/pandora/core/provider" + "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/ginkgoutil" ) var _ = Describe("config validation", func() { diff --git a/core/engine/instance.go b/core/engine/instance.go index acc8b61f4..2bb4a6b90 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/tag" ) type instance struct { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index 4e1e447eb..e13287b1c 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -9,10 +9,10 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - "a.yandex-team.ru/load/projects/pandora/core" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - "a.yandex-team.ru/load/projects/pandora/core/schedule" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + coremock "github.com/yandex/pandora/core/mocks" + "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/ginkgoutil" ) var _ = Describe("Instance", func() { @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/import/import.go b/core/import/import.go index 87c4eeef8..cbf1a440c 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -11,18 +11,18 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/datasink" - "a.yandex-team.ru/load/projects/pandora/core/datasource" - "a.yandex-team.ru/load/projects/pandora/core/plugin" - "a.yandex-team.ru/load/projects/pandora/core/plugin/pluginconfig" - "a.yandex-team.ru/load/projects/pandora/core/provider" - "a.yandex-team.ru/load/projects/pandora/core/register" - "a.yandex-team.ru/load/projects/pandora/core/schedule" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/datasink" + "github.com/yandex/pandora/core/datasource" + "github.com/yandex/pandora/core/plugin" + "github.com/yandex/pandora/core/plugin/pluginconfig" + "github.com/yandex/pandora/core/provider" + "github.com/yandex/pandora/core/register" + "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/tag" ) const ( diff --git a/core/import/import_suite_test.go b/core/import/import_suite_test.go index b90f2cebd..2d296839c 100644 --- a/core/import/import_suite_test.go +++ b/core/import/import_suite_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/coretest" - "a.yandex-team.ru/load/projects/pandora/core/plugin" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/coretest" + "github.com/yandex/pandora/core/plugin" + "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/testutil" ) func TestImport(t *testing.T) { diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index 1b5371070..b325dcbc9 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" "github.com/stretchr/testify/mock" + "github.com/yandex/pandora/core" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index f7674c8bd..aa69c41d7 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( - core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index d763d781b..fd3cb0b1e 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" - core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/example_test.go b/core/plugin/example_test.go index af23be9a7..b2f1954cb 100644 --- a/core/plugin/example_test.go +++ b/core/plugin/example_test.go @@ -5,7 +5,7 @@ package plugin_test -import "a.yandex-team.ru/load/projects/pandora/core/plugin" +import "github.com/yandex/pandora/core/plugin" type Plugin interface { DoSmth() diff --git a/core/plugin/plugin_suite_test.go b/core/plugin/plugin_suite_test.go index f2a662c6f..0cb918eb6 100644 --- a/core/plugin/plugin_suite_test.go +++ b/core/plugin/plugin_suite_test.go @@ -8,7 +8,7 @@ package plugin import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestPlugin(t *testing.T) { diff --git a/core/plugin/pluginconfig/hooks.go b/core/plugin/pluginconfig/hooks.go index 11245f59d..fe669bb49 100644 --- a/core/plugin/pluginconfig/hooks.go +++ b/core/plugin/pluginconfig/hooks.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/plugin" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/plugin" + "github.com/yandex/pandora/lib/tag" ) func AddHooks() { diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 9ef832259..7237d31e2 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/plugin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/plugin" ) func init() { diff --git a/core/plugin/ptest_test.go b/core/plugin/ptest_test.go index c675988c8..cfae16f84 100644 --- a/core/plugin/ptest_test.go +++ b/core/plugin/ptest_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/core/config" + "github.com/yandex/pandora/core/config" ) // ptest contains examples and utils for testing plugin pkg diff --git a/core/provider/chunk_decoder.go b/core/provider/chunk_decoder.go index 79b52e692..0904b4497 100644 --- a/core/provider/chunk_decoder.go +++ b/core/provider/chunk_decoder.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) var ErrNoAmmoDecoded = fmt.Errorf("no ammo has been decoded from chunk") diff --git a/core/provider/decoder.go b/core/provider/decoder.go index e85a11d2a..99beede72 100644 --- a/core/provider/decoder.go +++ b/core/provider/decoder.go @@ -13,9 +13,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/errutil" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/errutil" + "github.com/yandex/pandora/lib/ioutil2" ) type NewAmmoDecoder func(deps core.ProviderDeps, source io.Reader) (AmmoDecoder, error) diff --git a/core/provider/json.go b/core/provider/json.go index f77d6d3ff..586935c58 100644 --- a/core/provider/json.go +++ b/core/provider/json.go @@ -10,9 +10,9 @@ import ( jsoniter "github.com/json-iterator/go" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/ioutil2" ) // NewJSONProvider returns generic core.Provider that reads JSON data from source and decodes it diff --git a/core/provider/json_test.go b/core/provider/json_test.go index 4ef65874b..1bb44f222 100644 --- a/core/provider/json_test.go +++ b/core/provider/json_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/datasource" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/datasource" ) type testJSONAmmo struct { diff --git a/core/provider/num.go b/core/provider/num.go index 5d553887f..401ca41af 100644 --- a/core/provider/num.go +++ b/core/provider/num.go @@ -8,7 +8,7 @@ package provider import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewNum returns dummy provider, that provides 0, 1 .. n int sequence as ammo. diff --git a/core/provider/num_test.go b/core/provider/num_test.go index c705028d7..a7722cb67 100644 --- a/core/provider/num_test.go +++ b/core/provider/num_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) var _ = Describe("Num", func() { diff --git a/core/provider/provider_suite_test.go b/core/provider/provider_suite_test.go index ba5e4654c..1de38db7a 100644 --- a/core/provider/provider_suite_test.go +++ b/core/provider/provider_suite_test.go @@ -3,8 +3,8 @@ package provider import ( "testing" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestProvider(t *testing.T) { diff --git a/core/provider/queue.go b/core/provider/queue.go index a517379b6..ef208d5d6 100644 --- a/core/provider/queue.go +++ b/core/provider/queue.go @@ -8,7 +8,7 @@ package provider import ( "sync" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type AmmoQueueConfig struct { diff --git a/core/register/register.go b/core/register/register.go index f109bc34e..3fd301d0e 100644 --- a/core/register/register.go +++ b/core/register/register.go @@ -6,8 +6,8 @@ package register import ( - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/plugin" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/plugin" ) func RegisterPtr(ptr interface{}, name string, newPlugin interface{}, defaultConfigOptional ...interface{}) { diff --git a/core/schedule/composite.go b/core/schedule/composite.go index 3ab7cdbec..249ab70c7 100644 --- a/core/schedule/composite.go +++ b/core/schedule/composite.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type CompositeConf struct { diff --git a/core/schedule/composite_test.go b/core/schedule/composite_test.go index 4e39dd83c..e4e0dc86c 100644 --- a/core/schedule/composite_test.go +++ b/core/schedule/composite_test.go @@ -12,8 +12,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coretest" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coretest" "go.uber.org/atomic" ) diff --git a/core/schedule/const.go b/core/schedule/const.go index e736c208c..c7dc92fb0 100644 --- a/core/schedule/const.go +++ b/core/schedule/const.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type ConstConfig struct { diff --git a/core/schedule/do_at.go b/core/schedule/do_at.go index b73c100b9..e33b8ae23 100644 --- a/core/schedule/do_at.go +++ b/core/schedule/do_at.go @@ -10,7 +10,7 @@ import ( "go.uber.org/atomic" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // DoAt returns when i'th operation should be performed, assuming that schedule diff --git a/core/schedule/line.go b/core/schedule/line.go index a78209fce..4e9860ebe 100644 --- a/core/schedule/line.go +++ b/core/schedule/line.go @@ -9,7 +9,7 @@ import ( "math" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewLine(from, to float64, duration time.Duration) core.Schedule { diff --git a/core/schedule/once.go b/core/schedule/once.go index bd00d4a40..67e3be2e9 100644 --- a/core/schedule/once.go +++ b/core/schedule/once.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewOnce returns schedule that emits all passed operation token at start time. diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index b448855e5..b63469a7a 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -8,9 +8,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coretest" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coretest" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestSchedule(t *testing.T) { diff --git a/core/schedule/step.go b/core/schedule/step.go index 8af4b7ed7..7f48598ca 100644 --- a/core/schedule/step.go +++ b/core/schedule/step.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule { diff --git a/core/schedule/unlilmited.go b/core/schedule/unlilmited.go index 9918976ba..bd9ee8913 100644 --- a/core/schedule/unlilmited.go +++ b/core/schedule/unlilmited.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewUnlimited returns schedule that generates unlimited ops for passed duration. diff --git a/examples/custom_pandora/custom_main.go b/examples/custom_pandora/custom_main.go index 4147bb91e..b5304501d 100644 --- a/examples/custom_pandora/custom_main.go +++ b/examples/custom_pandora/custom_main.go @@ -12,11 +12,11 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/cli" - phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" - "a.yandex-team.ru/load/projects/pandora/core" - coreimport "a.yandex-team.ru/load/projects/pandora/core/import" - "a.yandex-team.ru/load/projects/pandora/core/register" + "github.com/yandex/pandora/cli" + phttp "github.com/yandex/pandora/components/phttp/import" + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" + "github.com/yandex/pandora/core/register" ) type Ammo struct { diff --git a/go.mod b/go.mod index 3076b4a78..eeba8ce32 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module a.yandex-team.ru/load/projects/pandora +module github.com/yandex/pandora go 1.15 diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index bffd469b7..4aa97551e 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,7 +8,6 @@ package errutil import ( "context" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index a51b72db9..7a82d5197 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 4efe94ed9..8103e13d0 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - netmock "a.yandex-team.ru/load/projects/pandora/lib/netutil/mocks" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/ginkgoutil" + netmock "github.com/yandex/pandora/lib/netutil/mocks" ) func TestNetutil(t *testing.T) { diff --git a/lib/zaputil/zaputil_suite_test.go b/lib/zaputil/zaputil_suite_test.go index 4ebe7ae42..fbeff291d 100644 --- a/lib/zaputil/zaputil_suite_test.go +++ b/lib/zaputil/zaputil_suite_test.go @@ -8,7 +8,7 @@ package zaputil import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestZaputilSuite(t *testing.T) { diff --git a/main.go b/main.go index abad729c6..744067b8b 100644 --- a/main.go +++ b/main.go @@ -8,11 +8,11 @@ package main import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/cli" - example "a.yandex-team.ru/load/projects/pandora/components/example/import" - grpc "a.yandex-team.ru/load/projects/pandora/components/grpc/import" - phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" - coreimport "a.yandex-team.ru/load/projects/pandora/core/import" + "github.com/yandex/pandora/cli" + example "github.com/yandex/pandora/components/example/import" + grpc "github.com/yandex/pandora/components/grpc/import" + phttp "github.com/yandex/pandora/components/phttp/import" + coreimport "github.com/yandex/pandora/core/import" ) func main() { From a010f11feec13fda0b504865d39a63f6a075de7b Mon Sep 17 00:00:00 2001 From: arcadia-devtools Date: Fri, 11 Jun 2021 19:41:12 +0300 Subject: [PATCH 31/80] intermediate changes ref:2fe8bb6e818733c183892bf1edfb2195f31b7824 --- acceptance_tests/acceptance_suite_test.go | 6 ++--- cli/cli.go | 6 ++--- cli/expvar.go | 4 ++-- components/example/example.go | 4 ++-- components/example/import/import.go | 4 ++-- .../example/import/import_suite_test.go | 2 +- components/grpc/core.go | 4 ++-- components/grpc/import/import.go | 8 +++---- components/phttp/ammo/simple/ammo.go | 4 ++-- .../simple/jsonline/jsonline_suite_test.go | 6 ++--- .../phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/provider.go | 2 +- components/phttp/ammo/simple/raw/provider.go | 2 +- .../phttp/ammo/simple/raw/provider_test.go | 4 ++-- .../phttp/ammo/simple/raw/raw_suite_test.go | 2 +- components/phttp/ammo/simple/uri/decoder.go | 2 +- .../phttp/ammo/simple/uri/decoder_test.go | 4 ++-- components/phttp/ammo/simple/uri/provider.go | 2 +- .../phttp/ammo/simple/uri/provider_test.go | 4 ++-- .../phttp/ammo/simple/uri/uri_suite_test.go | 2 +- components/phttp/base.go | 4 ++-- components/phttp/base_test.go | 10 ++++---- components/phttp/client.go | 4 ++-- components/phttp/connect.go | 2 +- components/phttp/connect_test.go | 2 +- components/phttp/core.go | 4 ++-- components/phttp/http_test.go | 6 ++--- components/phttp/import/import.go | 14 +++++------ components/phttp/import/import_suite_test.go | 4 ++-- components/phttp/mocks/ammo.go | 2 +- components/phttp/phttp_suite_test.go | 2 +- core/aggregator/discard.go | 4 ++-- core/aggregator/encoder.go | 6 ++--- core/aggregator/encoder_test.go | 11 +++++---- core/aggregator/jsonlines.go | 8 +++---- core/aggregator/jsonlines_test.go | 4 ++-- core/aggregator/log.go | 2 +- core/aggregator/mocks/sample_encode_closer.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/aggregator.go | 2 +- .../netsample/netsample_suite_test.go | 2 +- core/aggregator/netsample/phout.go | 4 ++-- core/aggregator/netsample/phout_test.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/aggregator/netsample/test.go | 2 +- core/aggregator/reporter.go | 4 ++-- core/aggregator/reporter_test.go | 4 ++-- core/aggregator/test.go | 2 +- core/config/hooks.go | 2 +- core/config/validations.go | 1 + core/config/validator.go | 1 + core/core.go | 2 +- core/coretest/config.go | 4 ++-- core/coretest/schedule.go | 2 +- core/coretest/sink.go | 2 +- core/coretest/source.go | 4 ++-- core/coreutil/ammo.go | 2 +- core/coreutil/data.go | 2 +- core/coreutil/sample.go | 2 +- core/coreutil/schedule.go | 2 +- core/coreutil/schedule_test.go | 2 +- core/coreutil/waiter.go | 2 +- core/coreutil/waiter_test.go | 2 +- core/datasink/file.go | 2 +- core/datasink/file_test.go | 2 +- core/datasink/std.go | 4 ++-- core/datasource/file.go | 2 +- core/datasource/file_test.go | 2 +- core/datasource/std.go | 4 ++-- core/engine/engine.go | 8 +++---- core/engine/engine_suite_test.go | 4 ++-- core/engine/engine_test.go | 14 +++++------ core/engine/instance.go | 6 ++--- core/engine/instance_test.go | 16 ++++++------- core/import/import.go | 24 +++++++++---------- core/import/import_suite_test.go | 12 +++++----- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/example_test.go | 2 +- core/plugin/plugin_suite_test.go | 2 +- core/plugin/pluginconfig/hooks.go | 6 ++--- core/plugin/pluginconfig/hooks_test.go | 4 ++-- core/plugin/ptest_test.go | 2 +- core/provider/chunk_decoder.go | 2 +- core/provider/decoder.go | 6 ++--- core/provider/json.go | 6 ++--- core/provider/json_test.go | 4 ++-- core/provider/num.go | 2 +- core/provider/num_test.go | 2 +- core/provider/provider_suite_test.go | 4 ++-- core/provider/queue.go | 2 +- core/register/register.go | 4 ++-- core/schedule/composite.go | 2 +- core/schedule/composite_test.go | 4 ++-- core/schedule/const.go | 2 +- core/schedule/do_at.go | 2 +- core/schedule/line.go | 2 +- core/schedule/once.go | 2 +- core/schedule/schedule_suite_test.go | 6 ++--- core/schedule/step.go | 2 +- core/schedule/unlilmited.go | 2 +- examples/custom_pandora/custom_main.go | 10 ++++---- go.mod | 2 +- lib/errutil/errutil.go | 1 + lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 4 ++-- lib/zaputil/zaputil_suite_test.go | 2 +- main.go | 10 ++++---- 109 files changed, 219 insertions(+), 215 deletions(-) diff --git a/acceptance_tests/acceptance_suite_test.go b/acceptance_tests/acceptance_suite_test.go index 6b14bb506..ec25a8fec 100644 --- a/acceptance_tests/acceptance_suite_test.go +++ b/acceptance_tests/acceptance_suite_test.go @@ -16,8 +16,8 @@ import ( "github.com/onsi/gomega/gexec" "go.uber.org/zap" - "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) var pandoraBin string @@ -34,7 +34,7 @@ func TestAcceptanceTests(t *testing.T) { args = append(args, "-tags", "debug") } var err error - pandoraBin, err = gexec.Build("github.com/yandex/pandora", args...) + pandoraBin, err = gexec.Build("a.yandex-team.ru/load/projects/pandora", args...) if err != nil { t.Fatal(err) } diff --git a/cli/cli.go b/cli/cli.go index 3ac6dd7c7..ee820193d 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -20,9 +20,9 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/engine" - "github.com/yandex/pandora/lib/zaputil" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/engine" + "a.yandex-team.ru/load/projects/pandora/lib/zaputil" ) const Version = "0.3.3" diff --git a/cli/expvar.go b/cli/expvar.go index ed8f436d9..6f3ca2f69 100644 --- a/cli/expvar.go +++ b/cli/expvar.go @@ -5,8 +5,8 @@ import ( "go.uber.org/zap" - "github.com/yandex/pandora/core/engine" - "github.com/yandex/pandora/lib/monitoring" + "a.yandex-team.ru/load/projects/pandora/core/engine" + "a.yandex-team.ru/load/projects/pandora/lib/monitoring" ) func newEngineMetrics() engine.Metrics { diff --git a/components/example/example.go b/components/example/example.go index f6dab2222..0e4cabb39 100644 --- a/components/example/example.go +++ b/components/example/example.go @@ -12,8 +12,8 @@ import ( "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/example/import/import.go b/components/example/import/import.go index d7c622c0d..a1f2257a3 100644 --- a/components/example/import/import.go +++ b/components/example/import/import.go @@ -6,8 +6,8 @@ package example import ( - "github.com/yandex/pandora/components/example" - "github.com/yandex/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/components/example" + "a.yandex-team.ru/load/projects/pandora/core/register" ) func Import() { diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index e1432a1c3..cec6a22cd 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/grpc/core.go b/components/grpc/core.go index 097ada8cf..cb7bd30be 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" diff --git a/components/grpc/import/import.go b/components/grpc/import/import.go index 9271e4281..19eda6ae8 100644 --- a/components/grpc/import/import.go +++ b/components/grpc/import/import.go @@ -6,10 +6,10 @@ package example import ( - "github.com/yandex/pandora/components/grpc" - "github.com/yandex/pandora/core" - coreimport "github.com/yandex/pandora/core/import" - "github.com/yandex/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/components/grpc" + "a.yandex-team.ru/load/projects/pandora/core" + coreimport "a.yandex-team.ru/load/projects/pandora/core/import" + "a.yandex-team.ru/load/projects/pandora/core/register" ) func Import() { diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 6db888e39..6bd30e2f7 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -8,8 +8,8 @@ package simple import ( "net/http" - "github.com/yandex/pandora/components/phttp" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/components/phttp" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go index d149cd1b7..15b4feae1 100644 --- a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go +++ b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go @@ -18,9 +18,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestJsonline(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 0a999a8b5..e40d37efd 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index dab3d110e..e671f9543 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index 428f42a95..ed4bfb288 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" ) /* diff --git a/components/phttp/ammo/simple/raw/provider_test.go b/components/phttp/ammo/simple/raw/provider_test.go index 547068f39..e75463d71 100644 --- a/components/phttp/ammo/simple/raw/provider_test.go +++ b/components/phttp/ammo/simple/raw/provider_test.go @@ -14,8 +14,8 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" ) const testFile = "./ammo.stpd" diff --git a/components/phttp/ammo/simple/raw/raw_suite_test.go b/components/phttp/ammo/simple/raw/raw_suite_test.go index a49bf9d98..dab54e31b 100644 --- a/components/phttp/ammo/simple/raw/raw_suite_test.go +++ b/components/phttp/ammo/simple/raw/raw_suite_test.go @@ -3,7 +3,7 @@ package raw import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestRaw(t *testing.T) { diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index 4a66b2a2e..3de592fa6 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" ) type decoder struct { diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index 4a35ebcdd..d7270016b 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -10,8 +10,8 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" ) func newAmmoPool() *sync.Pool { diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index c6070e980..2e97216a5 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" ) type Config struct { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index a0d05411b..ae7b0db69 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "a.yandex-team.ru/load/projects/pandora/core" "github.com/pkg/errors" - "github.com/yandex/pandora/components/phttp/ammo/simple" - "github.com/yandex/pandora/core" ) const testFile = "./ammo.uri" diff --git a/components/phttp/ammo/simple/uri/uri_suite_test.go b/components/phttp/ammo/simple/uri/uri_suite_test.go index 43d23b7b3..d5b3b4072 100644 --- a/components/phttp/ammo/simple/uri/uri_suite_test.go +++ b/components/phttp/ammo/simple/uri/uri_suite_test.go @@ -3,7 +3,7 @@ package uri import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestUri(t *testing.T) { diff --git a/components/phttp/base.go b/components/phttp/base.go index 1409327ca..280a40542 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -15,8 +15,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) const ( diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index 7effd2ddd..1cd59d570 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -19,11 +19,11 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - ammomock "github.com/yandex/pandora/components/phttp/mocks" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" - "github.com/yandex/pandora/core/coretest" - "github.com/yandex/pandora/lib/ginkgoutil" + ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func testDeps() core.GunDeps { diff --git a/components/phttp/client.go b/components/phttp/client.go index 0aea86e07..74c809a06 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/lib/netutil" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index bf8340cdb..77c24e214 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" + "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/netutil" ) type ConnectGunConfig struct { diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index 7492fa7ca..b05a3565d 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -16,7 +16,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) var _ = Describe("connect", func() { diff --git a/components/phttp/core.go b/components/phttp/core.go index eeac62fd5..9138cff5c 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -8,8 +8,8 @@ package phttp import ( "net/http" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" ) //go:generate mockery -name=Ammo -case=underscore -outpkg=ammomock diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index f9a18d51b..01f012df4 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -18,9 +18,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - ammomock "github.com/yandex/pandora/components/phttp/mocks" - "github.com/yandex/pandora/core/aggregator/netsample" - "github.com/yandex/pandora/core/config" + ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/config" ) var _ = Describe("BaseGun", func() { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index 085aee608..f3e1e6f86 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -11,13 +11,13 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp" - "github.com/yandex/pandora/components/phttp/ammo/simple/jsonline" - "github.com/yandex/pandora/components/phttp/ammo/simple/raw" - "github.com/yandex/pandora/components/phttp/ammo/simple/uri" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/register" - "github.com/yandex/pandora/lib/netutil" + "a.yandex-team.ru/load/projects/pandora/components/phttp" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/jsonline" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/raw" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uri" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/lib/netutil" ) func Import(fs afero.Fs) { diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 6b4f5bc49..819bcd74b 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -9,8 +9,8 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - . "github.com/yandex/pandora/components/phttp" - "github.com/yandex/pandora/lib/ginkgoutil" + . "a.yandex-team.ru/load/projects/pandora/components/phttp" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index cb43bff1b..552710dab 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" + netsample "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" mock "github.com/stretchr/testify/mock" - netsample "github.com/yandex/pandora/core/aggregator/netsample" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/components/phttp/phttp_suite_test.go b/components/phttp/phttp_suite_test.go index 2dc671a62..7a4abc1f7 100644 --- a/components/phttp/phttp_suite_test.go +++ b/components/phttp/phttp_suite_test.go @@ -8,7 +8,7 @@ package phttp import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestPhttp(t *testing.T) { diff --git a/core/aggregator/discard.go b/core/aggregator/discard.go index 6dae8647f..91147cf3b 100644 --- a/core/aggregator/discard.go +++ b/core/aggregator/discard.go @@ -8,8 +8,8 @@ package aggregator import ( "context" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) // NewDiscard returns Aggregator that just throws reported ammo away. diff --git a/core/aggregator/encoder.go b/core/aggregator/encoder.go index 8faf680e8..eee7228e0 100644 --- a/core/aggregator/encoder.go +++ b/core/aggregator/encoder.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/errutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/errutil" ) type NewSampleEncoder func(w io.Writer, onFlush func()) SampleEncoder diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index a9389eb15..58adfe227 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -12,17 +12,18 @@ import ( "testing" "time" + "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/yandex/pandora/core" - aggregatemock "github.com/yandex/pandora/core/aggregator/mocks" - coremock "github.com/yandex/pandora/core/mocks" - iomock "github.com/yandex/pandora/lib/ioutil2/mocks" - "github.com/yandex/pandora/lib/testutil" + "a.yandex-team.ru/load/projects/pandora/core" + aggregatemock "a.yandex-team.ru/load/projects/pandora/core/aggregator/mocks" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + iomock "a.yandex-team.ru/load/projects/pandora/lib/ioutil2/mocks" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) type EncoderAggregatorTester struct { diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 065a721cd..68a31e44b 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,12 +9,12 @@ import ( "bufio" "io" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" jsoniter "github.com/json-iterator/go" - "github.com/yandex/pandora/lib/ioutil2" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) type JSONLineAggregatorConfig struct { diff --git a/core/aggregator/jsonlines_test.go b/core/aggregator/jsonlines_test.go index 3c2549f5d..b22575303 100644 --- a/core/aggregator/jsonlines_test.go +++ b/core/aggregator/jsonlines_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/datasink" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/datasink" ) type jsonTestData struct { diff --git a/core/aggregator/log.go b/core/aggregator/log.go index cf40e5ca3..a66c0dc9e 100644 --- a/core/aggregator/log.go +++ b/core/aggregator/log.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewLog() core.Aggregator { diff --git a/core/aggregator/mocks/sample_encode_closer.go b/core/aggregator/mocks/sample_encode_closer.go index 5e152cc15..befba9bda 100644 --- a/core/aggregator/mocks/sample_encode_closer.go +++ b/core/aggregator/mocks/sample_encode_closer.go @@ -4,7 +4,7 @@ package aggregatemock import ( mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" + core "a.yandex-team.ru/load/projects/pandora/core" ) // SampleEncodeCloser is an autogenerated mock type for the SampleEncodeCloser type diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 8e1dd9474..decef2669 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( + core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/aggregator.go b/core/aggregator/netsample/aggregator.go index 5295892ee..36240bdb9 100644 --- a/core/aggregator/netsample/aggregator.go +++ b/core/aggregator/netsample/aggregator.go @@ -3,7 +3,7 @@ package netsample import ( "context" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type Aggregator interface { diff --git a/core/aggregator/netsample/netsample_suite_test.go b/core/aggregator/netsample/netsample_suite_test.go index a243696ba..12c026191 100644 --- a/core/aggregator/netsample/netsample_suite_test.go +++ b/core/aggregator/netsample/netsample_suite_test.go @@ -3,7 +3,7 @@ package netsample import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestNetsample(t *testing.T) { diff --git a/core/aggregator/netsample/phout.go b/core/aggregator/netsample/phout.go index 7a770982c..066c3c616 100644 --- a/core/aggregator/netsample/phout.go +++ b/core/aggregator/netsample/phout.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) type PhoutConfig struct { diff --git a/core/aggregator/netsample/phout_test.go b/core/aggregator/netsample/phout_test.go index 95e734758..ea18777ba 100644 --- a/core/aggregator/netsample/phout_test.go +++ b/core/aggregator/netsample/phout_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) var _ = Describe("Phout", func() { diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index b084a510b..d8f302c8e 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/aggregator/netsample/test.go b/core/aggregator/netsample/test.go index 268bdc146..98d087df4 100644 --- a/core/aggregator/netsample/test.go +++ b/core/aggregator/netsample/test.go @@ -8,7 +8,7 @@ package netsample import ( "context" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type TestAggregator struct { diff --git a/core/aggregator/reporter.go b/core/aggregator/reporter.go index 5a3cfed1b..a47100a12 100644 --- a/core/aggregator/reporter.go +++ b/core/aggregator/reporter.go @@ -11,8 +11,8 @@ import ( "go.uber.org/atomic" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" ) type ReporterConfig struct { diff --git a/core/aggregator/reporter_test.go b/core/aggregator/reporter_test.go index 880ee14da..74f9592e1 100644 --- a/core/aggregator/reporter_test.go +++ b/core/aggregator/reporter_test.go @@ -13,8 +13,8 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" - coremock "github.com/yandex/pandora/core/mocks" - "github.com/yandex/pandora/lib/testutil" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) func TestReporter_DroppedErr(t *testing.T) { diff --git a/core/aggregator/test.go b/core/aggregator/test.go index a57b667f7..36f7f4bda 100644 --- a/core/aggregator/test.go +++ b/core/aggregator/test.go @@ -9,7 +9,7 @@ import ( "context" "sync" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewTest() *Test { diff --git a/core/config/hooks.go b/core/config/hooks.go index 2b4df157a..3d627d53a 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) var InvalidURLError = errors.New("string is not valid URL") diff --git a/core/config/validations.go b/core/config/validations.go index 110e597ec..18eaff0b1 100644 --- a/core/config/validations.go +++ b/core/config/validations.go @@ -10,6 +10,7 @@ import ( "github.com/asaskevich/govalidator" "github.com/c2h5oh/datasize" + "gopkg.in/bluesuncorp/validator.v9" ) func MinTimeValidation(fl validator.FieldLevel) bool { diff --git a/core/config/validator.go b/core/config/validator.go index 3fbc51eb7..d031c5c3b 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -5,6 +5,7 @@ package config import ( "github.com/pkg/errors" + "gopkg.in/bluesuncorp/validator.v9" ) var validations = []struct { diff --git a/core/core.go b/core/core.go index 6de0bf12a..9bb4588e5 100644 --- a/core/core.go +++ b/core/core.go @@ -105,7 +105,7 @@ type GunDeps struct { // There is a race between Instances for Ammo Acquire, so it's not guaranteed, that // Instance with lower InstanceId gets it's Ammo earlier. InstanceID int - // TODO(skipor): https://github.com/yandex/pandora/issues/71 + // TODO(skipor): https://a.yandex-team.ru/load/projects/pandora/issues/71 // Pass parallelism value. InstanceId MUST be -1 if parallelism > 1. } diff --git a/core/coretest/config.go b/core/coretest/config.go index 33204b753..7dce710fb 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" "github.com/onsi/gomega" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/lib/ginkgoutil" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index 73d9511d2..8e4550a11 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" + "a.yandex-team.ru/load/projects/pandora/core" "github.com/onsi/gomega" - "github.com/yandex/pandora/core" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/coretest/sink.go b/core/coretest/sink.go index d54c33167..81c839406 100644 --- a/core/coretest/sink.go +++ b/core/coretest/sink.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func AssertSinkEqualStdStream(t *testing.T, expectedPtr **os.File, getSink func() core.DataSink) { diff --git a/core/coretest/source.go b/core/coretest/source.go index ae5ac8f4c..cd1e26ba0 100644 --- a/core/coretest/source.go +++ b/core/coretest/source.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/testutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) func AssertSourceEqualStdStream(t *testing.T, expectedPtr **os.File, getSource func() core.DataSource) { diff --git a/core/coreutil/ammo.go b/core/coreutil/ammo.go index a2ce8a667..83d8ccd9b 100644 --- a/core/coreutil/ammo.go +++ b/core/coreutil/ammo.go @@ -8,7 +8,7 @@ package coreutil import ( "reflect" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // ResetReusedAmmo sets to zero any ammo. diff --git a/core/coreutil/data.go b/core/coreutil/data.go index 241e8ca31..00f8bbd3b 100644 --- a/core/coreutil/data.go +++ b/core/coreutil/data.go @@ -8,7 +8,7 @@ package coreutil import ( "io" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type DataSinkFunc func() (wc io.WriteCloser, err error) diff --git a/core/coreutil/sample.go b/core/coreutil/sample.go index 5c56c5c1b..fc2e35cc3 100644 --- a/core/coreutil/sample.go +++ b/core/coreutil/sample.go @@ -5,7 +5,7 @@ package coreutil -import "github.com/yandex/pandora/core" +import "a.yandex-team.ru/load/projects/pandora/core" func ReturnSampleIfBorrowed(s core.Sample) { borrowed, ok := s.(core.BorrowedSample) diff --git a/core/coreutil/schedule.go b/core/coreutil/schedule.go index f56537858..d84989c33 100644 --- a/core/coreutil/schedule.go +++ b/core/coreutil/schedule.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewCallbackOnFinishSchedule returns schedule that calls back once onFinish diff --git a/core/coreutil/schedule_test.go b/core/coreutil/schedule_test.go index 93d84f3c5..6f3f40dc4 100644 --- a/core/coreutil/schedule_test.go +++ b/core/coreutil/schedule_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/core/schedule" ) var _ = Describe("callback on finish schedule", func() { diff --git a/core/coreutil/waiter.go b/core/coreutil/waiter.go index 06cd1c3fb..60bfe3679 100644 --- a/core/coreutil/waiter.go +++ b/core/coreutil/waiter.go @@ -9,7 +9,7 @@ import ( "context" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // Waiter goroutine unsafe wrapper for efficient waiting schedule. diff --git a/core/coreutil/waiter_test.go b/core/coreutil/waiter_test.go index 4cb0309e8..3f7e4e23b 100644 --- a/core/coreutil/waiter_test.go +++ b/core/coreutil/waiter_test.go @@ -12,7 +12,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/core/schedule" ) var _ = Describe("waiter", func() { diff --git a/core/datasink/file.go b/core/datasink/file.go index 48189f707..1d6b92374 100644 --- a/core/datasink/file.go +++ b/core/datasink/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // TODO(skipor): gzip on flag diff --git a/core/datasink/file_test.go b/core/datasink/file_test.go index 018ba9720..558b1ccca 100644 --- a/core/datasink/file_test.go +++ b/core/datasink/file_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "github.com/yandex/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/core/coretest" ) func TestFileSink(t *testing.T) { diff --git a/core/datasink/std.go b/core/datasink/std.go index cfae62f7d..d225aad47 100644 --- a/core/datasink/std.go +++ b/core/datasink/std.go @@ -9,8 +9,8 @@ import ( "bytes" "io" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) type Buffer struct { diff --git a/core/datasource/file.go b/core/datasource/file.go index 0ebb346ef..8efa3c6c3 100644 --- a/core/datasource/file.go +++ b/core/datasource/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // TODO(skipor): auto unzip with option to turn this behaviour off. diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index 714655a27..eeaa601ca 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" + "a.yandex-team.ru/load/projects/pandora/core/coretest" "github.com/spf13/afero" - "github.com/yandex/pandora/core/coretest" ) func TestFileSource(t *testing.T) { diff --git a/core/datasource/std.go b/core/datasource/std.go index a9f0aa222..aafafecc3 100644 --- a/core/datasource/std.go +++ b/core/datasource/std.go @@ -11,8 +11,8 @@ import ( "io/ioutil" "strings" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) func NewBuffer(buf *bytes.Buffer) core.DataSource { diff --git a/core/engine/engine.go b/core/engine/engine.go index 5979d52a1..547f3869e 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -13,10 +13,10 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/errutil" - "github.com/yandex/pandora/lib/monitoring" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/errutil" + "a.yandex-team.ru/load/projects/pandora/lib/monitoring" ) type Config struct { diff --git a/core/engine/engine_suite_test.go b/core/engine/engine_suite_test.go index 752baf610..04d1f07c6 100644 --- a/core/engine/engine_suite_test.go +++ b/core/engine/engine_suite_test.go @@ -3,8 +3,8 @@ package engine import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/yandex/pandora/lib/monitoring" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/monitoring" ) func TestEngine(t *testing.T) { diff --git a/core/engine/engine_test.go b/core/engine/engine_test.go index 187434156..68715b7bf 100644 --- a/core/engine/engine_test.go +++ b/core/engine/engine_test.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/mock" "go.uber.org/atomic" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator" - "github.com/yandex/pandora/core/config" - coremock "github.com/yandex/pandora/core/mocks" - "github.com/yandex/pandora/core/provider" - "github.com/yandex/pandora/core/schedule" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator" + "a.yandex-team.ru/load/projects/pandora/core/config" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + "a.yandex-team.ru/load/projects/pandora/core/provider" + "a.yandex-team.ru/load/projects/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) var _ = Describe("config validation", func() { diff --git a/core/engine/instance.go b/core/engine/instance.go index 2bb4a6b90..acc8b61f4 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) type instance struct { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index e13287b1c..4e1e447eb 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -9,10 +9,10 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - "github.com/yandex/pandora/core" - coremock "github.com/yandex/pandora/core/mocks" - "github.com/yandex/pandora/core/schedule" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" + "a.yandex-team.ru/load/projects/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) var _ = Describe("Instance", func() { @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/import/import.go b/core/import/import.go index cbf1a440c..87c4eeef8 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -11,18 +11,18 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/aggregator" - "github.com/yandex/pandora/core/aggregator/netsample" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/datasink" - "github.com/yandex/pandora/core/datasource" - "github.com/yandex/pandora/core/plugin" - "github.com/yandex/pandora/core/plugin/pluginconfig" - "github.com/yandex/pandora/core/provider" - "github.com/yandex/pandora/core/register" - "github.com/yandex/pandora/core/schedule" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/aggregator" + "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/datasink" + "a.yandex-team.ru/load/projects/pandora/core/datasource" + "a.yandex-team.ru/load/projects/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/core/plugin/pluginconfig" + "a.yandex-team.ru/load/projects/pandora/core/provider" + "a.yandex-team.ru/load/projects/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/core/schedule" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) const ( diff --git a/core/import/import_suite_test.go b/core/import/import_suite_test.go index 2d296839c..b90f2cebd 100644 --- a/core/import/import_suite_test.go +++ b/core/import/import_suite_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/coretest" - "github.com/yandex/pandora/core/plugin" - "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/yandex/pandora/lib/testutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/testutil" ) func TestImport(t *testing.T) { diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index b325dcbc9..1b5371070 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" + "a.yandex-team.ru/load/projects/pandora/core" "github.com/stretchr/testify/mock" - "github.com/yandex/pandora/core" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index aa69c41d7..f7674c8bd 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( + core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index fd3cb0b1e..d763d781b 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" + core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/example_test.go b/core/plugin/example_test.go index b2f1954cb..af23be9a7 100644 --- a/core/plugin/example_test.go +++ b/core/plugin/example_test.go @@ -5,7 +5,7 @@ package plugin_test -import "github.com/yandex/pandora/core/plugin" +import "a.yandex-team.ru/load/projects/pandora/core/plugin" type Plugin interface { DoSmth() diff --git a/core/plugin/plugin_suite_test.go b/core/plugin/plugin_suite_test.go index 0cb918eb6..f2a662c6f 100644 --- a/core/plugin/plugin_suite_test.go +++ b/core/plugin/plugin_suite_test.go @@ -8,7 +8,7 @@ package plugin import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestPlugin(t *testing.T) { diff --git a/core/plugin/pluginconfig/hooks.go b/core/plugin/pluginconfig/hooks.go index fe669bb49..11245f59d 100644 --- a/core/plugin/pluginconfig/hooks.go +++ b/core/plugin/pluginconfig/hooks.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/plugin" - "github.com/yandex/pandora/lib/tag" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/lib/tag" ) func AddHooks() { diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 7237d31e2..9ef832259 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" + "a.yandex-team.ru/load/projects/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/plugin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/plugin" ) func init() { diff --git a/core/plugin/ptest_test.go b/core/plugin/ptest_test.go index cfae16f84..c675988c8 100644 --- a/core/plugin/ptest_test.go +++ b/core/plugin/ptest_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/core/config" + "a.yandex-team.ru/load/projects/pandora/core/config" ) // ptest contains examples and utils for testing plugin pkg diff --git a/core/provider/chunk_decoder.go b/core/provider/chunk_decoder.go index 0904b4497..79b52e692 100644 --- a/core/provider/chunk_decoder.go +++ b/core/provider/chunk_decoder.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) var ErrNoAmmoDecoded = fmt.Errorf("no ammo has been decoded from chunk") diff --git a/core/provider/decoder.go b/core/provider/decoder.go index 99beede72..e85a11d2a 100644 --- a/core/provider/decoder.go +++ b/core/provider/decoder.go @@ -13,9 +13,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/errutil" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/errutil" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) type NewAmmoDecoder func(deps core.ProviderDeps, source io.Reader) (AmmoDecoder, error) diff --git a/core/provider/json.go b/core/provider/json.go index 586935c58..f77d6d3ff 100644 --- a/core/provider/json.go +++ b/core/provider/json.go @@ -10,9 +10,9 @@ import ( jsoniter "github.com/json-iterator/go" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coreutil" - "github.com/yandex/pandora/lib/ioutil2" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" ) // NewJSONProvider returns generic core.Provider that reads JSON data from source and decodes it diff --git a/core/provider/json_test.go b/core/provider/json_test.go index 1bb44f222..4ef65874b 100644 --- a/core/provider/json_test.go +++ b/core/provider/json_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/datasource" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/datasource" ) type testJSONAmmo struct { diff --git a/core/provider/num.go b/core/provider/num.go index 401ca41af..5d553887f 100644 --- a/core/provider/num.go +++ b/core/provider/num.go @@ -8,7 +8,7 @@ package provider import ( "context" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewNum returns dummy provider, that provides 0, 1 .. n int sequence as ammo. diff --git a/core/provider/num_test.go b/core/provider/num_test.go index a7722cb67..c705028d7 100644 --- a/core/provider/num_test.go +++ b/core/provider/num_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) var _ = Describe("Num", func() { diff --git a/core/provider/provider_suite_test.go b/core/provider/provider_suite_test.go index 1de38db7a..ba5e4654c 100644 --- a/core/provider/provider_suite_test.go +++ b/core/provider/provider_suite_test.go @@ -3,8 +3,8 @@ package provider import ( "testing" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestProvider(t *testing.T) { diff --git a/core/provider/queue.go b/core/provider/queue.go index ef208d5d6..a517379b6 100644 --- a/core/provider/queue.go +++ b/core/provider/queue.go @@ -8,7 +8,7 @@ package provider import ( "sync" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type AmmoQueueConfig struct { diff --git a/core/register/register.go b/core/register/register.go index 3fd301d0e..f109bc34e 100644 --- a/core/register/register.go +++ b/core/register/register.go @@ -6,8 +6,8 @@ package register import ( - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/plugin" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/plugin" ) func RegisterPtr(ptr interface{}, name string, newPlugin interface{}, defaultConfigOptional ...interface{}) { diff --git a/core/schedule/composite.go b/core/schedule/composite.go index 249ab70c7..3ab7cdbec 100644 --- a/core/schedule/composite.go +++ b/core/schedule/composite.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type CompositeConf struct { diff --git a/core/schedule/composite_test.go b/core/schedule/composite_test.go index e4e0dc86c..4e39dd83c 100644 --- a/core/schedule/composite_test.go +++ b/core/schedule/composite_test.go @@ -12,8 +12,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coretest" "go.uber.org/atomic" ) diff --git a/core/schedule/const.go b/core/schedule/const.go index c7dc92fb0..e736c208c 100644 --- a/core/schedule/const.go +++ b/core/schedule/const.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) type ConstConfig struct { diff --git a/core/schedule/do_at.go b/core/schedule/do_at.go index e33b8ae23..b73c100b9 100644 --- a/core/schedule/do_at.go +++ b/core/schedule/do_at.go @@ -10,7 +10,7 @@ import ( "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // DoAt returns when i'th operation should be performed, assuming that schedule diff --git a/core/schedule/line.go b/core/schedule/line.go index 4e9860ebe..a78209fce 100644 --- a/core/schedule/line.go +++ b/core/schedule/line.go @@ -9,7 +9,7 @@ import ( "math" "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewLine(from, to float64, duration time.Duration) core.Schedule { diff --git a/core/schedule/once.go b/core/schedule/once.go index 67e3be2e9..bd00d4a40 100644 --- a/core/schedule/once.go +++ b/core/schedule/once.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewOnce returns schedule that emits all passed operation token at start time. diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index b63469a7a..b448855e5 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -8,9 +8,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/coretest" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core/coretest" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestSchedule(t *testing.T) { diff --git a/core/schedule/step.go b/core/schedule/step.go index 7f48598ca..8af4b7ed7 100644 --- a/core/schedule/step.go +++ b/core/schedule/step.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule { diff --git a/core/schedule/unlilmited.go b/core/schedule/unlilmited.go index bd9ee8913..9918976ba 100644 --- a/core/schedule/unlilmited.go +++ b/core/schedule/unlilmited.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "github.com/yandex/pandora/core" + "a.yandex-team.ru/load/projects/pandora/core" ) // NewUnlimited returns schedule that generates unlimited ops for passed duration. diff --git a/examples/custom_pandora/custom_main.go b/examples/custom_pandora/custom_main.go index b5304501d..4147bb91e 100644 --- a/examples/custom_pandora/custom_main.go +++ b/examples/custom_pandora/custom_main.go @@ -12,11 +12,11 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "github.com/yandex/pandora/cli" - phttp "github.com/yandex/pandora/components/phttp/import" - "github.com/yandex/pandora/core" - coreimport "github.com/yandex/pandora/core/import" - "github.com/yandex/pandora/core/register" + "a.yandex-team.ru/load/projects/pandora/cli" + phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" + "a.yandex-team.ru/load/projects/pandora/core" + coreimport "a.yandex-team.ru/load/projects/pandora/core/import" + "a.yandex-team.ru/load/projects/pandora/core/register" ) type Ammo struct { diff --git a/go.mod b/go.mod index eeba8ce32..3076b4a78 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/yandex/pandora +module a.yandex-team.ru/load/projects/pandora go 1.15 diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index 4aa97551e..bffd469b7 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,6 +8,7 @@ package errutil import ( "context" + "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index 7a82d5197..a51b72db9 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 8103e13d0..4efe94ed9 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + netmock "a.yandex-team.ru/load/projects/pandora/lib/netutil/mocks" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/ginkgoutil" - netmock "github.com/yandex/pandora/lib/netutil/mocks" ) func TestNetutil(t *testing.T) { diff --git a/lib/zaputil/zaputil_suite_test.go b/lib/zaputil/zaputil_suite_test.go index fbeff291d..4ebe7ae42 100644 --- a/lib/zaputil/zaputil_suite_test.go +++ b/lib/zaputil/zaputil_suite_test.go @@ -8,7 +8,7 @@ package zaputil import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" + "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" ) func TestZaputilSuite(t *testing.T) { diff --git a/main.go b/main.go index 744067b8b..abad729c6 100644 --- a/main.go +++ b/main.go @@ -8,11 +8,11 @@ package main import ( "github.com/spf13/afero" - "github.com/yandex/pandora/cli" - example "github.com/yandex/pandora/components/example/import" - grpc "github.com/yandex/pandora/components/grpc/import" - phttp "github.com/yandex/pandora/components/phttp/import" - coreimport "github.com/yandex/pandora/core/import" + "a.yandex-team.ru/load/projects/pandora/cli" + example "a.yandex-team.ru/load/projects/pandora/components/example/import" + grpc "a.yandex-team.ru/load/projects/pandora/components/grpc/import" + phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" + coreimport "a.yandex-team.ru/load/projects/pandora/core/import" ) func main() { From 0fc6541db66877593d6e8227be470f2b2ec01e5d Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 11 Jun 2021 19:41:17 +0300 Subject: [PATCH 32/80] add uripost ammo format for phttp gun ref:8a82004a5c0ffba5353d089bfc0773a1149f01a8 --- .../phttp/ammo/simple/uripost/decoder.go | 69 +++++++++ .../phttp/ammo/simple/uripost/provider.go | 145 ++++++++++++++++++ components/phttp/import/import.go | 5 + 3 files changed, 219 insertions(+) create mode 100644 components/phttp/ammo/simple/uripost/decoder.go create mode 100644 components/phttp/ammo/simple/uripost/provider.go diff --git a/components/phttp/ammo/simple/uripost/decoder.go b/components/phttp/ammo/simple/uripost/decoder.go new file mode 100644 index 000000000..49aea6e70 --- /dev/null +++ b/components/phttp/ammo/simple/uripost/decoder.go @@ -0,0 +1,69 @@ +package uripost + +import ( + "bytes" + "strconv" + "strings" + + "github.com/pkg/errors" +) + +type Header struct { + key string + value string +} + +func decodeHeader(line []byte) (key string, val string, err error) { + if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { + return key, val, errors.New("header line should be like '[key: value]") + } + line = line[1 : len(line)-1] + colonIdx := bytes.IndexByte(line, ':') + if colonIdx < 0 { + return key, val, errors.New("missing colon") + } + key = string(bytes.TrimSpace(line[:colonIdx])) + val = string(bytes.TrimSpace(line[colonIdx+1:])) + if key == "" { + return key, val, errors.New("missing header key") + } + return +} + +func decodeURI(uriString []byte) (bodySize int, uri string, tag string, err error) { + parts := strings.Split(string(uriString), " ") + bodySize, err = strconv.Atoi(parts[0]) + switch { + case len(parts) <= 2: + uri = parts[1] + + case len(parts) >= 3: + uri = parts[1] + tag = parts[2] + default: + err = errors.New("Wrong ammo format, should be like 'bodySize uri [tag]'") + } + + return +} + +func decodeHTTPConfigHeaders(headers []string) (configHTTPHeaders []Header, err error) { + for _, header := range headers { + line := []byte(header) + if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { + return nil, errors.New("header line should be like '[key: value]") + } + line = line[1 : len(line)-1] + colonIdx := bytes.IndexByte(line, ':') + if colonIdx < 0 { + return nil, errors.New("missing colon") + } + configHTTPHeaders = append( + configHTTPHeaders, + Header{ + string(bytes.TrimSpace(line[:colonIdx])), + string(bytes.TrimSpace(line[colonIdx+1:])), + }) + } + return +} diff --git a/components/phttp/ammo/simple/uripost/provider.go b/components/phttp/ammo/simple/uripost/provider.go new file mode 100644 index 000000000..3a79d8ccc --- /dev/null +++ b/components/phttp/ammo/simple/uripost/provider.go @@ -0,0 +1,145 @@ +package uripost + +import ( + "bufio" + "bytes" + "context" + "io" + "net/http" + "strconv" + + "github.com/pkg/errors" + "github.com/spf13/afero" + "go.uber.org/zap" + + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" +) + +func filePosition(file afero.File) (position int64) { + position, _ = file.Seek(0, io.SeekCurrent) + return +} + +type Config struct { + File string `validate:"required"` + // Limit limits total num of ammo. Unlimited if zero. + Limit int `validate:"min=0"` + // Redefine HTTP headers + Headers []string + // Passes limits ammo file passes. Unlimited if zero. + Passes int `validate:"min=0"` +} + +func NewProvider(fs afero.Fs, conf Config) *Provider { + var p Provider + p = Provider{ + Provider: simple.NewProvider(fs, conf.File, p.start), + Config: conf, + } + return &p +} + +type Provider struct { + simple.Provider + Config + log *zap.Logger +} + +func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { + var passNum int + var ammoNum int + // var key string + // var val string + var bodySize int + var uri string + var tag string + + header := make(http.Header) + // parse and prepare Headers from config + decodedConfigHeaders, err := decodeHTTPConfigHeaders(p.Config.Headers) + if err != nil { + return err + } + for { + passNum++ + reader := bufio.NewReader(ammoFile) + for p.Limit == 0 || ammoNum < p.Limit { + data, isPrefix, err := reader.ReadLine() + if isPrefix { + return errors.Errorf("too long header in ammo at position %v", filePosition(ammoFile)) + } + if err == io.EOF { + break // start over from the beginning + } + if err != nil { + return errors.Wrapf(err, "reading ammo failed at position: %v", filePosition(ammoFile)) + } + if len(data) == 0 { + continue // skip empty lines + } + data = bytes.TrimSpace(data) + if data[0] == '[' { + key, val, err := decodeHeader(data) + if err == nil { + header.Set(key, val) + } + continue + } + if _, err := strconv.Atoi(string(data[0])); err == nil { + bodySize, uri, tag, _ = decodeURI(data) + } + if bodySize == 0 { + break // start over from the beginning of file if ammo size is 0 + } + buff := make([]byte, bodySize) + if n, err := io.ReadFull(reader, buff); err != nil { + return errors.Wrapf(err, "failed to read ammo at position: %v; tried to read: %v; have read: %v", filePosition(ammoFile), bodySize, n) + } + req, err := http.NewRequest("POST", uri, bytes.NewReader(buff)) + if err != nil { + return errors.Wrapf(err, "failed to decode ammo at position: %v; data: %q", filePosition(ammoFile), buff) + } + + for k, v := range header { + // http.Request.Write sends Host header based on req.URL.Host + if k == "Host" { + req.Host = v[0] + req.URL.Host = v[0] + } else { + req.Header[k] = v + } + } + + // redefine request Headers from config + for _, header := range decodedConfigHeaders { + // special behavior for `Host` header + if header.key == "Host" { + req.URL.Host = header.value + } else { + req.Header.Set(header.key, header.value) + } + } + + sh := p.Pool.Get().(*simple.Ammo) + sh.Reset(req, tag) + + select { + case p.Sink <- sh: + ammoNum++ + case <-ctx.Done(): + return ctx.Err() + } + } + if ammoNum == 0 { + return errors.New("no ammo in file") + } + if p.Passes != 0 && passNum >= p.Passes { + break + } + _, err := ammoFile.Seek(0, 0) + if err != nil { + p.log.Info("Failed to seek ammo file", zap.Error(err)) + } + } + return nil +} diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index f3e1e6f86..e52f77bbe 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -15,6 +15,7 @@ import ( "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/jsonline" "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/raw" "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uri" + "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uripost" "a.yandex-team.ru/load/projects/pandora/core" "a.yandex-team.ru/load/projects/pandora/core/register" "a.yandex-team.ru/load/projects/pandora/lib/netutil" @@ -29,6 +30,10 @@ func Import(fs afero.Fs) { return uri.NewProvider(fs, conf) }) + register.Provider("uripost", func(conf uripost.Config) core.Provider { + return uripost.NewProvider(fs, conf) + }) + register.Provider("raw", func(conf raw.Config) core.Provider { return raw.NewProvider(fs, conf) }) From a325ea34623414219f9d467a96b6d88ea2cf1b9d Mon Sep 17 00:00:00 2001 From: ligreen Date: Wed, 16 Jun 2021 00:02:03 +0300 Subject: [PATCH 33/80] PR from branch users/ligreen/pandora-uripost update uripost test add decoder test ref:6588b612c035a64a55370afdd8aacc7b9965b2fe --- .../phttp/ammo/simple/uripost/decoder.go | 9 +- .../phttp/ammo/simple/uripost/decoder_test.go | 94 +++++++++++++++++++ 2 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 components/phttp/ammo/simple/uripost/decoder_test.go diff --git a/components/phttp/ammo/simple/uripost/decoder.go b/components/phttp/ammo/simple/uripost/decoder.go index 49aea6e70..20f26f2cb 100644 --- a/components/phttp/ammo/simple/uripost/decoder.go +++ b/components/phttp/ammo/simple/uripost/decoder.go @@ -15,7 +15,7 @@ type Header struct { func decodeHeader(line []byte) (key string, val string, err error) { if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { - return key, val, errors.New("header line should be like '[key: value]") + return key, val, errors.New("header line should be like '[key: value]'") } line = line[1 : len(line)-1] colonIdx := bytes.IndexByte(line, ':') @@ -33,10 +33,13 @@ func decodeHeader(line []byte) (key string, val string, err error) { func decodeURI(uriString []byte) (bodySize int, uri string, tag string, err error) { parts := strings.Split(string(uriString), " ") bodySize, err = strconv.Atoi(parts[0]) + if err != nil { + err = errors.New("Wrong ammo body size, should be in bytes") + return + } switch { - case len(parts) <= 2: + case len(parts) == 2: uri = parts[1] - case len(parts) >= 3: uri = parts[1] tag = parts[2] diff --git a/components/phttp/ammo/simple/uripost/decoder_test.go b/components/phttp/ammo/simple/uripost/decoder_test.go new file mode 100644 index 000000000..10cdbb585 --- /dev/null +++ b/components/phttp/ammo/simple/uripost/decoder_test.go @@ -0,0 +1,94 @@ +package uripost + +import ( + "reflect" + "strconv" + "testing" +) + +func TestDecoderHeader(t *testing.T) { + var tests = []struct { + line []byte + key, val string + }{ + {line: []byte("[Host: some.host]"), key: "Host", val: "some.host"}, + {line: []byte("[User-agent: Tank]"), key: "User-agent", val: "Tank"}, + } + + for _, test := range tests { + if rkey, rval, _ := decodeHeader(test.line); rkey != test.key && rval != test.val { + t.Errorf("(%v) = %v %v, expected %v %v", string(test.line), rkey, rval, test.key, test.val) + } + } + +} + +func TestDecoderBadHeader(t *testing.T) { + var tests = []struct { + line []byte + err_msg string + }{ + {line: []byte("[Host some.host]"), err_msg: "missing colon"}, + {line: []byte("[User-agent: Tank"), err_msg: "header line should be like '[key: value]'"}, + {line: []byte("[: Tank]"), err_msg: "missing header key"}, + } + + for _, test := range tests { + if _, _, err := decodeHeader(test.line); err.Error() != test.err_msg { + t.Errorf("Got: %v, expected: %v", err.Error(), test.err_msg) + } + } + +} + +func TestDecodeURI(t *testing.T) { + var tests = []struct { + line []byte + size int + uri, tag string + }{ + {line: []byte("7 /test tag1"), size: 7, uri: "/test", tag: "tag1"}, + {line: []byte("10 /test"), size: 10, uri: "/test", tag: ""}, + } + + for _, test := range tests { + d_size, d_uri, d_tag, _ := decodeURI(test.line) + if d_size != test.size && d_uri != test.uri && d_tag != test.tag { + t.Errorf("Got: %v %v %v, expected: %v %v %v", strconv.Itoa(d_size), d_uri, d_tag, test.size, test.uri, test.tag) + } + } + +} + +func TestDecodeBadURI(t *testing.T) { + var tests = []struct { + line []byte + err_msg string + }{ + {line: []byte("3"), err_msg: "Wrong ammo format, should be like 'bodySize uri [tag]'"}, + {line: []byte("a"), err_msg: "Wrong ammo body size, should be in bytes"}, + } + + for _, test := range tests { + + _, _, _, err := decodeURI(test.line) + if err.Error() != test.err_msg { + t.Errorf("Got: %v, expected: %v", err.Error(), test.err_msg) + } + } + +} + +func TestDecodeHTTPConfigHeaders(t *testing.T) { + headers := []string{ + "[Host: some.host]", + "[User-Agent: Tank]", + } + + header := []Header{{key: "Host", value: "some.host"}, {key: "User-Agent", value: "Tank"}} + configHeaders, err := decodeHTTPConfigHeaders(headers) + if err == nil && !reflect.DeepEqual(configHeaders, header) { + t.Errorf("Got: %v, expected: %v", configHeaders, header) + } + +} From b93549a43b27e40d44e878ad7262c82560980673 Mon Sep 17 00:00:00 2001 From: ligreen Date: Wed, 16 Jun 2021 23:28:00 +0300 Subject: [PATCH 34/80] PR from branch users/ligreen/pandora-uripost readme fix add .gitignore ref:83d1b0ecba30bd2f53d0b3fb6c4b0efdb9868ecb --- .gitignore | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6b8081823 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof +======= +.pc +*.coverprofile +.goxc.local.json +.idea/ +pandora.iml +*.log +*.out +out/ + +vendor/ + +docs/_* +.DS_Store diff --git a/README.md b/README.md index a87640db3..f79636c0f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Join the chat at https://gitter.im/yandex/pandora](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yandex/pandora?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/yandex/pandora.svg)](https://travis-ci.org/yandex/pandora) [![Coverage Status](https://coveralls.io/repos/yandex/pandora/badge.svg?branch=develop&service=github)](https://coveralls.io/github/yandex/pandora?branch=develop) -[![Read the Docs](https://readthedocs.org/projects/yandexpandora/badge/)](https://readthedocs.org/projects/yandexpandora/) +[![Read the Docs](https://readthedocs.org/projects/yandexpandora/badge/)](https://yandexpandora.readthedocs.io/en/develop/) Pandora is a high-performance load generator in Go language. It has built-in HTTP(S) and HTTP/2 support and you can write your own load scenarios in Go, compiling them just before your test. From e5940a894a562af5c4534eadab75733ef89606b7 Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 17 Jun 2021 01:18:17 +0300 Subject: [PATCH 35/80] update doc status badge ref:78f6887191150c2c789aa06cb402bd2c0881d64a --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f79636c0f..d2d722272 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Join the chat at https://gitter.im/yandex/pandora](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yandex/pandora?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/yandex/pandora.svg)](https://travis-ci.org/yandex/pandora) [![Coverage Status](https://coveralls.io/repos/yandex/pandora/badge.svg?branch=develop&service=github)](https://coveralls.io/github/yandex/pandora?branch=develop) -[![Read the Docs](https://readthedocs.org/projects/yandexpandora/badge/)](https://yandexpandora.readthedocs.io/en/develop/) +[![Documentation Status](https://readthedocs.org/projects/yandexpandora/badge/?version=develop)](https://yandexpandora.readthedocs.io/en/develop/?badge=develop) Pandora is a high-performance load generator in Go language. It has built-in HTTP(S) and HTTP/2 support and you can write your own load scenarios in Go, compiling them just before your test. @@ -14,7 +14,7 @@ Pandora is a high-performance load generator in Go language. It has built-in HTT ### Building from sources We use go 1.11 modules. -If you build pandora inside $GOPATH, please make sure you have env variable `GO111MODULE` set to `on`. +If you build pandora inside $GOPATH, please make sure you have env variable `GO111MODULE` set to `on` . ```bash git clone https://github.com/yandex/pandora.git cd pandora From ece35f0e4168166b52a925a604deb3c15ff90724 Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 17 Jun 2021 02:25:01 +0300 Subject: [PATCH 36/80] postprocess experiment ref:48cd412a5d8cf5fb179a39bd25a9c506e3b3b641 --- acceptance_tests/acceptance_suite_test.go | 6 ++--- cli/cli.go | 6 ++--- cli/expvar.go | 4 ++-- components/example/example.go | 4 ++-- components/example/import/import.go | 4 ++-- .../example/import/import_suite_test.go | 2 +- components/grpc/core.go | 4 ++-- components/grpc/import/import.go | 8 +++---- components/phttp/ammo/simple/ammo.go | 4 ++-- .../simple/jsonline/jsonline_suite_test.go | 6 ++--- .../phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/provider.go | 2 +- components/phttp/ammo/simple/raw/provider.go | 2 +- .../phttp/ammo/simple/raw/provider_test.go | 4 ++-- .../phttp/ammo/simple/raw/raw_suite_test.go | 2 +- components/phttp/ammo/simple/uri/decoder.go | 2 +- .../phttp/ammo/simple/uri/decoder_test.go | 4 ++-- components/phttp/ammo/simple/uri/provider.go | 2 +- .../phttp/ammo/simple/uri/provider_test.go | 4 ++-- .../phttp/ammo/simple/uri/uri_suite_test.go | 2 +- .../phttp/ammo/simple/uripost/provider.go | 2 +- components/phttp/base.go | 4 ++-- components/phttp/base_test.go | 10 ++++---- components/phttp/client.go | 4 ++-- components/phttp/connect.go | 2 +- components/phttp/connect_test.go | 2 +- components/phttp/core.go | 4 ++-- components/phttp/http_test.go | 6 ++--- components/phttp/import/import.go | 16 ++++++------- components/phttp/import/import_suite_test.go | 4 ++-- components/phttp/mocks/ammo.go | 2 +- components/phttp/phttp_suite_test.go | 2 +- core/aggregator/discard.go | 4 ++-- core/aggregator/encoder.go | 6 ++--- core/aggregator/encoder_test.go | 11 ++++----- core/aggregator/jsonlines.go | 8 +++---- core/aggregator/jsonlines_test.go | 4 ++-- core/aggregator/log.go | 2 +- core/aggregator/mocks/sample_encode_closer.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/aggregator.go | 2 +- .../netsample/netsample_suite_test.go | 2 +- core/aggregator/netsample/phout.go | 4 ++-- core/aggregator/netsample/phout_test.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/aggregator/netsample/test.go | 2 +- core/aggregator/reporter.go | 4 ++-- core/aggregator/reporter_test.go | 4 ++-- core/aggregator/test.go | 2 +- core/config/hooks.go | 2 +- core/config/validations.go | 1 - core/config/validator.go | 1 - core/core.go | 2 +- core/coretest/config.go | 4 ++-- core/coretest/schedule.go | 2 +- core/coretest/sink.go | 2 +- core/coretest/source.go | 4 ++-- core/coreutil/ammo.go | 2 +- core/coreutil/data.go | 2 +- core/coreutil/sample.go | 2 +- core/coreutil/schedule.go | 2 +- core/coreutil/schedule_test.go | 2 +- core/coreutil/waiter.go | 2 +- core/coreutil/waiter_test.go | 2 +- core/datasink/file.go | 2 +- core/datasink/file_test.go | 2 +- core/datasink/std.go | 4 ++-- core/datasource/file.go | 2 +- core/datasource/file_test.go | 2 +- core/datasource/std.go | 4 ++-- core/engine/engine.go | 8 +++---- core/engine/engine_suite_test.go | 4 ++-- core/engine/engine_test.go | 14 +++++------ core/engine/instance.go | 6 ++--- core/engine/instance_test.go | 16 ++++++------- core/import/import.go | 24 +++++++++---------- core/import/import_suite_test.go | 12 +++++----- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/example_test.go | 2 +- core/plugin/plugin_suite_test.go | 2 +- core/plugin/pluginconfig/hooks.go | 6 ++--- core/plugin/pluginconfig/hooks_test.go | 4 ++-- core/plugin/ptest_test.go | 2 +- core/provider/chunk_decoder.go | 2 +- core/provider/decoder.go | 6 ++--- core/provider/json.go | 6 ++--- core/provider/json_test.go | 4 ++-- core/provider/num.go | 2 +- core/provider/num_test.go | 2 +- core/provider/provider_suite_test.go | 4 ++-- core/provider/queue.go | 2 +- core/register/register.go | 4 ++-- core/schedule/composite.go | 2 +- core/schedule/composite_test.go | 4 ++-- core/schedule/const.go | 2 +- core/schedule/do_at.go | 2 +- core/schedule/line.go | 2 +- core/schedule/once.go | 2 +- core/schedule/schedule_suite_test.go | 6 ++--- core/schedule/step.go | 2 +- core/schedule/unlilmited.go | 2 +- examples/custom_pandora/custom_main.go | 10 ++++---- go.mod | 2 +- lib/errutil/errutil.go | 1 - lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 4 ++-- lib/zaputil/zaputil_suite_test.go | 2 +- main.go | 10 ++++---- 110 files changed, 217 insertions(+), 221 deletions(-) diff --git a/acceptance_tests/acceptance_suite_test.go b/acceptance_tests/acceptance_suite_test.go index ec25a8fec..6b14bb506 100644 --- a/acceptance_tests/acceptance_suite_test.go +++ b/acceptance_tests/acceptance_suite_test.go @@ -16,8 +16,8 @@ import ( "github.com/onsi/gomega/gexec" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/tag" ) var pandoraBin string @@ -34,7 +34,7 @@ func TestAcceptanceTests(t *testing.T) { args = append(args, "-tags", "debug") } var err error - pandoraBin, err = gexec.Build("a.yandex-team.ru/load/projects/pandora", args...) + pandoraBin, err = gexec.Build("github.com/yandex/pandora", args...) if err != nil { t.Fatal(err) } diff --git a/cli/cli.go b/cli/cli.go index ee820193d..3ac6dd7c7 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -20,9 +20,9 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/engine" - "a.yandex-team.ru/load/projects/pandora/lib/zaputil" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/engine" + "github.com/yandex/pandora/lib/zaputil" ) const Version = "0.3.3" diff --git a/cli/expvar.go b/cli/expvar.go index 6f3ca2f69..ed8f436d9 100644 --- a/cli/expvar.go +++ b/cli/expvar.go @@ -5,8 +5,8 @@ import ( "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core/engine" - "a.yandex-team.ru/load/projects/pandora/lib/monitoring" + "github.com/yandex/pandora/core/engine" + "github.com/yandex/pandora/lib/monitoring" ) func newEngineMetrics() engine.Metrics { diff --git a/components/example/example.go b/components/example/example.go index 0e4cabb39..f6dab2222 100644 --- a/components/example/example.go +++ b/components/example/example.go @@ -12,8 +12,8 @@ import ( "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/example/import/import.go b/components/example/import/import.go index a1f2257a3..d7c622c0d 100644 --- a/components/example/import/import.go +++ b/components/example/import/import.go @@ -6,8 +6,8 @@ package example import ( - "a.yandex-team.ru/load/projects/pandora/components/example" - "a.yandex-team.ru/load/projects/pandora/core/register" + "github.com/yandex/pandora/components/example" + "github.com/yandex/pandora/core/register" ) func Import() { diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index cec6a22cd..e1432a1c3 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/grpc/core.go b/components/grpc/core.go index cb7bd30be..097ada8cf 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -6,8 +6,8 @@ import ( "log" "time" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" diff --git a/components/grpc/import/import.go b/components/grpc/import/import.go index 19eda6ae8..9271e4281 100644 --- a/components/grpc/import/import.go +++ b/components/grpc/import/import.go @@ -6,10 +6,10 @@ package example import ( - "a.yandex-team.ru/load/projects/pandora/components/grpc" - "a.yandex-team.ru/load/projects/pandora/core" - coreimport "a.yandex-team.ru/load/projects/pandora/core/import" - "a.yandex-team.ru/load/projects/pandora/core/register" + "github.com/yandex/pandora/components/grpc" + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" + "github.com/yandex/pandora/core/register" ) func Import() { diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 6bd30e2f7..6db888e39 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -8,8 +8,8 @@ package simple import ( "net/http" - "a.yandex-team.ru/load/projects/pandora/components/phttp" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/core/aggregator/netsample" ) type Ammo struct { diff --git a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go index 15b4feae1..d149cd1b7 100644 --- a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go +++ b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go @@ -18,9 +18,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestJsonline(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index e40d37efd..0a999a8b5 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" "github.com/spf13/afero" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index e671f9543..dab3d110e 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/atomic" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index ed4bfb288..428f42a95 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) /* diff --git a/components/phttp/ammo/simple/raw/provider_test.go b/components/phttp/ammo/simple/raw/provider_test.go index e75463d71..547068f39 100644 --- a/components/phttp/ammo/simple/raw/provider_test.go +++ b/components/phttp/ammo/simple/raw/provider_test.go @@ -14,8 +14,8 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" ) const testFile = "./ammo.stpd" diff --git a/components/phttp/ammo/simple/raw/raw_suite_test.go b/components/phttp/ammo/simple/raw/raw_suite_test.go index dab54e31b..a49bf9d98 100644 --- a/components/phttp/ammo/simple/raw/raw_suite_test.go +++ b/components/phttp/ammo/simple/raw/raw_suite_test.go @@ -3,7 +3,7 @@ package raw import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestRaw(t *testing.T) { diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index 3de592fa6..4a66b2a2e 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) type decoder struct { diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index d7270016b..4a35ebcdd 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -10,8 +10,8 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" ) func newAmmoPool() *sync.Pool { diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index 2e97216a5..c6070e980 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) type Config struct { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index ae7b0db69..a0d05411b 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" - "a.yandex-team.ru/load/projects/pandora/core" "github.com/pkg/errors" + "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/core" ) const testFile = "./ammo.uri" diff --git a/components/phttp/ammo/simple/uri/uri_suite_test.go b/components/phttp/ammo/simple/uri/uri_suite_test.go index d5b3b4072..43d23b7b3 100644 --- a/components/phttp/ammo/simple/uri/uri_suite_test.go +++ b/components/phttp/ammo/simple/uri/uri_suite_test.go @@ -3,7 +3,7 @@ package uri import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestUri(t *testing.T) { diff --git a/components/phttp/ammo/simple/uripost/provider.go b/components/phttp/ammo/simple/uripost/provider.go index 3a79d8ccc..6be768a1a 100644 --- a/components/phttp/ammo/simple/uripost/provider.go +++ b/components/phttp/ammo/simple/uripost/provider.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) func filePosition(file afero.File) (position int64) { diff --git a/components/phttp/base.go b/components/phttp/base.go index 280a40542..1409327ca 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -15,8 +15,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" ) const ( diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index 1cd59d570..7effd2ddd 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -19,11 +19,11 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" - "a.yandex-team.ru/load/projects/pandora/core/coretest" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + ammomock "github.com/yandex/pandora/components/phttp/mocks" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/coretest" + "github.com/yandex/pandora/lib/ginkgoutil" ) func testDeps() core.GunDeps { diff --git a/components/phttp/client.go b/components/phttp/client.go index 74c809a06..0aea86e07 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/lib/netutil" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index 77c24e214..bf8340cdb 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" - "a.yandex-team.ru/load/projects/pandora/lib/netutil" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/netutil" ) type ConnectGunConfig struct { diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index b05a3565d..7492fa7ca 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -16,7 +16,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/aggregator/netsample" ) var _ = Describe("connect", func() { diff --git a/components/phttp/core.go b/components/phttp/core.go index 9138cff5c..eeac62fd5 100644 --- a/components/phttp/core.go +++ b/components/phttp/core.go @@ -8,8 +8,8 @@ package phttp import ( "net/http" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" ) //go:generate mockery -name=Ammo -case=underscore -outpkg=ammomock diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index 01f012df4..f9a18d51b 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -18,9 +18,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - ammomock "a.yandex-team.ru/load/projects/pandora/components/phttp/mocks" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" - "a.yandex-team.ru/load/projects/pandora/core/config" + ammomock "github.com/yandex/pandora/components/phttp/mocks" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/config" ) var _ = Describe("BaseGun", func() { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index e52f77bbe..016eb47f5 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -11,14 +11,14 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/components/phttp" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/jsonline" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/raw" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uri" - "a.yandex-team.ru/load/projects/pandora/components/phttp/ammo/simple/uripost" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/register" - "a.yandex-team.ru/load/projects/pandora/lib/netutil" + "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/components/phttp/ammo/simple/jsonline" + "github.com/yandex/pandora/components/phttp/ammo/simple/raw" + "github.com/yandex/pandora/components/phttp/ammo/simple/uri" + "github.com/yandex/pandora/components/phttp/ammo/simple/uripost" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/register" + "github.com/yandex/pandora/lib/netutil" ) func Import(fs afero.Fs) { diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 819bcd74b..6b4f5bc49 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -9,8 +9,8 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - . "a.yandex-team.ru/load/projects/pandora/components/phttp" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + . "github.com/yandex/pandora/components/phttp" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index 552710dab..cb43bff1b 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" - netsample "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" mock "github.com/stretchr/testify/mock" + netsample "github.com/yandex/pandora/core/aggregator/netsample" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/components/phttp/phttp_suite_test.go b/components/phttp/phttp_suite_test.go index 7a4abc1f7..2dc671a62 100644 --- a/components/phttp/phttp_suite_test.go +++ b/components/phttp/phttp_suite_test.go @@ -8,7 +8,7 @@ package phttp import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestPhttp(t *testing.T) { diff --git a/core/aggregator/discard.go b/core/aggregator/discard.go index 91147cf3b..6dae8647f 100644 --- a/core/aggregator/discard.go +++ b/core/aggregator/discard.go @@ -8,8 +8,8 @@ package aggregator import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" ) // NewDiscard returns Aggregator that just throws reported ammo away. diff --git a/core/aggregator/encoder.go b/core/aggregator/encoder.go index eee7228e0..8faf680e8 100644 --- a/core/aggregator/encoder.go +++ b/core/aggregator/encoder.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/errutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/errutil" ) type NewSampleEncoder func(w io.Writer, onFlush func()) SampleEncoder diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index 58adfe227..a9389eb15 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -12,18 +12,17 @@ import ( "testing" "time" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - aggregatemock "a.yandex-team.ru/load/projects/pandora/core/aggregator/mocks" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - iomock "a.yandex-team.ru/load/projects/pandora/lib/ioutil2/mocks" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + "github.com/yandex/pandora/core" + aggregatemock "github.com/yandex/pandora/core/aggregator/mocks" + coremock "github.com/yandex/pandora/core/mocks" + iomock "github.com/yandex/pandora/lib/ioutil2/mocks" + "github.com/yandex/pandora/lib/testutil" ) type EncoderAggregatorTester struct { diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 68a31e44b..065a721cd 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,12 +9,12 @@ import ( "bufio" "io" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" jsoniter "github.com/json-iterator/go" + "github.com/yandex/pandora/lib/ioutil2" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/coreutil" ) type JSONLineAggregatorConfig struct { diff --git a/core/aggregator/jsonlines_test.go b/core/aggregator/jsonlines_test.go index b22575303..3c2549f5d 100644 --- a/core/aggregator/jsonlines_test.go +++ b/core/aggregator/jsonlines_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/datasink" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/datasink" ) type jsonTestData struct { diff --git a/core/aggregator/log.go b/core/aggregator/log.go index a66c0dc9e..cf40e5ca3 100644 --- a/core/aggregator/log.go +++ b/core/aggregator/log.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewLog() core.Aggregator { diff --git a/core/aggregator/mocks/sample_encode_closer.go b/core/aggregator/mocks/sample_encode_closer.go index befba9bda..5e152cc15 100644 --- a/core/aggregator/mocks/sample_encode_closer.go +++ b/core/aggregator/mocks/sample_encode_closer.go @@ -4,7 +4,7 @@ package aggregatemock import ( mock "github.com/stretchr/testify/mock" - core "a.yandex-team.ru/load/projects/pandora/core" + core "github.com/yandex/pandora/core" ) // SampleEncodeCloser is an autogenerated mock type for the SampleEncodeCloser type diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index decef2669..8e1dd9474 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( - core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/aggregator.go b/core/aggregator/netsample/aggregator.go index 36240bdb9..5295892ee 100644 --- a/core/aggregator/netsample/aggregator.go +++ b/core/aggregator/netsample/aggregator.go @@ -3,7 +3,7 @@ package netsample import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type Aggregator interface { diff --git a/core/aggregator/netsample/netsample_suite_test.go b/core/aggregator/netsample/netsample_suite_test.go index 12c026191..a243696ba 100644 --- a/core/aggregator/netsample/netsample_suite_test.go +++ b/core/aggregator/netsample/netsample_suite_test.go @@ -3,7 +3,7 @@ package netsample import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestNetsample(t *testing.T) { diff --git a/core/aggregator/netsample/phout.go b/core/aggregator/netsample/phout.go index 066c3c616..7a770982c 100644 --- a/core/aggregator/netsample/phout.go +++ b/core/aggregator/netsample/phout.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" ) type PhoutConfig struct { diff --git a/core/aggregator/netsample/phout_test.go b/core/aggregator/netsample/phout_test.go index ea18777ba..95e734758 100644 --- a/core/aggregator/netsample/phout_test.go +++ b/core/aggregator/netsample/phout_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) var _ = Describe("Phout", func() { diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index d8f302c8e..b084a510b 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/aggregator/netsample/test.go b/core/aggregator/netsample/test.go index 98d087df4..268bdc146 100644 --- a/core/aggregator/netsample/test.go +++ b/core/aggregator/netsample/test.go @@ -8,7 +8,7 @@ package netsample import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type TestAggregator struct { diff --git a/core/aggregator/reporter.go b/core/aggregator/reporter.go index a47100a12..5a3cfed1b 100644 --- a/core/aggregator/reporter.go +++ b/core/aggregator/reporter.go @@ -11,8 +11,8 @@ import ( "go.uber.org/atomic" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" ) type ReporterConfig struct { diff --git a/core/aggregator/reporter_test.go b/core/aggregator/reporter_test.go index 74f9592e1..880ee14da 100644 --- a/core/aggregator/reporter_test.go +++ b/core/aggregator/reporter_test.go @@ -13,8 +13,8 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + coremock "github.com/yandex/pandora/core/mocks" + "github.com/yandex/pandora/lib/testutil" ) func TestReporter_DroppedErr(t *testing.T) { diff --git a/core/aggregator/test.go b/core/aggregator/test.go index 36f7f4bda..a57b667f7 100644 --- a/core/aggregator/test.go +++ b/core/aggregator/test.go @@ -9,7 +9,7 @@ import ( "context" "sync" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewTest() *Test { diff --git a/core/config/hooks.go b/core/config/hooks.go index 3d627d53a..2b4df157a 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/lib/tag" ) var InvalidURLError = errors.New("string is not valid URL") diff --git a/core/config/validations.go b/core/config/validations.go index 18eaff0b1..110e597ec 100644 --- a/core/config/validations.go +++ b/core/config/validations.go @@ -10,7 +10,6 @@ import ( "github.com/asaskevich/govalidator" "github.com/c2h5oh/datasize" - "gopkg.in/bluesuncorp/validator.v9" ) func MinTimeValidation(fl validator.FieldLevel) bool { diff --git a/core/config/validator.go b/core/config/validator.go index d031c5c3b..3fbc51eb7 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -5,7 +5,6 @@ package config import ( "github.com/pkg/errors" - "gopkg.in/bluesuncorp/validator.v9" ) var validations = []struct { diff --git a/core/core.go b/core/core.go index 9bb4588e5..6de0bf12a 100644 --- a/core/core.go +++ b/core/core.go @@ -105,7 +105,7 @@ type GunDeps struct { // There is a race between Instances for Ammo Acquire, so it's not guaranteed, that // Instance with lower InstanceId gets it's Ammo earlier. InstanceID int - // TODO(skipor): https://a.yandex-team.ru/load/projects/pandora/issues/71 + // TODO(skipor): https://github.com/yandex/pandora/issues/71 // Pass parallelism value. InstanceId MUST be -1 if parallelism > 1. } diff --git a/core/coretest/config.go b/core/coretest/config.go index 7dce710fb..33204b753 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" "github.com/onsi/gomega" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/lib/ginkgoutil" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index 8e4550a11..73d9511d2 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" "github.com/onsi/gomega" + "github.com/yandex/pandora/core" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/coretest/sink.go b/core/coretest/sink.go index 81c839406..d54c33167 100644 --- a/core/coretest/sink.go +++ b/core/coretest/sink.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func AssertSinkEqualStdStream(t *testing.T, expectedPtr **os.File, getSink func() core.DataSink) { diff --git a/core/coretest/source.go b/core/coretest/source.go index cd1e26ba0..ae5ac8f4c 100644 --- a/core/coretest/source.go +++ b/core/coretest/source.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/testutil" ) func AssertSourceEqualStdStream(t *testing.T, expectedPtr **os.File, getSource func() core.DataSource) { diff --git a/core/coreutil/ammo.go b/core/coreutil/ammo.go index 83d8ccd9b..a2ce8a667 100644 --- a/core/coreutil/ammo.go +++ b/core/coreutil/ammo.go @@ -8,7 +8,7 @@ package coreutil import ( "reflect" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // ResetReusedAmmo sets to zero any ammo. diff --git a/core/coreutil/data.go b/core/coreutil/data.go index 00f8bbd3b..241e8ca31 100644 --- a/core/coreutil/data.go +++ b/core/coreutil/data.go @@ -8,7 +8,7 @@ package coreutil import ( "io" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type DataSinkFunc func() (wc io.WriteCloser, err error) diff --git a/core/coreutil/sample.go b/core/coreutil/sample.go index fc2e35cc3..5c56c5c1b 100644 --- a/core/coreutil/sample.go +++ b/core/coreutil/sample.go @@ -5,7 +5,7 @@ package coreutil -import "a.yandex-team.ru/load/projects/pandora/core" +import "github.com/yandex/pandora/core" func ReturnSampleIfBorrowed(s core.Sample) { borrowed, ok := s.(core.BorrowedSample) diff --git a/core/coreutil/schedule.go b/core/coreutil/schedule.go index d84989c33..f56537858 100644 --- a/core/coreutil/schedule.go +++ b/core/coreutil/schedule.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewCallbackOnFinishSchedule returns schedule that calls back once onFinish diff --git a/core/coreutil/schedule_test.go b/core/coreutil/schedule_test.go index 6f3f40dc4..93d84f3c5 100644 --- a/core/coreutil/schedule_test.go +++ b/core/coreutil/schedule_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core/schedule" + "github.com/yandex/pandora/core/schedule" ) var _ = Describe("callback on finish schedule", func() { diff --git a/core/coreutil/waiter.go b/core/coreutil/waiter.go index 60bfe3679..06cd1c3fb 100644 --- a/core/coreutil/waiter.go +++ b/core/coreutil/waiter.go @@ -9,7 +9,7 @@ import ( "context" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // Waiter goroutine unsafe wrapper for efficient waiting schedule. diff --git a/core/coreutil/waiter_test.go b/core/coreutil/waiter_test.go index 3f7e4e23b..4cb0309e8 100644 --- a/core/coreutil/waiter_test.go +++ b/core/coreutil/waiter_test.go @@ -12,7 +12,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core/schedule" + "github.com/yandex/pandora/core/schedule" ) var _ = Describe("waiter", func() { diff --git a/core/datasink/file.go b/core/datasink/file.go index 1d6b92374..48189f707 100644 --- a/core/datasink/file.go +++ b/core/datasink/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // TODO(skipor): gzip on flag diff --git a/core/datasink/file_test.go b/core/datasink/file_test.go index 558b1ccca..018ba9720 100644 --- a/core/datasink/file_test.go +++ b/core/datasink/file_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core/coretest" + "github.com/yandex/pandora/core/coretest" ) func TestFileSink(t *testing.T) { diff --git a/core/datasink/std.go b/core/datasink/std.go index d225aad47..cfae62f7d 100644 --- a/core/datasink/std.go +++ b/core/datasink/std.go @@ -9,8 +9,8 @@ import ( "bytes" "io" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ioutil2" ) type Buffer struct { diff --git a/core/datasource/file.go b/core/datasource/file.go index 8efa3c6c3..0ebb346ef 100644 --- a/core/datasource/file.go +++ b/core/datasource/file.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // TODO(skipor): auto unzip with option to turn this behaviour off. diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index eeaa601ca..714655a27 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "a.yandex-team.ru/load/projects/pandora/core/coretest" "github.com/spf13/afero" + "github.com/yandex/pandora/core/coretest" ) func TestFileSource(t *testing.T) { diff --git a/core/datasource/std.go b/core/datasource/std.go index aafafecc3..a9f0aa222 100644 --- a/core/datasource/std.go +++ b/core/datasource/std.go @@ -11,8 +11,8 @@ import ( "io/ioutil" "strings" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ioutil2" ) func NewBuffer(buf *bytes.Buffer) core.DataSource { diff --git a/core/engine/engine.go b/core/engine/engine.go index 547f3869e..5979d52a1 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -13,10 +13,10 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/errutil" - "a.yandex-team.ru/load/projects/pandora/lib/monitoring" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/errutil" + "github.com/yandex/pandora/lib/monitoring" ) type Config struct { diff --git a/core/engine/engine_suite_test.go b/core/engine/engine_suite_test.go index 04d1f07c6..752baf610 100644 --- a/core/engine/engine_suite_test.go +++ b/core/engine/engine_suite_test.go @@ -3,8 +3,8 @@ package engine import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - "a.yandex-team.ru/load/projects/pandora/lib/monitoring" + "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/monitoring" ) func TestEngine(t *testing.T) { diff --git a/core/engine/engine_test.go b/core/engine/engine_test.go index 68715b7bf..187434156 100644 --- a/core/engine/engine_test.go +++ b/core/engine/engine_test.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/mock" "go.uber.org/atomic" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator" - "a.yandex-team.ru/load/projects/pandora/core/config" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - "a.yandex-team.ru/load/projects/pandora/core/provider" - "a.yandex-team.ru/load/projects/pandora/core/schedule" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator" + "github.com/yandex/pandora/core/config" + coremock "github.com/yandex/pandora/core/mocks" + "github.com/yandex/pandora/core/provider" + "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/ginkgoutil" ) var _ = Describe("config validation", func() { diff --git a/core/engine/instance.go b/core/engine/instance.go index acc8b61f4..2bb4a6b90 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/tag" ) type instance struct { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index 4e1e447eb..e13287b1c 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -9,10 +9,10 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - "a.yandex-team.ru/load/projects/pandora/core" - coremock "a.yandex-team.ru/load/projects/pandora/core/mocks" - "a.yandex-team.ru/load/projects/pandora/core/schedule" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + coremock "github.com/yandex/pandora/core/mocks" + "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/ginkgoutil" ) var _ = Describe("Instance", func() { @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/import/import.go b/core/import/import.go index 87c4eeef8..cbf1a440c 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -11,18 +11,18 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/aggregator" - "a.yandex-team.ru/load/projects/pandora/core/aggregator/netsample" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/datasink" - "a.yandex-team.ru/load/projects/pandora/core/datasource" - "a.yandex-team.ru/load/projects/pandora/core/plugin" - "a.yandex-team.ru/load/projects/pandora/core/plugin/pluginconfig" - "a.yandex-team.ru/load/projects/pandora/core/provider" - "a.yandex-team.ru/load/projects/pandora/core/register" - "a.yandex-team.ru/load/projects/pandora/core/schedule" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator" + "github.com/yandex/pandora/core/aggregator/netsample" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/datasink" + "github.com/yandex/pandora/core/datasource" + "github.com/yandex/pandora/core/plugin" + "github.com/yandex/pandora/core/plugin/pluginconfig" + "github.com/yandex/pandora/core/provider" + "github.com/yandex/pandora/core/register" + "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/tag" ) const ( diff --git a/core/import/import_suite_test.go b/core/import/import_suite_test.go index b90f2cebd..2d296839c 100644 --- a/core/import/import_suite_test.go +++ b/core/import/import_suite_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/coretest" - "a.yandex-team.ru/load/projects/pandora/core/plugin" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - "a.yandex-team.ru/load/projects/pandora/lib/testutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/coretest" + "github.com/yandex/pandora/core/plugin" + "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/testutil" ) func TestImport(t *testing.T) { diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index 1b5371070..b325dcbc9 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" "github.com/stretchr/testify/mock" + "github.com/yandex/pandora/core" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index f7674c8bd..aa69c41d7 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( - core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index d763d781b..fd3cb0b1e 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" - core "a.yandex-team.ru/load/projects/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/example_test.go b/core/plugin/example_test.go index af23be9a7..b2f1954cb 100644 --- a/core/plugin/example_test.go +++ b/core/plugin/example_test.go @@ -5,7 +5,7 @@ package plugin_test -import "a.yandex-team.ru/load/projects/pandora/core/plugin" +import "github.com/yandex/pandora/core/plugin" type Plugin interface { DoSmth() diff --git a/core/plugin/plugin_suite_test.go b/core/plugin/plugin_suite_test.go index f2a662c6f..0cb918eb6 100644 --- a/core/plugin/plugin_suite_test.go +++ b/core/plugin/plugin_suite_test.go @@ -8,7 +8,7 @@ package plugin import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestPlugin(t *testing.T) { diff --git a/core/plugin/pluginconfig/hooks.go b/core/plugin/pluginconfig/hooks.go index 11245f59d..fe669bb49 100644 --- a/core/plugin/pluginconfig/hooks.go +++ b/core/plugin/pluginconfig/hooks.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/plugin" - "a.yandex-team.ru/load/projects/pandora/lib/tag" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/plugin" + "github.com/yandex/pandora/lib/tag" ) func AddHooks() { diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 9ef832259..7237d31e2 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "a.yandex-team.ru/load/projects/pandora/core/config" - "a.yandex-team.ru/load/projects/pandora/core/plugin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/plugin" ) func init() { diff --git a/core/plugin/ptest_test.go b/core/plugin/ptest_test.go index c675988c8..cfae16f84 100644 --- a/core/plugin/ptest_test.go +++ b/core/plugin/ptest_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/core/config" + "github.com/yandex/pandora/core/config" ) // ptest contains examples and utils for testing plugin pkg diff --git a/core/provider/chunk_decoder.go b/core/provider/chunk_decoder.go index 79b52e692..0904b4497 100644 --- a/core/provider/chunk_decoder.go +++ b/core/provider/chunk_decoder.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) var ErrNoAmmoDecoded = fmt.Errorf("no ammo has been decoded from chunk") diff --git a/core/provider/decoder.go b/core/provider/decoder.go index e85a11d2a..99beede72 100644 --- a/core/provider/decoder.go +++ b/core/provider/decoder.go @@ -13,9 +13,9 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/errutil" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/errutil" + "github.com/yandex/pandora/lib/ioutil2" ) type NewAmmoDecoder func(deps core.ProviderDeps, source io.Reader) (AmmoDecoder, error) diff --git a/core/provider/json.go b/core/provider/json.go index f77d6d3ff..586935c58 100644 --- a/core/provider/json.go +++ b/core/provider/json.go @@ -10,9 +10,9 @@ import ( jsoniter "github.com/json-iterator/go" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coreutil" - "a.yandex-team.ru/load/projects/pandora/lib/ioutil2" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/ioutil2" ) // NewJSONProvider returns generic core.Provider that reads JSON data from source and decodes it diff --git a/core/provider/json_test.go b/core/provider/json_test.go index 4ef65874b..1bb44f222 100644 --- a/core/provider/json_test.go +++ b/core/provider/json_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/datasource" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/datasource" ) type testJSONAmmo struct { diff --git a/core/provider/num.go b/core/provider/num.go index 5d553887f..401ca41af 100644 --- a/core/provider/num.go +++ b/core/provider/num.go @@ -8,7 +8,7 @@ package provider import ( "context" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewNum returns dummy provider, that provides 0, 1 .. n int sequence as ammo. diff --git a/core/provider/num_test.go b/core/provider/num_test.go index c705028d7..a7722cb67 100644 --- a/core/provider/num_test.go +++ b/core/provider/num_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) var _ = Describe("Num", func() { diff --git a/core/provider/provider_suite_test.go b/core/provider/provider_suite_test.go index ba5e4654c..1de38db7a 100644 --- a/core/provider/provider_suite_test.go +++ b/core/provider/provider_suite_test.go @@ -3,8 +3,8 @@ package provider import ( "testing" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestProvider(t *testing.T) { diff --git a/core/provider/queue.go b/core/provider/queue.go index a517379b6..ef208d5d6 100644 --- a/core/provider/queue.go +++ b/core/provider/queue.go @@ -8,7 +8,7 @@ package provider import ( "sync" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type AmmoQueueConfig struct { diff --git a/core/register/register.go b/core/register/register.go index f109bc34e..3fd301d0e 100644 --- a/core/register/register.go +++ b/core/register/register.go @@ -6,8 +6,8 @@ package register import ( - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/plugin" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/plugin" ) func RegisterPtr(ptr interface{}, name string, newPlugin interface{}, defaultConfigOptional ...interface{}) { diff --git a/core/schedule/composite.go b/core/schedule/composite.go index 3ab7cdbec..249ab70c7 100644 --- a/core/schedule/composite.go +++ b/core/schedule/composite.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type CompositeConf struct { diff --git a/core/schedule/composite_test.go b/core/schedule/composite_test.go index 4e39dd83c..e4e0dc86c 100644 --- a/core/schedule/composite_test.go +++ b/core/schedule/composite_test.go @@ -12,8 +12,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coretest" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coretest" "go.uber.org/atomic" ) diff --git a/core/schedule/const.go b/core/schedule/const.go index e736c208c..c7dc92fb0 100644 --- a/core/schedule/const.go +++ b/core/schedule/const.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) type ConstConfig struct { diff --git a/core/schedule/do_at.go b/core/schedule/do_at.go index b73c100b9..e33b8ae23 100644 --- a/core/schedule/do_at.go +++ b/core/schedule/do_at.go @@ -10,7 +10,7 @@ import ( "go.uber.org/atomic" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // DoAt returns when i'th operation should be performed, assuming that schedule diff --git a/core/schedule/line.go b/core/schedule/line.go index a78209fce..4e9860ebe 100644 --- a/core/schedule/line.go +++ b/core/schedule/line.go @@ -9,7 +9,7 @@ import ( "math" "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewLine(from, to float64, duration time.Duration) core.Schedule { diff --git a/core/schedule/once.go b/core/schedule/once.go index bd00d4a40..67e3be2e9 100644 --- a/core/schedule/once.go +++ b/core/schedule/once.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewOnce returns schedule that emits all passed operation token at start time. diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index b448855e5..b63469a7a 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -8,9 +8,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/core" - "a.yandex-team.ru/load/projects/pandora/core/coretest" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/coretest" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestSchedule(t *testing.T) { diff --git a/core/schedule/step.go b/core/schedule/step.go index 8af4b7ed7..7f48598ca 100644 --- a/core/schedule/step.go +++ b/core/schedule/step.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule { diff --git a/core/schedule/unlilmited.go b/core/schedule/unlilmited.go index 9918976ba..bd9ee8913 100644 --- a/core/schedule/unlilmited.go +++ b/core/schedule/unlilmited.go @@ -8,7 +8,7 @@ package schedule import ( "time" - "a.yandex-team.ru/load/projects/pandora/core" + "github.com/yandex/pandora/core" ) // NewUnlimited returns schedule that generates unlimited ops for passed duration. diff --git a/examples/custom_pandora/custom_main.go b/examples/custom_pandora/custom_main.go index 4147bb91e..b5304501d 100644 --- a/examples/custom_pandora/custom_main.go +++ b/examples/custom_pandora/custom_main.go @@ -12,11 +12,11 @@ import ( "github.com/spf13/afero" "go.uber.org/zap" - "a.yandex-team.ru/load/projects/pandora/cli" - phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" - "a.yandex-team.ru/load/projects/pandora/core" - coreimport "a.yandex-team.ru/load/projects/pandora/core/import" - "a.yandex-team.ru/load/projects/pandora/core/register" + "github.com/yandex/pandora/cli" + phttp "github.com/yandex/pandora/components/phttp/import" + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" + "github.com/yandex/pandora/core/register" ) type Ammo struct { diff --git a/go.mod b/go.mod index 3076b4a78..eeba8ce32 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module a.yandex-team.ru/load/projects/pandora +module github.com/yandex/pandora go 1.15 diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index bffd469b7..4aa97551e 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,7 +8,6 @@ package errutil import ( "context" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index a51b72db9..7a82d5197 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 4efe94ed9..8103e13d0 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" - netmock "a.yandex-team.ru/load/projects/pandora/lib/netutil/mocks" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/ginkgoutil" + netmock "github.com/yandex/pandora/lib/netutil/mocks" ) func TestNetutil(t *testing.T) { diff --git a/lib/zaputil/zaputil_suite_test.go b/lib/zaputil/zaputil_suite_test.go index 4ebe7ae42..fbeff291d 100644 --- a/lib/zaputil/zaputil_suite_test.go +++ b/lib/zaputil/zaputil_suite_test.go @@ -8,7 +8,7 @@ package zaputil import ( "testing" - "a.yandex-team.ru/load/projects/pandora/lib/ginkgoutil" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestZaputilSuite(t *testing.T) { diff --git a/main.go b/main.go index abad729c6..744067b8b 100644 --- a/main.go +++ b/main.go @@ -8,11 +8,11 @@ package main import ( "github.com/spf13/afero" - "a.yandex-team.ru/load/projects/pandora/cli" - example "a.yandex-team.ru/load/projects/pandora/components/example/import" - grpc "a.yandex-team.ru/load/projects/pandora/components/grpc/import" - phttp "a.yandex-team.ru/load/projects/pandora/components/phttp/import" - coreimport "a.yandex-team.ru/load/projects/pandora/core/import" + "github.com/yandex/pandora/cli" + example "github.com/yandex/pandora/components/example/import" + grpc "github.com/yandex/pandora/components/grpc/import" + phttp "github.com/yandex/pandora/components/phttp/import" + coreimport "github.com/yandex/pandora/core/import" ) func main() { From 7c93f311e25bef21172bc3808577be60a248ba60 Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 17 Jun 2021 02:25:09 +0300 Subject: [PATCH 37/80] Change "README.md" ref:cca6e41c73c371f8e9e9d8425cae357940438f74 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2d722272..ede99d84d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Pandora is a high-performance load generator in Go language. It has built-in HTT ### Building from sources We use go 1.11 modules. -If you build pandora inside $GOPATH, please make sure you have env variable `GO111MODULE` set to `on` . +If you build pandora inside $GOPATH, please make sure you have env variable `GO111MODULE` set to `on`. ```bash git clone https://github.com/yandex/pandora.git cd pandora From 2bfebec0322be57f29d8462c0e76f04047d293a9 Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 17 Jun 2021 21:58:24 +0300 Subject: [PATCH 38/80] fixing imports ref:27b8768f63de5b34d01d6db77a7a617274008c75 --- components/example/import/import_suite_test.go | 2 +- components/phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/uri/provider_test.go | 2 +- components/phttp/client.go | 2 +- components/phttp/connect.go | 2 +- components/phttp/mocks/ammo.go | 2 +- core/aggregator/encoder_test.go | 1 + core/aggregator/jsonlines.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/config/validations.go | 1 + core/config/validator.go | 1 + core/coretest/config.go | 2 +- core/coretest/schedule.go | 2 +- core/datasource/file_test.go | 2 +- core/engine/instance_test.go | 8 ++++---- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/pluginconfig/hooks_test.go | 4 ++-- lib/errutil/errutil.go | 1 + lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 2 +- 23 files changed, 28 insertions(+), 24 deletions(-) diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index e1432a1c3..6c231f751 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" + "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 0a999a8b5..9912eef1d 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/spf13/afero" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index a0d05411b..ca2785e58 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/pkg/errors" "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" + "github.com/pkg/errors" ) const testFile = "./ammo.uri" diff --git a/components/phttp/client.go b/components/phttp/client.go index 0aea86e07..a0eefdf65 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" - "github.com/pkg/errors" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" + "github.com/pkg/errors" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index bf8340cdb..1f94c6707 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" - "github.com/pkg/errors" "github.com/yandex/pandora/lib/netutil" + "github.com/pkg/errors" ) type ConnectGunConfig struct { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index cb43bff1b..bfde0c8f1 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" - mock "github.com/stretchr/testify/mock" netsample "github.com/yandex/pandora/core/aggregator/netsample" + mock "github.com/stretchr/testify/mock" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index a9389eb15..ad8a3aadf 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -12,6 +12,7 @@ import ( "testing" "time" + multierror "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 065a721cd..efde4eaf4 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,8 +9,8 @@ import ( "bufio" "io" - jsoniter "github.com/json-iterator/go" "github.com/yandex/pandora/lib/ioutil2" + jsoniter "github.com/json-iterator/go" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/config" diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 8e1dd9474..0acfb6465 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( - mock "github.com/stretchr/testify/mock" core "github.com/yandex/pandora/core" + mock "github.com/stretchr/testify/mock" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index b084a510b..d8f302c8e 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/config/validations.go b/core/config/validations.go index 110e597ec..6dd310584 100644 --- a/core/config/validations.go +++ b/core/config/validations.go @@ -10,6 +10,7 @@ import ( "github.com/asaskevich/govalidator" "github.com/c2h5oh/datasize" + validator "gopkg.in/bluesuncorp/validator.v9" ) func MinTimeValidation(fl validator.FieldLevel) bool { diff --git a/core/config/validator.go b/core/config/validator.go index 3fbc51eb7..6134d3981 100644 --- a/core/config/validator.go +++ b/core/config/validator.go @@ -5,6 +5,7 @@ package config import ( "github.com/pkg/errors" + validator "gopkg.in/bluesuncorp/validator.v9" ) var validations = []struct { diff --git a/core/coretest/config.go b/core/coretest/config.go index 33204b753..74e5fd527 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( - "github.com/onsi/gomega" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/ginkgoutil" + "github.com/onsi/gomega" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index 73d9511d2..e720831d7 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" - "github.com/onsi/gomega" "github.com/yandex/pandora/core" + "github.com/onsi/gomega" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index 714655a27..f0c93e0b1 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "github.com/spf13/afero" "github.com/yandex/pandora/core/coretest" + "github.com/spf13/afero" ) func TestFileSource(t *testing.T) { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index e13287b1c..d7b837f72 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index b325dcbc9..600cbca28 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" - "github.com/stretchr/testify/mock" "github.com/yandex/pandora/core" + "github.com/stretchr/testify/mock" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index aa69c41d7..4fbd2b19d 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( - mock "github.com/stretchr/testify/mock" core "github.com/yandex/pandora/core" + mock "github.com/stretchr/testify/mock" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index fd3cb0b1e..e5eaf9ecd 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" - mock "github.com/stretchr/testify/mock" core "github.com/yandex/pandora/core" + mock "github.com/stretchr/testify/mock" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 7237d31e2..727202df5 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/plugin" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func init() { diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index 4aa97551e..bffd469b7 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,6 +8,7 @@ package errutil import ( "context" + "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index 7a82d5197..85086bde5 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" + "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 8103e13d0..617e0aacd 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" - "github.com/pkg/errors" "github.com/yandex/pandora/lib/ginkgoutil" netmock "github.com/yandex/pandora/lib/netutil/mocks" + "github.com/pkg/errors" ) func TestNetutil(t *testing.T) { From b194cd6c5e86fc7d1550c6b872f40d696d5c95ca Mon Sep 17 00:00:00 2001 From: arcadia-devtools Date: Tue, 5 Oct 2021 11:01:38 +0300 Subject: [PATCH 39/80] intermediate changes ref:6929cee4480b1afec726a6307a51dd297ab9f08b --- components/example/import/import_suite_test.go | 2 +- components/phttp/ammo/simple/jsonline/provider.go | 2 +- components/phttp/ammo/simple/uri/provider_test.go | 2 +- components/phttp/client.go | 2 +- components/phttp/connect.go | 2 +- components/phttp/mocks/ammo.go | 2 +- core/aggregator/jsonlines.go | 2 +- core/aggregator/mocks/sample_encoder.go | 2 +- core/aggregator/netsample/sample_test.go | 4 ++-- core/coretest/config.go | 2 +- core/coretest/schedule.go | 2 +- core/datasource/file_test.go | 2 +- core/engine/instance_test.go | 8 ++++---- core/mocks/aggregator.go | 2 +- core/mocks/gun.go | 2 +- core/mocks/provider.go | 2 +- core/plugin/pluginconfig/hooks_test.go | 4 ++-- lib/errutil/errutil.go | 1 - lib/errutil/errutil_suite_test.go | 2 +- lib/netutil/netutil_suite_test.go | 2 +- 20 files changed, 24 insertions(+), 25 deletions(-) diff --git a/components/example/import/import_suite_test.go b/components/example/import/import_suite_test.go index 6c231f751..e1432a1c3 100644 --- a/components/example/import/import_suite_test.go +++ b/components/example/import/import_suite_test.go @@ -3,9 +3,9 @@ package example import ( "testing" - "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestImport(t *testing.T) { diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 9912eef1d..0a999a8b5 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,8 +14,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/spf13/afero" + "github.com/yandex/pandora/components/phttp/ammo/simple" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index ca2785e58..a0d05411b 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -11,9 +11,9 @@ import ( . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" + "github.com/pkg/errors" "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" - "github.com/pkg/errors" ) const testFile = "./ammo.uri" diff --git a/components/phttp/client.go b/components/phttp/client.go index a0eefdf65..0aea86e07 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -14,9 +14,9 @@ import ( "go.uber.org/zap" "golang.org/x/net/http2" + "github.com/pkg/errors" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" - "github.com/pkg/errors" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect.go b/components/phttp/connect.go index 1f94c6707..bf8340cdb 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -14,8 +14,8 @@ import ( "net/http/httputil" "net/url" - "github.com/yandex/pandora/lib/netutil" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/netutil" ) type ConnectGunConfig struct { diff --git a/components/phttp/mocks/ammo.go b/components/phttp/mocks/ammo.go index bfde0c8f1..cb43bff1b 100644 --- a/components/phttp/mocks/ammo.go +++ b/components/phttp/mocks/ammo.go @@ -4,8 +4,8 @@ package ammomock import ( http "net/http" - netsample "github.com/yandex/pandora/core/aggregator/netsample" mock "github.com/stretchr/testify/mock" + netsample "github.com/yandex/pandora/core/aggregator/netsample" ) // Ammo is an autogenerated mock type for the Ammo type diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index efde4eaf4..065a721cd 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -9,8 +9,8 @@ import ( "bufio" "io" - "github.com/yandex/pandora/lib/ioutil2" jsoniter "github.com/json-iterator/go" + "github.com/yandex/pandora/lib/ioutil2" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/config" diff --git a/core/aggregator/mocks/sample_encoder.go b/core/aggregator/mocks/sample_encoder.go index 0acfb6465..8e1dd9474 100644 --- a/core/aggregator/mocks/sample_encoder.go +++ b/core/aggregator/mocks/sample_encoder.go @@ -2,8 +2,8 @@ package aggregatemock import ( - core "github.com/yandex/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // SampleEncoder is an autogenerated mock type for the SampleEncoder type diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index d8f302c8e..b084a510b 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/coretest/config.go b/core/coretest/config.go index 74e5fd527..33204b753 100644 --- a/core/coretest/config.go +++ b/core/coretest/config.go @@ -6,9 +6,9 @@ package coretest import ( + "github.com/onsi/gomega" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/ginkgoutil" - "github.com/onsi/gomega" ) func Decode(data string, result interface{}) { diff --git a/core/coretest/schedule.go b/core/coretest/schedule.go index e720831d7..73d9511d2 100644 --- a/core/coretest/schedule.go +++ b/core/coretest/schedule.go @@ -8,8 +8,8 @@ package coretest import ( "time" - "github.com/yandex/pandora/core" "github.com/onsi/gomega" + "github.com/yandex/pandora/core" ) func ExpectScheduleNextsStartAt(sched core.Schedule, startAt time.Time, nexts ...time.Duration) { diff --git a/core/datasource/file_test.go b/core/datasource/file_test.go index f0c93e0b1..714655a27 100644 --- a/core/datasource/file_test.go +++ b/core/datasource/file_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "github.com/yandex/pandora/core/coretest" "github.com/spf13/afero" + "github.com/yandex/pandora/core/coretest" ) func TestFileSource(t *testing.T) { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index d7b837f72..e13287b1c 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -115,10 +115,10 @@ var _ = Describe("Instance", func() { BeforeEach(func() { ctx, _ = context.WithTimeout(context.Background(), 10*time.Millisecond) sched := sched.(*coremock.Schedule) - sched.On("Next").Return(time.Now().Add(5*time.Second), true) - sched.On("Left").Return(1) - gun.On("Bind", aggregator, mock.Anything).Return(nil) - provider.On("Acquire").Return(struct{}{}, true) + sched.On("Next").Return(time.Now().Add(5*time.Second), true) + sched.On("Left").Return(1) + gun.On("Bind", aggregator, mock.Anything).Return(nil) + provider.On("Acquire").Return(struct{}{}, true) }) It("start fail", func() { err := ins.Run(ctx) diff --git a/core/mocks/aggregator.go b/core/mocks/aggregator.go index 600cbca28..b325dcbc9 100644 --- a/core/mocks/aggregator.go +++ b/core/mocks/aggregator.go @@ -4,8 +4,8 @@ package coremock import ( "context" - "github.com/yandex/pandora/core" "github.com/stretchr/testify/mock" + "github.com/yandex/pandora/core" ) // Aggregator is an autogenerated mock type for the Aggregator type diff --git a/core/mocks/gun.go b/core/mocks/gun.go index 4fbd2b19d..aa69c41d7 100644 --- a/core/mocks/gun.go +++ b/core/mocks/gun.go @@ -2,8 +2,8 @@ package coremock import ( - core "github.com/yandex/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Gun is an autogenerated mock type for the Gun type diff --git a/core/mocks/provider.go b/core/mocks/provider.go index e5eaf9ecd..fd3cb0b1e 100644 --- a/core/mocks/provider.go +++ b/core/mocks/provider.go @@ -4,8 +4,8 @@ package coremock import ( context "context" - core "github.com/yandex/pandora/core" mock "github.com/stretchr/testify/mock" + core "github.com/yandex/pandora/core" ) // Provider is an autogenerated mock type for the Provider type diff --git a/core/plugin/pluginconfig/hooks_test.go b/core/plugin/pluginconfig/hooks_test.go index 727202df5..7237d31e2 100644 --- a/core/plugin/pluginconfig/hooks_test.go +++ b/core/plugin/pluginconfig/hooks_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "github.com/yandex/pandora/core/config" - "github.com/yandex/pandora/core/plugin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/yandex/pandora/core/config" + "github.com/yandex/pandora/core/plugin" ) func init() { diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index bffd469b7..4aa97551e 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,7 +8,6 @@ package errutil import ( "context" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) diff --git a/lib/errutil/errutil_suite_test.go b/lib/errutil/errutil_suite_test.go index 85086bde5..7a82d5197 100644 --- a/lib/errutil/errutil_suite_test.go +++ b/lib/errutil/errutil_suite_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - "github.com/yandex/pandora/lib/ginkgoutil" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/ginkgoutil" ) func TestErrutil(t *testing.T) { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 617e0aacd..8103e13d0 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -9,9 +9,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" + "github.com/pkg/errors" "github.com/yandex/pandora/lib/ginkgoutil" netmock "github.com/yandex/pandora/lib/netutil/mocks" - "github.com/pkg/errors" ) func TestNetutil(t *testing.T) { From d9d357d149a9ffab9d84dcd2e5e0e5741d6cba24 Mon Sep 17 00:00:00 2001 From: snermolaev Date: Tue, 5 Oct 2021 11:01:42 +0300 Subject: [PATCH 40/80] prepare for go1.17: fix go fmt style tests ref:0a2f9b97703b9d979c339368b2ca9e3497f5391c --- lib/tag/no_degug.go | 1 + lib/tag/no_race.go | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/tag/no_degug.go b/lib/tag/no_degug.go index 0877c0d71..697fb8ef2 100644 --- a/lib/tag/no_degug.go +++ b/lib/tag/no_degug.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // Author: Vladimir Skipor +//go:build !debug // +build !debug package tag diff --git a/lib/tag/no_race.go b/lib/tag/no_race.go index d746b261b..7ccebb392 100644 --- a/lib/tag/no_race.go +++ b/lib/tag/no_race.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // Author: Vladimir Skipor +//go:build !race // +build !race package tag From 5f00b96ffd16a65386474b66a1d3a105f0a3a0fb Mon Sep 17 00:00:00 2001 From: buglloc Date: Mon, 25 Oct 2021 12:49:01 +0300 Subject: [PATCH 41/80] [pandora] deal with strict TLS APLN checking. DEVTOOLS-8712 ref:50215d3a488483f1f6133feeda0cb1293cd1a297 --- components/phttp/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/phttp/client.go b/components/phttp/client.go index 0aea86e07..d8246d1e1 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -9,12 +9,13 @@ import ( "crypto/tls" "net" "net/http" + "strings" "time" + "github.com/pkg/errors" "go.uber.org/zap" "golang.org/x/net/http2" - "github.com/pkg/errors" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" ) @@ -145,6 +146,11 @@ const notHTTP2PanicMsg = "Non HTTP/2 connection established. Seems that target d func (c *panicOnHTTP1Client) Do(req *http.Request) (*http.Response, error) { res, err := c.Client.Do(req) if err != nil { + var opError *net.OpError + // Unfortunately, Go doesn't expose tls.alert (https://github.com/golang/go/issues/35234), so we make decisions based on the error message + if errors.As(err, &opError) && opError.Op == "remote error" && strings.Contains(err.Error(), "no application protocol") { + zap.L().Panic(notHTTP2PanicMsg, zap.Error(err)) + } return nil, err } err = checkHTTP2(res.TLS) From 8eccb046560f6878dbd94fa2f74ec056fce2813a Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 28 Oct 2021 15:34:26 +0300 Subject: [PATCH 42/80] PR from branch users/ligreen/pandora-0.3.4 new version 0.3.4 update go.mod update github.com/pkg/errors to v0.9.0 ref:5fce8482502ea691ccf4e88a5f6ced5dbdbced56 --- cli/cli.go | 2 +- go.mod | 49 ++++++++++-------- go.sum | 147 ++++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 164 insertions(+), 34 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 3ac6dd7c7..d0dab54e3 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -25,7 +25,7 @@ import ( "github.com/yandex/pandora/lib/zaputil" ) -const Version = "0.3.3" +const Version = "0.3.4" const defaultConfigFile = "load" const stdinConfigSelector = "-" diff --git a/go.mod b/go.mod index eeba8ce32..565b6cadc 100644 --- a/go.mod +++ b/go.mod @@ -1,46 +1,53 @@ module github.com/yandex/pandora -go 1.15 +go 1.17 require ( - github.com/BurntSushi/toml v0.3.1 // indirect github.com/asaskevich/govalidator v0.0.0-20171111151018-521b25f4b05f github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae - github.com/davecgh/go-spew v1.1.0 // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4 github.com/fatih/structs v1.0.0 - github.com/fsnotify/fsnotify v1.4.7 // indirect github.com/ghodss/yaml v1.0.0 - github.com/go-playground/locales v0.11.2 // indirect - github.com/go-playground/universal-translator v0.16.0 // indirect - github.com/golang/protobuf v1.3.1 // indirect - github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect github.com/hashicorp/go-multierror v0.0.0-20171204182908-b7773ae21874 - github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect + github.com/jhump/protoreflect v1.10.1 github.com/json-iterator/go v0.0.0-20180214060632-e7c7f3b33712 - github.com/kr/pretty v0.1.0 // indirect github.com/magiconair/properties v1.7.6 github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 github.com/onsi/ginkgo v1.4.0 github.com/onsi/gomega v1.3.0 - github.com/pelletier/go-toml v1.1.0 // indirect - github.com/pkg/errors v0.8.0 - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pkg/errors v0.9.0 github.com/pquerna/ffjson v0.0.0-20171002144729-d49c2bc1aa13 github.com/spf13/afero v1.0.2 + github.com/spf13/viper v1.0.0 + github.com/stretchr/testify v1.7.0 + go.uber.org/atomic v1.3.1 + go.uber.org/zap v1.7.1 + golang.org/x/net v0.0.0-20200822124328-c89045814202 + google.golang.org/grpc v1.41.0 + gopkg.in/bluesuncorp/validator.v9 v9.10.0 +) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/go-playground/locales v0.11.2 // indirect + github.com/go-playground/universal-translator v0.16.0 // indirect + github.com/golang/protobuf v1.4.3 // indirect + github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect + github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect + github.com/pelletier/go-toml v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/cast v1.2.0 // indirect github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec // indirect github.com/spf13/pflag v1.0.0 // indirect - github.com/spf13/viper v1.0.0 github.com/stretchr/objx v0.1.0 // indirect - github.com/stretchr/testify v1.2.1 - go.uber.org/atomic v1.3.1 go.uber.org/multierr v1.1.0 // indirect - go.uber.org/zap v1.7.1 - golang.org/x/net v0.0.0-20190311183353-d8887717615a - gopkg.in/bluesuncorp/validator.v9 v9.10.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect + golang.org/x/text v0.3.0 // indirect + google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect - gopkg.in/yaml.v2 v2.0.0 // indirect + gopkg.in/yaml.v2 v2.2.3 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/go.sum b/go.sum index 6c128cc18..53cccadaa 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,26 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/asaskevich/govalidator v0.0.0-20171111151018-521b25f4b05f h1:xHxhygLkJBQaXZ7H0JUpmqK/gfKO2DZXB7gAKT6bbBs= github.com/asaskevich/govalidator v0.0.0-20171111151018-521b25f4b05f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae h1:2Zmk+8cNvAGuY8AyvZuWpUdpQUAXwfom4ReVMe/CTIo= github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4 h1:fP04zlkPjAGpsduG7xN3rRkxjAqkJaIQnnkNYYw/pAk= @@ -20,16 +35,41 @@ github.com/go-playground/locales v0.11.2 h1:wH6Ksuvzk0SU9M6wUeGz/EaRWnavAHCOsFre github.com/go-playground/locales v0.11.2/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v0.0.0-20171204182908-b7773ae21874 h1:em+tTnzgU7N22woTBMcSJAOW7tRHAkK597W+MD/CpK8= github.com/hashicorp/go-multierror v0.0.0-20171204182908-b7773ae21874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb h1:1OvvPvZkn/yCQ3xBcM8y4020wdkMXPHLB4+NfoGWh4U= github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= +github.com/jhump/protoreflect v1.10.1 h1:iH+UZfsbRE6vpyZH7asAjTPWJf7RJbpZ9j/N3lDlKs0= +github.com/jhump/protoreflect v1.10.1/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/json-iterator/go v0.0.0-20180214060632-e7c7f3b33712 h1:nANBg0vxBeNql2DGe4fxaAGskRFEWtXg5cgWJYuHQ14= github.com/json-iterator/go v0.0.0-20180214060632-e7c7f3b33712/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -39,18 +79,22 @@ github.com/magiconair/properties v1.7.6 h1:U+1DqNen04MdEPgFiIwdOUiqZ8qPa37xgogX/ github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/onsi/ginkgo v1.4.0 h1:n60/4GZK0Sr9O2iuGKq876Aoa0ER2ydgpMOBwzJ8e2c= github.com/onsi/ginkgo v1.4.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.3.0 h1:yPHEatyQC4jN3vdfvqJXG7O9vfC6LhaAV1NEdYpP+h0= github.com/onsi/gomega v1.3.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/pelletier/go-toml v1.1.0 h1:cmiOvKzEunMsAxyhXSzpL5Q1CRKpVv0KQsnAIcSEVYM= github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.0 h1:J8lpUdobwIeCI7OiSxHqEwJUKvJwicL5+3v1oe2Yb4k= +github.com/pkg/errors v0.9.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/ffjson v0.0.0-20171002144729-d49c2bc1aa13 h1:AUK/hm/tPsiNNASdb3J8fySVRZoI7fnK5mlOvdFD43o= github.com/pquerna/ffjson v0.0.0-20171002144729-d49c2bc1aa13/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spf13/afero v1.0.2 h1:5bRmqmInNmNFkI9NG9O0Xc/Lgl9wOWWUUA/O8XZqTCo= github.com/spf13/afero v1.0.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg= @@ -63,10 +107,12 @@ github.com/spf13/viper v1.0.0 h1:RUA/ghS2i64rlnn4ydTfblY8Og8QzcPtCcHvgMn+w/I= github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U= -github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/uber-go/atomic v1.3.0 h1:ylWoWcs+jXihgo3Us1Sdsatf2R6+OlBGm8fexR3oFG4= -github.com/uber-go/atomic v1.3.0/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.1 h1:U8WaWEmp56LGz7PReduqHRVF6zzs9GbMC2NEZ42dxSQ= go.uber.org/atomic v1.3.1/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= @@ -74,17 +120,94 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ go.uber.org/zap v1.7.1 h1:wKPciimwkIgV4Aag/wpSDzvtO5JrfwdHKHO7blTHx7Q= go.uber.org/zap v1.7.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= +google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12 h1:OwhZOOMuf7leLaSCuxtQ9FW7ui2L2L6UKOtKAUqovUQ= +google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/bluesuncorp/validator.v9 v9.10.0 h1:eyhz/IzFglUqngYr1p7WCfKVAAQh9E/IsqJcnwG/OWg= gopkg.in/bluesuncorp/validator.v9 v9.10.0/go.mod h1:sz1RrKEIYJCpC5S6ruDsBWo5vYV69E+bEZ86LbUsSZ8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/yaml.v2 v2.0.0 h1:uUkhRGrsEyx/laRdeS6YIQKIys8pg+lRSRdVMTYjivs= -gopkg.in/yaml.v2 v2.0.0/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= \ No newline at end of file From 24ece446e8bd8d95906374eade1925ae00eb0472 Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 29 Oct 2021 00:33:31 +0300 Subject: [PATCH 43/80] fix multierror import ref:48b69b5efae284364884541b35fa098ebfa0746b --- lib/errutil/errutil.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/errutil/errutil.go b/lib/errutil/errutil.go index 4aa97551e..ab231d04f 100644 --- a/lib/errutil/errutil.go +++ b/lib/errutil/errutil.go @@ -8,6 +8,7 @@ package errutil import ( "context" + multierror "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) From 3ad24e7a4cedf6cc3dab1e39bb48f5140d0b305d Mon Sep 17 00:00:00 2001 From: griddic Date: Thu, 18 Nov 2021 21:23:58 +0300 Subject: [PATCH 44/80] YANDEXTANK-510: http uri-style ammos ref:1063728c2f728ddde8fa1392b9336e3bd38f4e0e --- .arcignore | 1 + cli/cli.go | 2 +- components/phttp/ammo/simple/provider.go | 3 ++ components/phttp/ammo/simple/uri/provider.go | 31 +++++++++++++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .arcignore diff --git a/.arcignore b/.arcignore new file mode 100644 index 000000000..04204c7c9 --- /dev/null +++ b/.arcignore @@ -0,0 +1 @@ +config diff --git a/cli/cli.go b/cli/cli.go index d0dab54e3..66a21e4b6 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -25,7 +25,7 @@ import ( "github.com/yandex/pandora/lib/zaputil" ) -const Version = "0.3.4" +const Version = "0.3.5" const defaultConfigFile = "load" const stdinConfigSelector = "-" diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index dab3d110e..117fafa4f 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -23,6 +23,7 @@ func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, f start: start, Sink: make(chan *Ammo, 128), Pool: sync.Pool{New: func() interface{} { return &Ammo{} }}, + Close: func() {}, } } @@ -33,6 +34,7 @@ type Provider struct { Sink chan *Ammo Pool sync.Pool idCounter atomic.Int64 + Close func() core.ProviderDeps } @@ -49,6 +51,7 @@ func (p *Provider) Release(a core.Ammo) { } func (p *Provider) Run(ctx context.Context, deps core.ProviderDeps) error { + defer p.Close() p.ProviderDeps = deps defer close(p.Sink) file, err := p.fs.Open(p.fileName) diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index c6070e980..219e40f5d 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -8,6 +8,7 @@ package uri import ( "bufio" "context" + "fmt" "github.com/pkg/errors" "github.com/spf13/afero" @@ -17,22 +18,50 @@ import ( ) type Config struct { - File string `validate:"required"` + File string // Limit limits total num of ammo. Unlimited if zero. Limit int `validate:"min=0"` // Redefine HTTP headers Headers []string // Passes limits ammo file passes. Unlimited if zero. Passes int `validate:"min=0"` + Uris []string } // TODO: pass logger and metricsRegistry func NewProvider(fs afero.Fs, conf Config) *Provider { + if len(conf.Uris) > 0 { + if conf.File != "" { + panic(`One should specify either 'file' or 'uris', but not both of them.`) + } + file, err := afero.TempFile(fs, "", "generated_ammo_") + if err != nil { + panic(fmt.Sprintf(`failed to create tmp ammo file: %v`, err)) + } + for _, uri := range conf.Uris { + _, err := file.WriteString(fmt.Sprintf("%s\n", uri)) + if err != nil { + panic(fmt.Sprintf(`failed to write ammo in tmp file: %v`, err)) + } + } + conf.File = file.Name() + } + if conf.File == "" { + panic(`One should specify either 'file' or 'uris'.`) + } var p Provider p = Provider{ Provider: simple.NewProvider(fs, conf.File, p.start), Config: conf, } + p.Close = func() { + if len(conf.Uris) > 0 { + err := fs.Remove(conf.File) + if err != nil { + zap.L().Error("failed to delete temp file", zap.String("file name", conf.File)) + } + } + } return &p } From 3250fc3be2a610ba578e681c304d5e7f6bdf8515 Mon Sep 17 00:00:00 2001 From: griddic Date: Mon, 22 Nov 2021 17:02:59 +0300 Subject: [PATCH 45/80] PR for branch feature/YANDEXTANK-510/http-uri-style-ammo YANDEXTANK-510: remove .arcignore YANDEXTANK-510: up pandora version YANDEXTANK-510: fix logging + more specific panics CLOUDLOAD-163: http uri-style ammos ref:81458615d64f6562ea822df51e87f48f207d3ed4 --- .arcignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .arcignore diff --git a/.arcignore b/.arcignore deleted file mode 100644 index 04204c7c9..000000000 --- a/.arcignore +++ /dev/null @@ -1 +0,0 @@ -config From c56aff0d994f9c92d1eb29de3dd60d81d6b379c3 Mon Sep 17 00:00:00 2001 From: ligreen Date: Wed, 1 Dec 2021 12:08:39 +0300 Subject: [PATCH 46/80] PR from branch users/ligreen/pandora-writelog fix request body add answ logger ref:0c8c3a130720a79ece310b532f5e09c135518fe8 --- components/phttp/base.go | 43 ++++++++++++++++++++++++++++++- components/phttp/base_test.go | 2 ++ components/phttp/connect.go | 4 ++- components/phttp/connect_test.go | 4 ++- components/phttp/http.go | 12 +++++---- components/phttp/http_test.go | 21 ++++++++++----- components/phttp/import/import.go | 9 ++++--- lib/answlog/logger.go | 23 +++++++++++++++++ 8 files changed, 100 insertions(+), 18 deletions(-) create mode 100644 lib/answlog/logger.go diff --git a/components/phttp/base.go b/components/phttp/base.go index 1409327ca..31856f35a 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -6,10 +6,13 @@ package phttp import ( + "bytes" "context" + "fmt" "io" "io/ioutil" "net/http" + "net/http/httputil" "net/url" "github.com/pkg/errors" @@ -23,6 +26,9 @@ const ( EmptyTag = "__EMPTY__" ) +//var answ *zap.Logger = answlog.Init() +//var bodyBytes []byte + type BaseGunConfig struct { AutoTag AutoTagConfig `config:"auto-tag"` } @@ -51,6 +57,7 @@ type BaseGun struct { Connect func(ctx context.Context) error // Optional hook. OnClose func() error // Optional. Called on Close(). Aggregator netsample.Aggregator // Lazy set via BindResultTo. + AnswLog *zap.Logger core.GunDeps } @@ -78,6 +85,7 @@ func (b *BaseGun) Bind(aggregator netsample.Aggregator, deps core.GunDeps) error // Shoot is thread safe iff Do and Connect hooks are thread safe. func (b *BaseGun) Shoot(ammo Ammo) { + var bodyBytes []byte if b.Aggregator == nil { zap.L().Panic("must bind before shoot") } @@ -99,8 +107,8 @@ func (b *BaseGun) Shoot(ammo Ammo) { } if b.DebugLog { b.Log.Debug("Prepared ammo to shoot", zap.Stringer("url", req.URL)) + bodyBytes = GetBody(req) } - if b.Config.AutoTag.Enabled && (!b.Config.AutoTag.NoTagOnly || sample.Tags() == "") { sample.AddTag(autotag(b.Config.AutoTag.URIElements, req.URL)) } @@ -126,6 +134,7 @@ func (b *BaseGun) Shoot(ammo Ammo) { if b.DebugLog { b.verboseLogging(res) + b.answLogging(req, bodyBytes, res) } sample.SetProtoCode(res.StatusCode) @@ -177,6 +186,27 @@ func (b *BaseGun) verboseLogging(res *http.Response) { ) } +func (b *BaseGun) answLogging(req *http.Request, bodyBytes []byte, res *http.Response) { + isBody := false + if bodyBytes != nil { + req.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes)) + isBody = true + } + dump, err := httputil.DumpRequestOut(req, isBody) + if err != nil { + zap.L().Error("Error dumping request: %s", zap.Error(err)) + } + msg := fmt.Sprintf("REQUEST:\n%s\n\n", string(dump)) + b.AnswLog.Debug(msg) + + dump, err = httputil.DumpResponse(res, true) + if err != nil { + zap.L().Error("Error dumping response: %s", zap.Error(err)) + } + msg = fmt.Sprintf("RESPONSE:\n%s", string(dump)) + b.AnswLog.Debug(msg) +} + func autotag(depth int, URL *url.URL) string { path := URL.Path var ind int @@ -190,3 +220,14 @@ func autotag(depth int, URL *url.URL) string { } return path[:ind] } + +func GetBody(req *http.Request) []byte { + if req.Body != nil && req.Body != http.NoBody { + bodyBytes, _ := ioutil.ReadAll(req.Body) + req.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes)) + return bodyBytes + } + + return nil + +} diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index 7effd2ddd..d8aa9eb69 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -18,6 +18,7 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" + "go.uber.org/zap" ammomock "github.com/yandex/pandora/components/phttp/mocks" "github.com/yandex/pandora/core" @@ -109,6 +110,7 @@ var _ = Describe("BaseGun", func() { Context("Do ok", func() { BeforeEach(func() { body = ioutil.NopCloser(strings.NewReader("aaaaaaa")) + base.AnswLog = zap.NewNop() base.Do = func(doReq *http.Request) (*http.Response, error) { Expect(doReq).To(Equal(req)) return res, nil diff --git a/components/phttp/connect.go b/components/phttp/connect.go index bf8340cdb..110ac58a3 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -16,6 +16,7 @@ import ( "github.com/pkg/errors" "github.com/yandex/pandora/lib/netutil" + "go.uber.org/zap" ) type ConnectGunConfig struct { @@ -26,7 +27,7 @@ type ConnectGunConfig struct { BaseGunConfig `config:",squash"` } -func NewConnectGun(conf ConnectGunConfig) *ConnectGun { +func NewConnectGun(conf ConnectGunConfig, answLog *zap.Logger) *ConnectGun { scheme := "http" if conf.SSL { scheme = "https" @@ -41,6 +42,7 @@ func NewConnectGun(conf ConnectGunConfig) *ConnectGun { client.CloseIdleConnections() return nil }, + AnswLog: answLog, }, scheme: scheme, client: client, diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index 7492fa7ca..0a0ff3c13 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -15,6 +15,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "go.uber.org/zap" "github.com/yandex/pandora/core/aggregator/netsample" ) @@ -85,9 +86,10 @@ var _ = Describe("connect", func() { proxy := httptest.NewServer(tunnelHandler(origin.URL)) defer proxy.Close() + log := zap.NewNop() conf := DefaultConnectGunConfig() conf.Target = proxy.Listener.Addr().String() - connectGun := NewConnectGun(conf) + connectGun := NewConnectGun(conf, log) results := &netsample.TestAggregator{} _ = connectGun.Bind(results, testDeps()) diff --git a/components/phttp/http.go b/components/phttp/http.go index c057b49f6..0e8caf93c 100644 --- a/components/phttp/http.go +++ b/components/phttp/http.go @@ -9,6 +9,7 @@ import ( "net/http" "github.com/pkg/errors" + "go.uber.org/zap" ) type ClientGunConfig struct { @@ -27,14 +28,14 @@ type HTTP2GunConfig struct { Client ClientConfig `config:",squash"` } -func NewHTTPGun(conf HTTPGunConfig) *HTTPGun { +func NewHTTPGun(conf HTTPGunConfig, answLog *zap.Logger) *HTTPGun { transport := NewTransport(conf.Client.Transport, NewDialer(conf.Client.Dialer).DialContext) client := newClient(transport, conf.Client.Redirect) - return NewClientGun(client, conf.Gun) + return NewClientGun(client, conf.Gun, answLog) } // NewHTTP2Gun return simple HTTP/2 gun that can shoot sequentially through one connection. -func NewHTTP2Gun(conf HTTP2GunConfig) (*HTTPGun, error) { +func NewHTTP2Gun(conf HTTP2GunConfig, answLog *zap.Logger) (*HTTPGun, error) { if !conf.Gun.SSL { // Open issue on github if you really need this feature. return nil, errors.New("HTTP/2.0 over TCP is not supported. Please leave SSL option true by default.") @@ -43,10 +44,10 @@ func NewHTTP2Gun(conf HTTP2GunConfig) (*HTTPGun, error) { client := newClient(transport, conf.Client.Redirect) // Will panic and cancel shooting whet target doesn't support HTTP/2. client = &panicOnHTTP1Client{client} - return NewClientGun(client, conf.Gun), nil + return NewClientGun(client, conf.Gun, answLog), nil } -func NewClientGun(client Client, conf ClientGunConfig) *HTTPGun { +func NewClientGun(client Client, conf ClientGunConfig, answLog *zap.Logger) *HTTPGun { scheme := "http" if conf.SSL { scheme = "https" @@ -60,6 +61,7 @@ func NewClientGun(client Client, conf ClientGunConfig) *HTTPGun { client.CloseIdleConnections() return nil }, + AnswLog: answLog, }, scheme: scheme, target: conf.Target, diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index f9a18d51b..7a378c979 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -45,10 +45,11 @@ var _ = Describe("BaseGun", func() { actualReq = req })) defer server.Close() + log := zap.NewNop() conf := DefaultHTTPGunConfig() conf.Gun.Target = strings.TrimPrefix(server.URL, "http://") results := &netsample.TestAggregator{} - httpGun := NewHTTPGun(conf) + httpGun := NewHTTPGun(conf, log) _ = httpGun.Bind(results, testDeps()) am := newAmmoReq(expectedReq) @@ -94,10 +95,11 @@ var _ = Describe("HTTP", func() { server.Start() } defer server.Close() + log := zap.NewNop() conf := DefaultHTTPGunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Gun.SSL = https - gun := NewHTTPGun(conf) + gun := NewHTTPGun(conf, log) var aggr netsample.TestAggregator _ = gun.Bind(&aggr, testDeps()) gun.Shoot(newAmmoURL("/")) @@ -119,10 +121,11 @@ var _ = Describe("HTTP", func() { } })) defer server.Close() + log := zap.NewNop() conf := DefaultHTTPGunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Client.Redirect = redirect - gun := NewHTTPGun(conf) + gun := NewHTTPGun(conf, log) var aggr netsample.TestAggregator _ = gun.Bind(&aggr, testDeps()) gun.Shoot(newAmmoURL("/redirect")) @@ -156,10 +159,11 @@ var _ = Describe("HTTP", func() { Expect(err).NotTo(HaveOccurred()) Expect(res.StatusCode).To(Equal(http.StatusForbidden)) + log := zap.NewNop() conf := DefaultHTTPGunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Gun.SSL = true - gun := NewHTTPGun(conf) + gun := NewHTTPGun(conf, log) var results netsample.TestAggregator _ = gun.Bind(&results, testDeps()) gun.Shoot(newAmmoURL("/")) @@ -180,9 +184,10 @@ var _ = Describe("HTTP/2", func() { } })) defer server.Close() + log := zap.NewNop() conf := DefaultHTTP2GunConfig() conf.Gun.Target = server.Listener.Addr().String() - gun, _ := NewHTTP2Gun(conf) + gun, _ := NewHTTP2Gun(conf, log) var results netsample.TestAggregator _ = gun.Bind(&results, testDeps()) gun.Shoot(newAmmoURL("/")) @@ -194,9 +199,10 @@ var _ = Describe("HTTP/2", func() { zap.S().Info("Served") })) defer server.Close() + log := zap.NewNop() conf := DefaultHTTP2GunConfig() conf.Gun.Target = server.Listener.Addr().String() - gun, _ := NewHTTP2Gun(conf) + gun, _ := NewHTTP2Gun(conf, log) var results netsample.TestAggregator _ = gun.Bind(&results, testDeps()) var r interface{} @@ -215,10 +221,11 @@ var _ = Describe("HTTP/2", func() { zap.S().Info("Served") })) defer server.Close() + log := zap.NewNop() conf := DefaultHTTP2GunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Gun.SSL = false - _, err := NewHTTP2Gun(conf) + _, err := NewHTTP2Gun(conf, log) Expect(err).To(HaveOccurred()) }) diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index 016eb47f5..a15f3bad6 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -18,10 +18,13 @@ import ( "github.com/yandex/pandora/components/phttp/ammo/simple/uripost" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/register" + "github.com/yandex/pandora/lib/answlog" "github.com/yandex/pandora/lib/netutil" ) func Import(fs afero.Fs) { + answLog := answlog.Init() + register.Provider("http/json", func(conf jsonline.Config) core.Provider { return jsonline.NewProvider(fs, conf) }) @@ -40,13 +43,13 @@ func Import(fs afero.Fs) { register.Gun("http", func(conf phttp.HTTPGunConfig) func() core.Gun { _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) - return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf)) } + return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf, answLog)) } }, phttp.DefaultHTTPGunConfig) register.Gun("http2", func(conf phttp.HTTP2GunConfig) func() (core.Gun, error) { _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) return func() (core.Gun, error) { - gun, err := phttp.NewHTTP2Gun(conf) + gun, err := phttp.NewHTTP2Gun(conf, answLog) return phttp.WrapGun(gun), err } }, phttp.DefaultHTTP2GunConfig) @@ -54,7 +57,7 @@ func Import(fs afero.Fs) { register.Gun("connect", func(conf phttp.ConnectGunConfig) func() core.Gun { _ = preResolveTargetAddr(&conf.Client, &conf.Target) return func() core.Gun { - return phttp.WrapGun(phttp.NewConnectGun(conf)) + return phttp.WrapGun(phttp.NewConnectGun(conf, answLog)) } }, phttp.DefaultConnectGunConfig) } diff --git a/lib/answlog/logger.go b/lib/answlog/logger.go new file mode 100644 index 000000000..dd7256e7f --- /dev/null +++ b/lib/answlog/logger.go @@ -0,0 +1,23 @@ +package answlog + +import ( + "os" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +func Init() *zap.Logger { + writerSyncer := getAnswWriter() + encoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()) + core := zapcore.NewCore(encoder, writerSyncer, zapcore.DebugLevel) + + Log := zap.New(core) + defer Log.Sync() + return Log +} + +func getAnswWriter() zapcore.WriteSyncer { + file, _ := os.Create("./answ.log") + return zapcore.AddSync(file) +} From a1b7f65b46b986d6fbc07c068fcd669e50f62dc9 Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 10 Dec 2021 16:11:02 +0300 Subject: [PATCH 47/80] add grpc request timeout ref:396812c9671fbb7e2f5ad143f3cba35b7d2e2b57 --- components/grpc/core.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index 097ada8cf..494bd52fc 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -34,7 +34,8 @@ type Sample struct { } type GunConfig struct { - Target string `validate:"required"` + Target string `validate:"required"` + Timeout time.Duration `config:"timeout"` // grpc request timeout } type Gun struct { @@ -140,7 +141,14 @@ func (g *Gun) shoot(ammo *Ammo) { } } - ctx := metadata.NewOutgoingContext(context.Background(), meta) + timeout := time.Second * 15 + if g.conf.Timeout != 0 { + timeout = time.Second * g.conf.Timeout + } + + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + ctx = metadata.NewOutgoingContext(ctx, meta) out, err := g.stub.InvokeRpc(ctx, &method, message) code = convertGrpcStatus(err) From 9cad480d814d3add0e45b389dc3137bf55d71674 Mon Sep 17 00:00:00 2001 From: sergei-lipin Date: Thu, 16 Dec 2021 11:34:15 +0300 Subject: [PATCH 48/80] MARKETAPI-7997: GunDeps/ProviderDeps: Unique Pool ID. ref:02278a1aec2464c7a6f6b5191a6b8060028c9f85 --- core/core.go | 5 ++++- core/engine/engine.go | 10 +++++----- core/engine/instance.go | 4 ++-- core/engine/instance_test.go | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/core.go b/core/core.go index 6de0bf12a..51ac7a7c2 100644 --- a/core/core.go +++ b/core/core.go @@ -63,7 +63,8 @@ type Provider interface { // WARN: another fields could be added in next MINOR versions. // That is NOT considered as a breaking compatibility change. type ProviderDeps struct { - Log *zap.Logger + Log *zap.Logger + PoolID string } //go:generate mockery -name=Gun -case=underscore -outpkg=coremock @@ -105,6 +106,8 @@ type GunDeps struct { // There is a race between Instances for Ammo Acquire, so it's not guaranteed, that // Instance with lower InstanceId gets it's Ammo earlier. InstanceID int + PoolID string + // TODO(skipor): https://github.com/yandex/pandora/issues/71 // Pass parallelism value. InstanceId MUST be -1 if parallelism > 1. } diff --git a/core/engine/engine.go b/core/engine/engine.go index 5979d52a1..3103b3ab2 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -195,7 +195,7 @@ func (p *instancePool) runAsync(runCtx context.Context) (*poolAsyncRunHandle, er runRes = make(chan instanceRunResult, runResultBufSize) ) go func() { - deps := core.ProviderDeps{Log: p.log} + deps := core.ProviderDeps{Log: p.log, PoolID: p.ID} providerErr <- p.Provider.Run(runCtx, deps) }() go func() { @@ -351,7 +351,7 @@ func (p *instancePool) startInstances( err = startCtx.Err() return } - firstInstance, err := newInstance(runCtx, p.log, 0, deps) + firstInstance, err := newInstance(runCtx, p.log, p.ID, 0, deps) if err != nil { return } @@ -364,7 +364,7 @@ func (p *instancePool) startInstances( for ; waiter.Wait(); started++ { id := started go func() { - runRes <- instanceRunResult{id, runNewInstance(runCtx, p.log, id, deps)} + runRes <- instanceRunResult{id, runNewInstance(runCtx, p.log, p.ID, id, deps)} }() } err = startCtx.Err() @@ -399,8 +399,8 @@ func (p *instancePool) buildNewInstanceSchedule(startCtx context.Context, cancel return } -func runNewInstance(ctx context.Context, log *zap.Logger, id int, deps instanceDeps) error { - instance, err := newInstance(ctx, log, id, deps) +func runNewInstance(ctx context.Context, log *zap.Logger, poolID string, id int, deps instanceDeps) error { + instance, err := newInstance(ctx, log, poolID, id, deps) if err != nil { return err } diff --git a/core/engine/instance.go b/core/engine/instance.go index 2bb4a6b90..7f5dad5fd 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -25,9 +25,9 @@ type instance struct { instanceSharedDeps } -func newInstance(ctx context.Context, log *zap.Logger, id int, deps instanceDeps) (*instance, error) { +func newInstance(ctx context.Context, log *zap.Logger, poolID string, id int, deps instanceDeps) (*instance, error) { log = log.With(zap.Int("instance", id)) - gunDeps := core.GunDeps{Ctx: ctx, Log: log, InstanceID: id} + gunDeps := core.GunDeps{Ctx: ctx, Log: log, PoolID: poolID, InstanceID: id} sched, err := deps.newSchedule() if err != nil { return nil, err diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index e13287b1c..db5359ff1 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -56,7 +56,7 @@ var _ = Describe("Instance", func() { metrics, }, } - ins, insCreateErr = newInstance(ctx, ginkgoutil.NewLogger(), 0, deps) + ins, insCreateErr = newInstance(ctx, ginkgoutil.NewLogger(), "pool_0", 0, deps) }) AfterEach(func() { From 6c1d02bfd67673575fb78e357f8de3dd9a9076a5 Mon Sep 17 00:00:00 2001 From: ligreen Date: Wed, 22 Dec 2021 14:34:16 +0300 Subject: [PATCH 49/80] add answlog path ref:e81fd4e338147df2fe1db7ca5eb6288a6fba04b4 --- components/phttp/connect.go | 1 + components/phttp/http.go | 7 ++++--- components/phttp/import/import.go | 4 +++- lib/answlog/logger.go | 11 +++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/components/phttp/connect.go b/components/phttp/connect.go index 110ac58a3..a98256f34 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -23,6 +23,7 @@ type ConnectGunConfig struct { Target string `validate:"endpoint,required"` ConnectSSL bool `config:"connect-ssl"` // Defines if tunnel encrypted. SSL bool // As in HTTP gun, defines scheme for http requests. + AnswLogPath string `config:"answ_path"` Client ClientConfig `config:",squash"` BaseGunConfig `config:",squash"` } diff --git a/components/phttp/http.go b/components/phttp/http.go index 0e8caf93c..c11760a6b 100644 --- a/components/phttp/http.go +++ b/components/phttp/http.go @@ -13,9 +13,10 @@ import ( ) type ClientGunConfig struct { - Target string `validate:"endpoint,required"` - SSL bool - Base BaseGunConfig `config:",squash"` + Target string `validate:"endpoint,required"` + SSL bool + AnswLogPath string `config:"answ_path"` + Base BaseGunConfig `config:",squash"` } type HTTPGunConfig struct { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index a15f3bad6..f0fdc0274 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -23,7 +23,6 @@ import ( ) func Import(fs afero.Fs) { - answLog := answlog.Init() register.Provider("http/json", func(conf jsonline.Config) core.Provider { return jsonline.NewProvider(fs, conf) @@ -43,11 +42,13 @@ func Import(fs afero.Fs) { register.Gun("http", func(conf phttp.HTTPGunConfig) func() core.Gun { _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) + answLog := answlog.Init(conf.Gun.AnswLogPath) return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf, answLog)) } }, phttp.DefaultHTTPGunConfig) register.Gun("http2", func(conf phttp.HTTP2GunConfig) func() (core.Gun, error) { _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) + answLog := answlog.Init(conf.Gun.AnswLogPath) return func() (core.Gun, error) { gun, err := phttp.NewHTTP2Gun(conf, answLog) return phttp.WrapGun(gun), err @@ -56,6 +57,7 @@ func Import(fs afero.Fs) { register.Gun("connect", func(conf phttp.ConnectGunConfig) func() core.Gun { _ = preResolveTargetAddr(&conf.Client, &conf.Target) + answLog := answlog.Init(conf.AnswLogPath) return func() core.Gun { return phttp.WrapGun(phttp.NewConnectGun(conf, answLog)) } diff --git a/lib/answlog/logger.go b/lib/answlog/logger.go index dd7256e7f..28720a1c5 100644 --- a/lib/answlog/logger.go +++ b/lib/answlog/logger.go @@ -7,8 +7,8 @@ import ( "go.uber.org/zap/zapcore" ) -func Init() *zap.Logger { - writerSyncer := getAnswWriter() +func Init(path string) *zap.Logger { + writerSyncer := getAnswWriter(path) encoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()) core := zapcore.NewCore(encoder, writerSyncer, zapcore.DebugLevel) @@ -17,7 +17,10 @@ func Init() *zap.Logger { return Log } -func getAnswWriter() zapcore.WriteSyncer { - file, _ := os.Create("./answ.log") +func getAnswWriter(path string) zapcore.WriteSyncer { + if path == "" { + path = "./answ.log" + } + file, _ := os.Create(path) return zapcore.AddSync(file) } From fc698a6e82b3b33c11ac75d5c8a87bb6951f7d3d Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 30 Dec 2021 17:33:22 +0300 Subject: [PATCH 50/80] PR from branch users/ligreen/pandora-answlog add answlog filter test fix add pandora answ log to artifacts dir ref:e0ba299dc3a44ea29f48013940f017b1efd66a2d --- components/phttp/base.go | 39 ++++++++++++++++++++++++++----- components/phttp/connect.go | 1 - components/phttp/http.go | 7 +++--- components/phttp/import/import.go | 6 ++--- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/components/phttp/base.go b/components/phttp/base.go index 31856f35a..023443fb9 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -26,11 +26,9 @@ const ( EmptyTag = "__EMPTY__" ) -//var answ *zap.Logger = answlog.Init() -//var bodyBytes []byte - type BaseGunConfig struct { AutoTag AutoTagConfig `config:"auto-tag"` + AnswLog AnswLogConfig `config:"answlog"` } // AutoTagConfig configure automatic tags generation based on ammo URI. First AutoTag URI path elements becomes tag. @@ -41,13 +39,25 @@ type AutoTagConfig struct { NoTagOnly bool `config:"no-tag-only"` // When true, autotagged only ammo that has no tag before. } +type AnswLogConfig struct { + Enabled bool `config:"enabled"` + Path string `config:"path"` + Filter string `config:"filter" valid:"oneof=all warning error"` +} + func DefaultBaseGunConfig() BaseGunConfig { return BaseGunConfig{ AutoTagConfig{ Enabled: false, URIElements: 2, NoTagOnly: true, - }} + }, + AnswLogConfig{ + Enabled: false, + Path: "answ.log", + Filter: "error", + }, + } } type BaseGun struct { @@ -107,7 +117,6 @@ func (b *BaseGun) Shoot(ammo Ammo) { } if b.DebugLog { b.Log.Debug("Prepared ammo to shoot", zap.Stringer("url", req.URL)) - bodyBytes = GetBody(req) } if b.Config.AutoTag.Enabled && (!b.Config.AutoTag.NoTagOnly || sample.Tags() == "") { sample.AddTag(autotag(b.Config.AutoTag.URIElements, req.URL)) @@ -115,6 +124,9 @@ func (b *BaseGun) Shoot(ammo Ammo) { if sample.Tags() == "" { sample.AddTag(EmptyTag) } + if b.Config.AnswLog.Enabled { + bodyBytes = GetBody(req) + } var err error defer func() { @@ -134,7 +146,22 @@ func (b *BaseGun) Shoot(ammo Ammo) { if b.DebugLog { b.verboseLogging(res) - b.answLogging(req, bodyBytes, res) + } + if b.Config.AnswLog.Enabled { + switch b.Config.AnswLog.Filter { + case "all": + b.answLogging(req, bodyBytes, res) + + case "warning": + if res.StatusCode >= 400 { + b.answLogging(req, bodyBytes, res) + } + + case "error": + if res.StatusCode >= 500 { + b.answLogging(req, bodyBytes, res) + } + } } sample.SetProtoCode(res.StatusCode) diff --git a/components/phttp/connect.go b/components/phttp/connect.go index a98256f34..110ac58a3 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -23,7 +23,6 @@ type ConnectGunConfig struct { Target string `validate:"endpoint,required"` ConnectSSL bool `config:"connect-ssl"` // Defines if tunnel encrypted. SSL bool // As in HTTP gun, defines scheme for http requests. - AnswLogPath string `config:"answ_path"` Client ClientConfig `config:",squash"` BaseGunConfig `config:",squash"` } diff --git a/components/phttp/http.go b/components/phttp/http.go index c11760a6b..0e8caf93c 100644 --- a/components/phttp/http.go +++ b/components/phttp/http.go @@ -13,10 +13,9 @@ import ( ) type ClientGunConfig struct { - Target string `validate:"endpoint,required"` - SSL bool - AnswLogPath string `config:"answ_path"` - Base BaseGunConfig `config:",squash"` + Target string `validate:"endpoint,required"` + SSL bool + Base BaseGunConfig `config:",squash"` } type HTTPGunConfig struct { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index f0fdc0274..9d366b612 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -42,13 +42,13 @@ func Import(fs afero.Fs) { register.Gun("http", func(conf phttp.HTTPGunConfig) func() core.Gun { _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) - answLog := answlog.Init(conf.Gun.AnswLogPath) + answLog := answlog.Init(conf.Gun.Base.AnswLog.Path) return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf, answLog)) } }, phttp.DefaultHTTPGunConfig) register.Gun("http2", func(conf phttp.HTTP2GunConfig) func() (core.Gun, error) { _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) - answLog := answlog.Init(conf.Gun.AnswLogPath) + answLog := answlog.Init(conf.Gun.Base.AnswLog.Path) return func() (core.Gun, error) { gun, err := phttp.NewHTTP2Gun(conf, answLog) return phttp.WrapGun(gun), err @@ -57,7 +57,7 @@ func Import(fs afero.Fs) { register.Gun("connect", func(conf phttp.ConnectGunConfig) func() core.Gun { _ = preResolveTargetAddr(&conf.Client, &conf.Target) - answLog := answlog.Init(conf.AnswLogPath) + answLog := answlog.Init(conf.BaseGunConfig.AnswLog.Path) return func() core.Gun { return phttp.WrapGun(phttp.NewConnectGun(conf, answLog)) } From 3961552441209a0c512c16be423241e4bb93f27a Mon Sep 17 00:00:00 2001 From: griddic Date: Fri, 21 Jan 2022 15:25:28 +0300 Subject: [PATCH 51/80] PR for branch feature/YANDEXTANK-548/call-reflection-once-v1 YANDEXTANK-548: call reflection once ref:21b402d20784befa35065cdb74ce46dc93daba58 --- README.md | 2 +- cli/cli.go | 2 +- components/grpc/core.go | 69 ++++++++++++++++--------- components/grpc/core_tests/core_test.go | 12 +++++ core/engine/engine.go | 29 ++++++++++- core/engine/instance.go | 9 ++++ core/engine/instance_test.go | 1 + core/warmup/interface.go | 6 +++ core/warmup/options.go | 12 +++++ docs/custom.rst | 2 +- docs/tutorial.rst | 6 +-- 11 files changed, 119 insertions(+), 31 deletions(-) create mode 100644 components/grpc/core_tests/core_test.go create mode 100644 core/warmup/interface.go create mode 100644 core/warmup/options.go diff --git a/README.md b/README.md index ede99d84d..948a82dab 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Run the binary with your config (see config examples at [examples](https://githu pandora myconfig.yaml ``` -Or use Pandora with [Yandex.Tank](http://yandextank.readthedocs.org/en/latest/configuration.html#pandora) and +Or use Pandora with [Yandex.Tank](https://yandextank.readthedocs.io/en/latest/core_and_modules.html#pandora) and [Overload](https://overload.yandex.net). ### Documentation diff --git a/cli/cli.go b/cli/cli.go index 66a21e4b6..f2659c30a 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -29,7 +29,6 @@ const Version = "0.3.5" const defaultConfigFile = "load" const stdinConfigSelector = "-" -var useStdinConfig = false var configSearchDirs = []string{"./", "./config", "/etc/pandora"} type cliConfig struct { @@ -189,6 +188,7 @@ func readConfig() *cliConfig { v := newViper() + var useStdinConfig = false args := flag.Args() if len(args) > 0 { switch { diff --git a/components/grpc/core.go b/components/grpc/core.go index 494bd52fc..62414437f 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -3,21 +3,24 @@ package grpc import ( "context" "encoding/json" + "fmt" "log" "time" + "github.com/jhump/protoreflect/grpcreflect" + "github.com/yandex/pandora/core/warmup" + reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" + "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" "github.com/jhump/protoreflect/dynamic/grpcdynamic" - "github.com/jhump/protoreflect/grpcreflect" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" - reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" "google.golang.org/grpc/status" ) @@ -49,52 +52,72 @@ type Gun struct { services map[string]desc.MethodDescriptor } -func NewGun(conf GunConfig) *Gun { - return &Gun{conf: conf} -} - -func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { +func (g *Gun) WarmUp(opts *warmup.Options) (interface{}, error) { conn, err := grpc.Dial( g.conf.Target, grpc.WithInsecure(), grpc.WithTimeout(time.Second), grpc.WithUserAgent("load test, pandora universal grpc shooter")) if err != nil { - log.Fatalf("FATAL: grpc.Dial failed\n %s\n", err) - } - g.client = conn - g.aggr = aggr - g.GunDeps = deps - g.stub = grpcdynamic.NewStub(conn) - - log := deps.Log - - if ent := log.Check(zap.DebugLevel, "Gun bind"); ent != nil { - // Enable debug level logging during shooting. Creating log entries isn't free. - g.DebugLog = true + return nil, fmt.Errorf("failed to connect to target: %w", err) } + defer conn.Close() meta := make(metadata.MD) refCtx := metadata.NewOutgoingContext(context.Background(), meta) refClient := grpcreflect.NewClient(refCtx, reflectpb.NewServerReflectionClient(conn)) listServices, err := refClient.ListServices() if err != nil { - log.Fatal("Fatal: failed to get services list\n %s\n", zap.Error(err)) + opts.Log.Fatal("Fatal: failed to get services list\n %s\n", zap.Error(err)) } - g.services = make(map[string]desc.MethodDescriptor) + services := make(map[string]desc.MethodDescriptor) for _, s := range listServices { service, err := refClient.ResolveService(s) if err != nil { if grpcreflect.IsElementNotFoundError(err) { continue } - log.Fatal("FATAL ResolveService: %s", zap.Error(err)) + opts.Log.Fatal("FATAL ResolveService: %s", zap.Error(err)) } listMethods := service.GetMethods() for _, m := range listMethods { - g.services[m.GetFullyQualifiedName()] = *m + services[m.GetFullyQualifiedName()] = *m } } + return services, nil +} + +func (g *Gun) AcceptWarmUpResult(i interface{}) error { + services, ok := i.(map[string]desc.MethodDescriptor) + if !ok { + return fmt.Errorf("grpc WarmUp result should be services: map[string]desc.MethodDescriptor") + } + g.services = services + return nil +} + +func NewGun(conf GunConfig) *Gun { + return &Gun{conf: conf} +} + +func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { + conn, err := grpc.Dial( + g.conf.Target, + grpc.WithInsecure(), + grpc.WithTimeout(time.Second), + grpc.WithUserAgent("load test, pandora universal grpc shooter")) + if err != nil { + log.Fatalf("FATAL: grpc.Dial failed\n %s\n", err) + } + g.client = conn + g.aggr = aggr + g.GunDeps = deps + g.stub = grpcdynamic.NewStub(conn) + + if ent := deps.Log.Check(zap.DebugLevel, "Gun bind"); ent != nil { + // Enable debug level logging during shooting. Creating log entries isn't free. + g.DebugLog = true + } return nil } diff --git a/components/grpc/core_tests/core_test.go b/components/grpc/core_tests/core_test.go new file mode 100644 index 000000000..e355c4adb --- /dev/null +++ b/components/grpc/core_tests/core_test.go @@ -0,0 +1,12 @@ +package core + +import ( + "testing" + + "github.com/yandex/pandora/components/grpc" + "github.com/yandex/pandora/core/warmup" +) + +func TestGrpcGunImplementsWarmedUp(t *testing.T) { + _ = warmup.WarmedUp(&grpc.Gun{}) +} diff --git a/core/engine/engine.go b/core/engine/engine.go index 3103b3ab2..3cea72c13 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -10,6 +10,8 @@ import ( "fmt" "sync" + "github.com/yandex/pandora/core/warmup" + "github.com/pkg/errors" "go.uber.org/zap" @@ -112,7 +114,7 @@ func (e *Engine) Wait() { func newPool(log *zap.Logger, m Metrics, onWaitDone func(), conf InstancePoolConfig) *instancePool { log = log.With(zap.String("pool", conf.ID)) - return &instancePool{log, m, onWaitDone, conf} + return &instancePool{log, m, onWaitDone, conf, nil} } type instancePool struct { @@ -120,6 +122,7 @@ type instancePool struct { metrics Metrics onWaitDone func() InstancePoolConfig + gunWarmUpResult interface{} } // Run start instance pool. Run blocks until fail happen, or all instances finish. @@ -141,6 +144,11 @@ func (p *instancePool) Run(ctx context.Context) error { cancel() }() + if err := p.warmUpGun(ctx); err != nil { + p.onWaitDone() + return err + } + rh, err := p.runAsync(ctx) if err != nil { return err @@ -162,6 +170,23 @@ func (p *instancePool) Run(ctx context.Context) error { } } +func (p *instancePool) warmUpGun(ctx context.Context) error { + dummyGun, err := p.NewGun() + if err != nil { + return fmt.Errorf("can't initiante a gun: %w", err) + } + if gunWithWarmUp, ok := dummyGun.(warmup.WarmedUp); ok { + p.gunWarmUpResult, err = gunWithWarmUp.WarmUp(&warmup.Options{ + Log: p.log, + Ctx: ctx, + }) + if err != nil { + return fmt.Errorf("gun warm up failed: %w", err) + } + } + return nil +} + type poolAsyncRunHandle struct { runCtx context.Context runCancel context.CancelFunc @@ -340,7 +365,7 @@ func (p *instancePool) startInstances( p.Aggregator, newInstanceSchedule, p.NewGun, - instanceSharedDeps{p.Provider, p.metrics}, + instanceSharedDeps{p.Provider, p.metrics, p.gunWarmUpResult}, } waiter := coreutil.NewWaiter(p.StartupSchedule, startCtx) diff --git a/core/engine/instance.go b/core/engine/instance.go index 7f5dad5fd..57579092f 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -7,8 +7,11 @@ package engine import ( "context" + "fmt" "io" + "github.com/yandex/pandora/core/warmup" + "github.com/pkg/errors" "go.uber.org/zap" @@ -36,6 +39,11 @@ func newInstance(ctx context.Context, log *zap.Logger, poolID string, id int, de if err != nil { return nil, err } + if warmedUp, ok := gun.(warmup.WarmedUp); ok { + if err := warmedUp.AcceptWarmUpResult(deps.gunWarmUpResult); err != nil { + return nil, fmt.Errorf("gun fauiled to accept warmup result: %w", err) + } + } err = gun.Bind(deps.aggregator, gunDeps) if err != nil { return nil, err @@ -54,6 +62,7 @@ type instanceDeps struct { type instanceSharedDeps struct { provider core.Provider Metrics + gunWarmUpResult interface{} } // Run blocks until ammo finish, error or context cancel. diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index db5359ff1..e64d8fbf3 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -54,6 +54,7 @@ var _ = Describe("Instance", func() { instanceSharedDeps{ provider, metrics, + nil, }, } ins, insCreateErr = newInstance(ctx, ginkgoutil.NewLogger(), "pool_0", 0, deps) diff --git a/core/warmup/interface.go b/core/warmup/interface.go new file mode 100644 index 000000000..6438074bf --- /dev/null +++ b/core/warmup/interface.go @@ -0,0 +1,6 @@ +package warmup + +type WarmedUp interface { + WarmUp(*Options) (interface{}, error) + AcceptWarmUpResult(interface{}) error +} diff --git a/core/warmup/options.go b/core/warmup/options.go new file mode 100644 index 000000000..a09d8224a --- /dev/null +++ b/core/warmup/options.go @@ -0,0 +1,12 @@ +package warmup + +import ( + "context" + + "go.uber.org/zap" +) + +type Options struct { + Log *zap.Logger + Ctx context.Context +} diff --git a/docs/custom.rst b/docs/custom.rst index c72c1a537..31a78f8cf 100644 --- a/docs/custom.rst +++ b/docs/custom.rst @@ -361,7 +361,7 @@ Websockets } else { code = 200 } - defer func() { + func() { sample.SetProtoCode(code) g.aggr.Report(sample) }() diff --git a/docs/tutorial.rst b/docs/tutorial.rst index e5db5e0b0..d4aff36b8 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -17,7 +17,7 @@ Pandora supports config files in `YAML`_ format. Create a new file named ``load. type: http # gun type target: example.com:80 # gun target ammo: - type: uri # ammo format + type: uri # ammo format file: ./ammo.uri # ammo File result: type: phout # report format (phout is compatible with Yandex.Tank) @@ -77,5 +77,5 @@ References .. target-notes:: .. _`Overload`: https://overload.yandex.net -.. _`Yandex.Tank`: http://yandextank.readthedocs.org/en/latest/configuration.html#pandora -.. _`YAML`: https://en.wikipedia.org/wiki/YAML \ No newline at end of file +.. _`Yandex.Tank`: https://yandextank.readthedocs.io/en/latest/core_and_modules.html#pandora +.. _`YAML`: https://en.wikipedia.org/wiki/YAML From a83475b5946238fc91c01b1a6ee5b8cdecdafb28 Mon Sep 17 00:00:00 2001 From: griddic Date: Fri, 21 Jan 2022 15:25:31 +0300 Subject: [PATCH 52/80] PR for branch feature/YANDEXTANK-548/call-reflection-once-v1 YANDEXTANK-548: misspells YANDEXTANK-548: update link to pandora in docs YANDEXTANK-548: tests YANDEXTANK-548: tests YANDEXTANK-548: before tests small refactoring YANDEXTANK-548: call reflection once ref:ac4c959ccee69646855b18476b42512477d55d46 --- core/engine/engine.go | 2 +- core/engine/instance.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/engine/engine.go b/core/engine/engine.go index 3cea72c13..502d18ba8 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -173,7 +173,7 @@ func (p *instancePool) Run(ctx context.Context) error { func (p *instancePool) warmUpGun(ctx context.Context) error { dummyGun, err := p.NewGun() if err != nil { - return fmt.Errorf("can't initiante a gun: %w", err) + return fmt.Errorf("can't initiate a gun: %w", err) } if gunWithWarmUp, ok := dummyGun.(warmup.WarmedUp); ok { p.gunWarmUpResult, err = gunWithWarmUp.WarmUp(&warmup.Options{ diff --git a/core/engine/instance.go b/core/engine/instance.go index 57579092f..0fe81d261 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -41,7 +41,7 @@ func newInstance(ctx context.Context, log *zap.Logger, poolID string, id int, de } if warmedUp, ok := gun.(warmup.WarmedUp); ok { if err := warmedUp.AcceptWarmUpResult(deps.gunWarmUpResult); err != nil { - return nil, fmt.Errorf("gun fauiled to accept warmup result: %w", err) + return nil, fmt.Errorf("gun failed to accept warmup result: %w", err) } } err = gun.Bind(deps.aggregator, gunDeps) From 77b346035b6399de81e8c8631f7e906278a00218 Mon Sep 17 00:00:00 2001 From: Grigoriy Date: Thu, 27 Jan 2022 19:14:04 +0300 Subject: [PATCH 53/80] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 948a82dab..85616d1ed 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Coverage Status](https://coveralls.io/repos/yandex/pandora/badge.svg?branch=develop&service=github)](https://coveralls.io/github/yandex/pandora?branch=develop) [![Documentation Status](https://readthedocs.org/projects/yandexpandora/badge/?version=develop)](https://yandexpandora.readthedocs.io/en/develop/?badge=develop) -Pandora is a high-performance load generator in Go language. It has built-in HTTP(S) and HTTP/2 support and you can write your own load scenarios in Go, compiling them just before your test. +Pandora is a high-performance load generator in Go language. It has built-in HTTP(S) and HTTP/2 support and you can write your own load scenarios in Go, compiling them just before your test. ## How to start From f1363482e70322469d810a932323bb1800ff87cd Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 8 Feb 2022 17:54:30 +0300 Subject: [PATCH 54/80] TLS support for grpc gun config_content: pools: - id: Custom gun: type: grpc target: grpc.demo.nrk.me.uk:443 tls: true ref:8e39c75bb027556c50d115fe76abfec50a0d428b --- components/grpc/core.go | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index 62414437f..5e9704e5b 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -2,6 +2,7 @@ package grpc import ( "context" + "crypto/tls" "encoding/json" "fmt" "log" @@ -9,6 +10,7 @@ import ( "github.com/jhump/protoreflect/grpcreflect" "github.com/yandex/pandora/core/warmup" + "google.golang.org/grpc/credentials" reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" "github.com/yandex/pandora/core" @@ -39,6 +41,7 @@ type Sample struct { type GunConfig struct { Target string `validate:"required"` Timeout time.Duration `config:"timeout"` // grpc request timeout + TLS bool } type Gun struct { @@ -53,11 +56,7 @@ type Gun struct { } func (g *Gun) WarmUp(opts *warmup.Options) (interface{}, error) { - conn, err := grpc.Dial( - g.conf.Target, - grpc.WithInsecure(), - grpc.WithTimeout(time.Second), - grpc.WithUserAgent("load test, pandora universal grpc shooter")) + conn, err := makeGRPCConnect(g.conf.Target, g.conf.TLS) if err != nil { return nil, fmt.Errorf("failed to connect to target: %w", err) } @@ -101,11 +100,7 @@ func NewGun(conf GunConfig) *Gun { } func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { - conn, err := grpc.Dial( - g.conf.Target, - grpc.WithInsecure(), - grpc.WithTimeout(time.Second), - grpc.WithUserAgent("load test, pandora universal grpc shooter")) + conn, err := makeGRPCConnect(g.conf.Target, g.conf.TLS) if err != nil { log.Fatalf("FATAL: grpc.Dial failed\n %s\n", err) } @@ -186,6 +181,20 @@ func (g *Gun) shoot(ammo *Ammo) { } +func makeGRPCConnect(target string, isTLS bool) (conn *grpc.ClientConn, err error) { + opts := []grpc.DialOption{} + if isTLS { + opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: true}))) + } else { + opts = append(opts, grpc.WithInsecure()) + } + opts = append(opts, grpc.WithTimeout(time.Second)) + opts = append(opts, grpc.WithUserAgent("load test, pandora universal grpc shooter")) + + conn, err = grpc.Dial(target, opts...) + return +} + func convertGrpcStatus(err error) int { s := status.Convert(err) From e8d24c4bcbfb2c40914dcbfd2c6094b6f6fa0298 Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 11 Feb 2022 22:33:03 +0300 Subject: [PATCH 55/80] add authority pseudo-header support ref:9eae0678d7534a704b38392625d409ea4bcf8c12 --- components/grpc/core.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index 5e9704e5b..cb12d543b 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -38,10 +38,15 @@ type Sample struct { ShootTimeSeconds float64 } +type grpcDialOptions struct { + Authority string `config:"authority"` +} + type GunConfig struct { - Target string `validate:"required"` - Timeout time.Duration `config:"timeout"` // grpc request timeout - TLS bool + Target string `validate:"required"` + Timeout time.Duration `config:"timeout"` // grpc request timeout + TLS bool `config:"tls"` + DialOptions grpcDialOptions `config:"dial_options"` } type Gun struct { @@ -56,7 +61,7 @@ type Gun struct { } func (g *Gun) WarmUp(opts *warmup.Options) (interface{}, error) { - conn, err := makeGRPCConnect(g.conf.Target, g.conf.TLS) + conn, err := makeGRPCConnect(g.conf.Target, g.conf.TLS, g.conf.DialOptions) if err != nil { return nil, fmt.Errorf("failed to connect to target: %w", err) } @@ -100,7 +105,7 @@ func NewGun(conf GunConfig) *Gun { } func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { - conn, err := makeGRPCConnect(g.conf.Target, g.conf.TLS) + conn, err := makeGRPCConnect(g.conf.Target, g.conf.TLS, g.conf.DialOptions) if err != nil { log.Fatalf("FATAL: grpc.Dial failed\n %s\n", err) } @@ -142,7 +147,6 @@ func (g *Gun) shoot(ammo *Ammo) { log.Fatalf("FATAL: Payload parsing error %s\n", err) return } - md := method.GetInputType() message := dynamic.NewMessage(md) err = message.UnmarshalJSON(payloadJSON) @@ -181,7 +185,7 @@ func (g *Gun) shoot(ammo *Ammo) { } -func makeGRPCConnect(target string, isTLS bool) (conn *grpc.ClientConn, err error) { +func makeGRPCConnect(target string, isTLS bool, dialOptions grpcDialOptions) (conn *grpc.ClientConn, err error) { opts := []grpc.DialOption{} if isTLS { opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: true}))) @@ -191,6 +195,10 @@ func makeGRPCConnect(target string, isTLS bool) (conn *grpc.ClientConn, err erro opts = append(opts, grpc.WithTimeout(time.Second)) opts = append(opts, grpc.WithUserAgent("load test, pandora universal grpc shooter")) + if dialOptions.Authority != "" { + opts = append(opts, grpc.WithAuthority(dialOptions.Authority)) + } + conn, err = grpc.Dial(target, opts...) return } From a78cbef11517f7b59fa5ca37b0384038d4edbf60 Mon Sep 17 00:00:00 2001 From: ligreen Date: Mon, 21 Feb 2022 17:51:52 +0300 Subject: [PATCH 56/80] PR from branch users/ligreen/pandora-ammo-provider1 only one ammo provider add ammo source support new json ammo provider ref:51e2909af71d89b2fd0c6567cecdea9c21503d7f --- components/grpc/ammo/ammo.go | 39 +++++++++ components/grpc/ammo/grpcjson/provider.go | 102 ++++++++++++++++++++++ components/grpc/ammo/provider.go | 63 +++++++++++++ components/grpc/core.go | 14 +-- components/grpc/import/import.go | 10 ++- main.go | 2 +- 6 files changed, 216 insertions(+), 14 deletions(-) create mode 100644 components/grpc/ammo/ammo.go create mode 100644 components/grpc/ammo/grpcjson/provider.go create mode 100644 components/grpc/ammo/provider.go diff --git a/components/grpc/ammo/ammo.go b/components/grpc/ammo/ammo.go new file mode 100644 index 000000000..3defba11a --- /dev/null +++ b/components/grpc/ammo/ammo.go @@ -0,0 +1,39 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package ammo + +type Ammo struct { + Tag string `json:"tag"` + Call string `json:"call"` + Metadata map[string]string `json:"metadata"` + Payload map[string]interface{} `json:"payload"` + id int + isInvalid bool +} + +func (a *Ammo) Reset(tag string, call string, metadata map[string]string, payload map[string]interface{}) { + *a = Ammo{tag, call, metadata, payload, -1, false} +} + +func (a *Ammo) SetID(id int) { + a.id = id +} + +func (a *Ammo) ID() int { + return a.id +} + +func (a *Ammo) Invalidate() { + a.isInvalid = true +} + +func (a *Ammo) IsInvalid() bool { + return a.isInvalid +} + +func (a *Ammo) IsValid() bool { + return !a.isInvalid +} diff --git a/components/grpc/ammo/grpcjson/provider.go b/components/grpc/ammo/grpcjson/provider.go new file mode 100644 index 000000000..79c3e5dcd --- /dev/null +++ b/components/grpc/ammo/grpcjson/provider.go @@ -0,0 +1,102 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package grpcjson + +import ( + "bufio" + "context" + + "github.com/pkg/errors" + "go.uber.org/zap" + + "github.com/yandex/pandora/components/grpc/ammo" + + jsoniter "github.com/json-iterator/go" + "github.com/spf13/afero" +) + +func NewProvider(fs afero.Fs, conf Config) *Provider { + var p Provider + if conf.Source.Path != "" { + conf.File = conf.Source.Path + } + p = Provider{ + Provider: ammo.NewProvider(fs, conf.File, p.start), + Config: conf, + } + return &p +} + +type Provider struct { + ammo.Provider + Config + log *zap.Logger +} + +type Source struct { + Type string + Path string +} + +type Config struct { + File string //`validate:"required"` + // Limit limits total num of ammo. Unlimited if zero. + Limit int `validate:"min=0"` + // Passes limits ammo file passes. Unlimited if zero. + Passes int `validate:"min=0"` + ContinueOnError bool + //Maximum number of byte in an ammo. Default is bufio.MaxScanTokenSize + MaxAmmoSize int + Source Source `config:"source"` +} + +func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { + var ammoNum, passNum int + for { + passNum++ + scanner := bufio.NewScanner(ammoFile) + if p.Config.MaxAmmoSize != 0 { + var buffer []byte + scanner.Buffer(buffer, p.Config.MaxAmmoSize) + } + for line := 1; scanner.Scan() && (p.Limit == 0 || ammoNum < p.Limit); line++ { + data := scanner.Bytes() + a, err := decodeAmmo(data, p.Pool.Get().(*ammo.Ammo)) + if err != nil { + if p.Config.ContinueOnError { + a.Invalidate() + } else { + return errors.Wrapf(err, "failed to decode ammo at line: %v; data: %q", line, data) + } + } + ammoNum++ + select { + case p.Sink <- a: + case <-ctx.Done(): + return nil + } + } + if p.Passes != 0 && passNum >= p.Passes { + break + } + _, err := ammoFile.Seek(0, 0) + if err != nil { + return errors.Wrap(err, "Failed to seek ammo file") + } + } + return nil +} + +func decodeAmmo(jsonDoc []byte, am *ammo.Ammo) (*ammo.Ammo, error) { + var ammo ammo.Ammo + err := jsoniter.Unmarshal(jsonDoc, &ammo) + if err != nil { + return am, errors.WithStack(err) + } + + am.Reset(ammo.Tag, ammo.Call, ammo.Metadata, ammo.Payload) + return am, nil +} diff --git a/components/grpc/ammo/provider.go b/components/grpc/ammo/provider.go new file mode 100644 index 000000000..e390b1947 --- /dev/null +++ b/components/grpc/ammo/provider.go @@ -0,0 +1,63 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package ammo + +import ( + "context" + "sync" + + "github.com/pkg/errors" + "github.com/spf13/afero" + "go.uber.org/atomic" + + "github.com/yandex/pandora/core" +) + +func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { + return Provider{ + fs: fs, + fileName: fileName, + start: start, + Sink: make(chan *Ammo, 128), + Pool: sync.Pool{New: func() interface{} { return &Ammo{} }}, + Close: func() {}, + } +} + +type Provider struct { + fs afero.Fs + fileName string + start func(ctx context.Context, file afero.File) error + Sink chan *Ammo + Pool sync.Pool + idCounter atomic.Int64 + Close func() + core.ProviderDeps +} + +func (p *Provider) Acquire() (core.Ammo, bool) { + ammo, ok := <-p.Sink + if ok { + ammo.SetID(int(p.idCounter.Inc() - 1)) + } + return ammo, ok +} + +func (p *Provider) Release(a core.Ammo) { + p.Pool.Put(a) +} + +func (p *Provider) Run(ctx context.Context, deps core.ProviderDeps) error { + defer p.Close() + p.ProviderDeps = deps + defer close(p.Sink) + file, err := p.fs.Open(p.fileName) + if err != nil { + return errors.Wrap(err, "failed to open ammo file") + } + defer file.Close() + return p.start(ctx, file) +} diff --git a/components/grpc/core.go b/components/grpc/core.go index cb12d543b..5fa5a9340 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -13,6 +13,7 @@ import ( "google.golang.org/grpc/credentials" reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" + "github.com/yandex/pandora/components/grpc/ammo" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" @@ -26,13 +27,6 @@ import ( "google.golang.org/grpc/status" ) -type Ammo struct { - Tag string `json:"tag"` - Call string `json:"call"` - Metadata map[string]string `json:"metadata"` - Payload map[string]interface{} `json:"payload"` -} - type Sample struct { URL string ShootTimeSeconds float64 @@ -122,12 +116,12 @@ func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error { return nil } -func (g *Gun) Shoot(ammo core.Ammo) { - customAmmo := ammo.(*Ammo) +func (g *Gun) Shoot(am core.Ammo) { + customAmmo := am.(*ammo.Ammo) g.shoot(customAmmo) } -func (g *Gun) shoot(ammo *Ammo) { +func (g *Gun) shoot(ammo *ammo.Ammo) { code := 0 sample := netsample.Acquire(ammo.Tag) diff --git a/components/grpc/import/import.go b/components/grpc/import/import.go index 9271e4281..77c362ac3 100644 --- a/components/grpc/import/import.go +++ b/components/grpc/import/import.go @@ -6,14 +6,18 @@ package example import ( + "github.com/spf13/afero" "github.com/yandex/pandora/components/grpc" + "github.com/yandex/pandora/components/grpc/ammo/grpcjson" "github.com/yandex/pandora/core" - coreimport "github.com/yandex/pandora/core/import" "github.com/yandex/pandora/core/register" ) -func Import() { - coreimport.RegisterCustomJSONProvider("grpc/json", func() core.Ammo { return &grpc.Ammo{} }) +func Import(fs afero.Fs) { + + register.Provider("grpc/json", func(conf grpcjson.Config) core.Provider { + return grpcjson.NewProvider(fs, conf) + }) register.Gun("grpc", grpc.NewGun, func() grpc.GunConfig { return grpc.GunConfig{ diff --git a/main.go b/main.go index 744067b8b..bcad8b157 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ func main() { coreimport.Import(fs) phttp.Import(fs) example.Import() - grpc.Import() + grpc.Import(fs) cli.Run() } From 58e60dd41774d372b473e47f201629e83d2586a2 Mon Sep 17 00:00:00 2001 From: ligreen Date: Thu, 17 Mar 2022 15:16:23 +0300 Subject: [PATCH 57/80] handel net codes errors ref:328c8cce97bf14a6eb35f7af32d222ba523952bc --- core/aggregator/netsample/sample.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index 90d790612..1271a6120 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -7,6 +7,7 @@ package netsample import ( "net" + "net/url" "os" "sync" "syscall" @@ -135,6 +136,8 @@ func getErrno(err error) int { err = typed.Err case *os.SyscallError: err = typed.Err + case *url.Error: + err = typed.Err case syscall.Errno: return int(typed) default: From e9de11fcdf264153a9a2042415b45f1f88888945 Mon Sep 17 00:00:00 2001 From: ligreen Date: Tue, 29 Mar 2022 20:06:25 +0300 Subject: [PATCH 58/80] new instance_step pandora schedule ref:5ed8b24031d8f5b73068adfa866355e214dda91b --- core/import/import.go | 1 + core/schedule/instance_step.go | 35 ++++++++++++++++++++++++++++ core/schedule/schedule_suite_test.go | 15 ++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 core/schedule/instance_step.go diff --git a/core/import/import.go b/core/import/import.go index cbf1a440c..10294ac21 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -88,6 +88,7 @@ func Import(fs afero.Fs) { register.Limiter("once", schedule.NewOnceConf) register.Limiter("unlimited", schedule.NewUnlimitedConf) register.Limiter("step", schedule.NewStepConf) + register.Limiter("instance_step", schedule.NewInstanceStepConf) register.Limiter(compositeScheduleKey, schedule.NewCompositeConf) config.AddTypeHook(sinkStringHook) diff --git a/core/schedule/instance_step.go b/core/schedule/instance_step.go new file mode 100644 index 000000000..9724854ef --- /dev/null +++ b/core/schedule/instance_step.go @@ -0,0 +1,35 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package schedule + +import ( + "time" + + "github.com/yandex/pandora/core" +) + +func NewInstanceStep(from, to int64, step int64, stepDuration time.Duration) core.Schedule { + var nexts []core.Schedule + nexts = append(nexts, NewOnce(from)) + + for i := from + step; i <= to; i += step { + nexts = append(nexts, NewConst(0, stepDuration)) + nexts = append(nexts, NewOnce(step)) + } + + return NewCompositeConf(CompositeConf{nexts}) +} + +type InstanceStepConfig struct { + From int64 `validate:"min=0"` + To int64 `validate:"min=0"` + Step int64 `validate:"min=1"` + StepDuration time.Duration `validate:"min-time=1ms"` +} + +func NewInstanceStepConf(conf InstanceStepConfig) core.Schedule { + return NewInstanceStep(conf.From, conf.To, conf.Step, conf.StepDuration) +} diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index b63469a7a..88821b523 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -207,6 +207,21 @@ var _ = Describe("step", func() { }) +var _ = Describe("instance_step", func() { + It("", func() { + conf := InstanceStepConfig{ + From: 1, + To: 3, + Step: 1, + StepDuration: 2 * time.Second, + } + testee := NewInstanceStepConf(conf) + Expect(testee.Left()).To(Equal(3)) + + }) + +}) + func BenchmarkLineSchedule(b *testing.B) { schedule := NewLine(0, float64(b.N), 2*time.Second) benchmarkScheduleNext(b, schedule) From 885293327e40988ca3bd697b167246da0e51e63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=93=D1=80=D0=B8=D0=B1?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 7 Apr 2022 17:56:36 +0500 Subject: [PATCH 59/80] Fix leak of first instance gun closing If gun has slow Close method, main function could exit before closing complete. --- core/engine/engine.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/engine/engine.go b/core/engine/engine.go index 502d18ba8..6a03b5ed8 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -382,8 +382,10 @@ func (p *instancePool) startInstances( } started++ go func() { - defer firstInstance.Close() - runRes <- instanceRunResult{0, firstInstance.Run(runCtx)} + runRes <- instanceRunResult{0, func() error { + defer firstInstance.Close() + return firstInstance.Run(runCtx) + }()} }() for ; waiter.Wait(); started++ { From 0c5381250a29eeeac448d9a771df4c64ede0a905 Mon Sep 17 00:00:00 2001 From: ival83 Date: Wed, 13 Apr 2022 19:51:33 +0300 Subject: [PATCH 60/80] test sync ref:959400776ec87baa2eb3b3105be1f18b9ee09c23 --- test-sync.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-sync.txt diff --git a/test-sync.txt b/test-sync.txt new file mode 100644 index 000000000..7c9415122 --- /dev/null +++ b/test-sync.txt @@ -0,0 +1 @@ +test-sync-with-arcadia From 4337898ccd51dc3f11ab7eb116356ad872c42813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=93=D1=80=D0=B8=D0=B1?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 23 Apr 2022 00:33:48 +0500 Subject: [PATCH 61/80] when provider run done it does not mean out of ammo; instance start should not be canceled --- core/engine/engine.go | 12 +++++++----- core/engine/engine_test.go | 15 +++++++++++++++ core/engine/instance.go | 4 +++- core/provider/num.go | 7 +++++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/core/engine/engine.go b/core/engine/engine.go index 6a03b5ed8..957b5c749 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -291,10 +291,6 @@ func (ah *runAwaitHandle) awaitRun() { if errutil.IsNotCtxError(ah.runCtx, err) { ah.onErrAwaited(errors.WithMessage(err, "provider failed")) } - if err == nil && !ah.isStartFinished() { - ah.log.Debug("Canceling instance start because out of ammo") - ah.instanceStartCancel() - } case err := <-ah.aggregatorErr: ah.aggregatorErr = nil ah.toWait-- @@ -316,7 +312,13 @@ func (ah *runAwaitHandle) awaitRun() { if ent := ah.log.Check(zap.DebugLevel, "Instance run awaited"); ent != nil { ent.Write(zap.Int("id", res.ID), zap.Int("awaited", ah.awaitedInstances), zap.Error(res.Err)) } - if errutil.IsNotCtxError(ah.runCtx, res.Err) { + + if res.Err == outOfAmmoErr { + if !ah.isStartFinished() { + ah.log.Debug("Canceling instance start because out of ammo") + ah.instanceStartCancel() + } + } else if errutil.IsNotCtxError(ah.runCtx, res.Err) { ah.onErrAwaited(errors.WithMessage(res.Err, fmt.Sprintf("instance %q run failed", res.ID))) } ah.checkAllInstancesAreFinished() diff --git a/core/engine/engine_test.go b/core/engine/engine_test.go index 187434156..062018a27 100644 --- a/core/engine/engine_test.go +++ b/core/engine/engine_test.go @@ -213,6 +213,21 @@ var _ = Describe("multiple instance", func() { Expect(pool.metrics.InstanceStart.Get()).To(BeNumerically("<=", 3)) }, 1) + It("when provider run done it does not mean out of ammo; instance start is not canceled", func() { + conf, _ := newTestPoolConf() + conf.Provider = provider.NewNumBuffered(3) + conf.NewRPSSchedule = func() (core.Schedule, error) { + return schedule.NewOnce(1), nil + } + conf.StartupSchedule = schedule.NewOnce(3) + pool := newPool(ginkgoutil.NewLogger(), newTestMetrics(), nil, conf) + ctx := context.Background() + + err := pool.Run(ctx) + Expect(err).NotTo(HaveOccurred()) + Expect(pool.metrics.InstanceStart.Get()).To(BeNumerically("==", 3)) + }, 1) + It("out of RPS - instance start is canceled", func() { conf, _ := newTestPoolConf() conf.NewRPSSchedule = func() (core.Schedule, error) { diff --git a/core/engine/instance.go b/core/engine/instance.go index 0fe81d261..42f8c882b 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -93,7 +93,7 @@ func (i *instance) shoot(ctx context.Context) (err error) { ammo, ok := i.provider.Acquire() if !ok { i.log.Debug("Out of ammo") - break + return outOfAmmoErr } if tag.Debug { i.log.Debug("Ammo acquired", zap.Any("ammo", ammo)) @@ -124,3 +124,5 @@ func (i *instance) Close() error { i.log.Debug("Gun closed") return err } + +var outOfAmmoErr = errors.New("Out of ammo") diff --git a/core/provider/num.go b/core/provider/num.go index 401ca41af..772153b76 100644 --- a/core/provider/num.go +++ b/core/provider/num.go @@ -20,6 +20,13 @@ func NewNum(limit int) core.Provider { } } +func NewNumBuffered(limit int) core.Provider { + return &num{ + limit: limit, + sink: make(chan core.Ammo, limit), + } +} + type NumConfig struct { Limit int } From 88dcaeaf9f208e502b5c1f944548f9b59d3afcd3 Mon Sep 17 00:00:00 2001 From: ligreen Date: Fri, 27 May 2022 20:17:34 +0300 Subject: [PATCH 62/80] PR from branch users/ligreen/pandora-conn-timeout fix sample report set custom error code ref:6785946111386fac35fef8dbd4847f19ed2714e8 --- core/aggregator/netsample/sample.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index 1271a6120..0dc1dc4fd 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -118,6 +118,10 @@ func (s *Sample) String() string { } func getErrno(err error) int { + // + if e, ok := err.(net.Error); ok && e.Timeout() { + return 110 // Handle client Timeout as if it connection timeout + } // stackerr.Error and etc. type hasUnderlying interface { Underlying() error From 2e432db6d83075b5487d7868ebe4d490bd112df4 Mon Sep 17 00:00:00 2001 From: ival83 Date: Fri, 15 Jul 2022 17:01:59 +0300 Subject: [PATCH 63/80] LOAD-1361 pandora 0.3.8 bind ref:3f2ebf24ea20c96c8e45d23ddf441f3cfc8f10d8 --- cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index f2659c30a..b20dc5554 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -25,7 +25,7 @@ import ( "github.com/yandex/pandora/lib/zaputil" ) -const Version = "0.3.5" +const Version = "0.3.8" const defaultConfigFile = "load" const stdinConfigSelector = "-" From e908692bb9c25f41f23c4f6764da764eff8cf5b2 Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Fri, 19 Aug 2022 18:08:05 +0300 Subject: [PATCH 64/80] Apply ya tool yoimport --- acceptance_tests/acceptance_suite_test.go | 3 +-- acceptance_tests/http_test.go | 4 +--- cli/cli.go | 5 ++--- cli/expvar.go | 3 +-- components/example/example.go | 3 +-- components/grpc/ammo/grpcjson/provider.go | 8 +++----- components/grpc/ammo/provider.go | 3 +-- components/grpc/core.go | 14 ++++++-------- .../ammo/simple/jsonline/jsonline_suite_test.go | 1 - components/phttp/ammo/simple/jsonline/provider.go | 3 +-- components/phttp/ammo/simple/provider.go | 3 +-- components/phttp/ammo/simple/raw/provider.go | 3 +-- components/phttp/ammo/simple/raw/provider_test.go | 1 - components/phttp/ammo/simple/uri/decoder.go | 1 - components/phttp/ammo/simple/uri/decoder_test.go | 1 - components/phttp/ammo/simple/uri/provider.go | 3 +-- components/phttp/ammo/simple/uri/provider_test.go | 3 +-- components/phttp/ammo/simple/uripost/provider.go | 3 +-- components/phttp/base.go | 3 +-- components/phttp/base_test.go | 3 +-- components/phttp/client.go | 5 ++--- components/phttp/connect_test.go | 3 +-- components/phttp/http_test.go | 7 +++---- components/phttp/import/import.go | 3 +-- components/phttp/import/import_suite_test.go | 1 - core/aggregator/encoder.go | 1 - core/aggregator/encoder_test.go | 3 +-- core/aggregator/jsonlines.go | 3 +-- core/aggregator/jsonlines_test.go | 3 +-- core/aggregator/log.go | 3 +-- core/aggregator/mocks/sample_encode_closer.go | 1 - core/aggregator/netsample/phout.go | 1 - core/aggregator/netsample/phout_test.go | 1 - core/aggregator/netsample/sample_test.go | 4 ++-- core/aggregator/reporter.go | 5 ++--- core/aggregator/reporter_test.go | 5 ++--- core/config/hooks.go | 3 +-- core/coretest/sink.go | 1 - core/coretest/source.go | 1 - core/coreutil/schedule_test.go | 1 - core/coreutil/waiter_test.go | 1 - core/datasink/file.go | 1 - core/datasink/file_test.go | 1 - core/datasource/file.go | 1 - core/engine/engine.go | 6 ++---- core/engine/engine_test.go | 3 +-- core/engine/instance.go | 6 ++---- core/engine/instance_test.go | 1 - core/import/import.go | 3 +-- core/import/import_suite_test.go | 3 +-- core/plugin/pluginconfig/hooks.go | 3 +-- core/plugin/ptest_test.go | 1 - core/provider/chunk_decoder.go | 1 - core/provider/decoder.go | 3 +-- core/provider/json.go | 1 - core/provider/json_test.go | 1 - core/provider/num_test.go | 1 - core/schedule/composite_test.go | 1 - core/schedule/do_at.go | 3 +-- core/schedule/schedule_suite_test.go | 1 - core/schedule/start_sync.go | 4 ++-- examples/custom_pandora/custom_main.go | 3 +-- lib/netutil/netutil_suite_test.go | 1 - lib/tag/debug.go | 1 + lib/tag/race.go | 1 + main.go | 1 - 66 files changed, 57 insertions(+), 122 deletions(-) diff --git a/acceptance_tests/acceptance_suite_test.go b/acceptance_tests/acceptance_suite_test.go index 6b14bb506..6f4ac8764 100644 --- a/acceptance_tests/acceptance_suite_test.go +++ b/acceptance_tests/acceptance_suite_test.go @@ -14,10 +14,9 @@ import ( . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" "github.com/onsi/gomega/gexec" - "go.uber.org/zap" - "github.com/yandex/pandora/lib/ginkgoutil" "github.com/yandex/pandora/lib/tag" + "go.uber.org/zap" ) var pandoraBin string diff --git a/acceptance_tests/http_test.go b/acceptance_tests/http_test.go index ab71fd37d..fea9dc757 100644 --- a/acceptance_tests/http_test.go +++ b/acceptance_tests/http_test.go @@ -2,14 +2,12 @@ package acceptance import ( "net/http" - - "golang.org/x/net/http2" - "net/http/httptest" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "go.uber.org/atomic" + "golang.org/x/net/http2" ) var _ = Describe("http", func() { diff --git a/cli/cli.go b/cli/cli.go index b20dc5554..d6ee6be85 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -17,12 +17,11 @@ import ( "time" "github.com/spf13/viper" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/engine" "github.com/yandex/pandora/lib/zaputil" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" ) const Version = "0.3.8" diff --git a/cli/expvar.go b/cli/expvar.go index ed8f436d9..054ffe9f1 100644 --- a/cli/expvar.go +++ b/cli/expvar.go @@ -3,10 +3,9 @@ package cli import ( "time" - "go.uber.org/zap" - "github.com/yandex/pandora/core/engine" "github.com/yandex/pandora/lib/monitoring" + "go.uber.org/zap" ) func newEngineMetrics() engine.Metrics { diff --git a/components/example/example.go b/components/example/example.go index f6dab2222..c5515f787 100644 --- a/components/example/example.go +++ b/components/example/example.go @@ -10,10 +10,9 @@ import ( "fmt" "sync" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" + "go.uber.org/zap" ) type Ammo struct { diff --git a/components/grpc/ammo/grpcjson/provider.go b/components/grpc/ammo/grpcjson/provider.go index 79c3e5dcd..eaff8e02d 100644 --- a/components/grpc/ammo/grpcjson/provider.go +++ b/components/grpc/ammo/grpcjson/provider.go @@ -9,13 +9,11 @@ import ( "bufio" "context" - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/yandex/pandora/components/grpc/ammo" - jsoniter "github.com/json-iterator/go" + "github.com/pkg/errors" "github.com/spf13/afero" + "github.com/yandex/pandora/components/grpc/ammo" + "go.uber.org/zap" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/grpc/ammo/provider.go b/components/grpc/ammo/provider.go index e390b1947..120a1258c 100644 --- a/components/grpc/ammo/provider.go +++ b/components/grpc/ammo/provider.go @@ -11,9 +11,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "go.uber.org/atomic" ) func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { diff --git a/components/grpc/core.go b/components/grpc/core.go index 5fa5a9340..c17c2aa33 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -8,22 +8,20 @@ import ( "log" "time" + "github.com/jhump/protoreflect/desc" + "github.com/jhump/protoreflect/dynamic" + "github.com/jhump/protoreflect/dynamic/grpcdynamic" "github.com/jhump/protoreflect/grpcreflect" - "github.com/yandex/pandora/core/warmup" - "google.golang.org/grpc/credentials" - reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" - "github.com/yandex/pandora/components/grpc/ammo" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" - - "github.com/jhump/protoreflect/desc" - "github.com/jhump/protoreflect/dynamic" - "github.com/jhump/protoreflect/dynamic/grpcdynamic" + "github.com/yandex/pandora/core/warmup" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" + reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" "google.golang.org/grpc/status" ) diff --git a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go index d149cd1b7..bcdc60ec4 100644 --- a/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go +++ b/components/phttp/ammo/simple/jsonline/jsonline_suite_test.go @@ -17,7 +17,6 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" "github.com/yandex/pandora/lib/ginkgoutil" diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index 0a999a8b5..dd59ef317 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -12,10 +12,9 @@ import ( "strings" "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" + "go.uber.org/zap" ) func NewProvider(fs afero.Fs, conf Config) *Provider { diff --git a/components/phttp/ammo/simple/provider.go b/components/phttp/ammo/simple/provider.go index 117fafa4f..70ebda16f 100644 --- a/components/phttp/ammo/simple/provider.go +++ b/components/phttp/ammo/simple/provider.go @@ -11,9 +11,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "go.uber.org/atomic" ) func NewProvider(fs afero.Fs, fileName string, start func(ctx context.Context, file afero.File) error) Provider { diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index 428f42a95..230c96d59 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -7,9 +7,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "go.uber.org/zap" ) /* diff --git a/components/phttp/ammo/simple/raw/provider_test.go b/components/phttp/ammo/simple/raw/provider_test.go index 547068f39..d73931d38 100644 --- a/components/phttp/ammo/simple/raw/provider_test.go +++ b/components/phttp/ammo/simple/raw/provider_test.go @@ -13,7 +13,6 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" "github.com/spf13/afero" - "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" ) diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index 4a66b2a2e..d72621752 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -13,7 +13,6 @@ import ( "sync" "github.com/pkg/errors" - "github.com/yandex/pandora/components/phttp/ammo/simple" ) diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index 4a35ebcdd..19ea19f02 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -9,7 +9,6 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" ) diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index 219e40f5d..aead695bd 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -12,9 +12,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "go.uber.org/zap" ) type Config struct { diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index a0d05411b..b1ceb12a6 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -9,9 +9,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "github.com/spf13/afero" - "github.com/pkg/errors" + "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" "github.com/yandex/pandora/core" ) diff --git a/components/phttp/ammo/simple/uripost/provider.go b/components/phttp/ammo/simple/uripost/provider.go index 6be768a1a..9f6f16a6d 100644 --- a/components/phttp/ammo/simple/uripost/provider.go +++ b/components/phttp/ammo/simple/uripost/provider.go @@ -10,9 +10,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" - "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp/ammo/simple" + "go.uber.org/zap" ) func filePosition(file afero.File) (position int64) { diff --git a/components/phttp/base.go b/components/phttp/base.go index 023443fb9..985985762 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -16,10 +16,9 @@ import ( "net/url" "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" + "go.uber.org/zap" ) const ( diff --git a/components/phttp/base_test.go b/components/phttp/base_test.go index d8aa9eb69..8834f9c5b 100644 --- a/components/phttp/base_test.go +++ b/components/phttp/base_test.go @@ -18,13 +18,12 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - "go.uber.org/zap" - ammomock "github.com/yandex/pandora/components/phttp/mocks" "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator/netsample" "github.com/yandex/pandora/core/coretest" "github.com/yandex/pandora/lib/ginkgoutil" + "go.uber.org/zap" ) func testDeps() core.GunDeps { diff --git a/components/phttp/client.go b/components/phttp/client.go index d8246d1e1..4af97806e 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -13,11 +13,10 @@ import ( "time" "github.com/pkg/errors" - "go.uber.org/zap" - "golang.org/x/net/http2" - "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" + "go.uber.org/zap" + "golang.org/x/net/http2" ) //go:generate mockery -name=Client -case=underscore -inpkg -testonly diff --git a/components/phttp/connect_test.go b/components/phttp/connect_test.go index 0a0ff3c13..cf8abc521 100644 --- a/components/phttp/connect_test.go +++ b/components/phttp/connect_test.go @@ -15,9 +15,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "go.uber.org/zap" - "github.com/yandex/pandora/core/aggregator/netsample" + "go.uber.org/zap" ) var _ = Describe("connect", func() { diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index 7a378c979..602585c26 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -14,13 +14,12 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - "go.uber.org/atomic" - "go.uber.org/zap" - "golang.org/x/net/http2" - ammomock "github.com/yandex/pandora/components/phttp/mocks" "github.com/yandex/pandora/core/aggregator/netsample" "github.com/yandex/pandora/core/config" + "go.uber.org/atomic" + "go.uber.org/zap" + "golang.org/x/net/http2" ) var _ = Describe("BaseGun", func() { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index 9d366b612..f4888d9e8 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -9,8 +9,6 @@ import ( "net" "github.com/spf13/afero" - "go.uber.org/zap" - "github.com/yandex/pandora/components/phttp" "github.com/yandex/pandora/components/phttp/ammo/simple/jsonline" "github.com/yandex/pandora/components/phttp/ammo/simple/raw" @@ -20,6 +18,7 @@ import ( "github.com/yandex/pandora/core/register" "github.com/yandex/pandora/lib/answlog" "github.com/yandex/pandora/lib/netutil" + "go.uber.org/zap" ) func Import(fs afero.Fs) { diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 6b4f5bc49..98b5e47cc 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -8,7 +8,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/spf13/afero" - . "github.com/yandex/pandora/components/phttp" "github.com/yandex/pandora/lib/ginkgoutil" ) diff --git a/core/aggregator/encoder.go b/core/aggregator/encoder.go index 8faf680e8..a13ae9df4 100644 --- a/core/aggregator/encoder.go +++ b/core/aggregator/encoder.go @@ -11,7 +11,6 @@ import ( "time" "github.com/pkg/errors" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coreutil" "github.com/yandex/pandora/lib/errutil" diff --git a/core/aggregator/encoder_test.go b/core/aggregator/encoder_test.go index ad8a3aadf..302f2df6a 100644 --- a/core/aggregator/encoder_test.go +++ b/core/aggregator/encoder_test.go @@ -17,13 +17,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.uber.org/zap" - "github.com/yandex/pandora/core" aggregatemock "github.com/yandex/pandora/core/aggregator/mocks" coremock "github.com/yandex/pandora/core/mocks" iomock "github.com/yandex/pandora/lib/ioutil2/mocks" "github.com/yandex/pandora/lib/testutil" + "go.uber.org/zap" ) type EncoderAggregatorTester struct { diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 065a721cd..2d19b9067 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -10,11 +10,10 @@ import ( "io" jsoniter "github.com/json-iterator/go" - "github.com/yandex/pandora/lib/ioutil2" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/lib/ioutil2" ) type JSONLineAggregatorConfig struct { diff --git a/core/aggregator/jsonlines_test.go b/core/aggregator/jsonlines_test.go index 3c2549f5d..0ca60fbf9 100644 --- a/core/aggregator/jsonlines_test.go +++ b/core/aggregator/jsonlines_test.go @@ -12,10 +12,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/datasink" + "go.uber.org/zap" ) type jsonTestData struct { diff --git a/core/aggregator/log.go b/core/aggregator/log.go index cf40e5ca3..681dca3ee 100644 --- a/core/aggregator/log.go +++ b/core/aggregator/log.go @@ -8,9 +8,8 @@ package aggregator import ( "context" - "go.uber.org/zap" - "github.com/yandex/pandora/core" + "go.uber.org/zap" ) func NewLog() core.Aggregator { diff --git a/core/aggregator/mocks/sample_encode_closer.go b/core/aggregator/mocks/sample_encode_closer.go index 5e152cc15..0e409af97 100644 --- a/core/aggregator/mocks/sample_encode_closer.go +++ b/core/aggregator/mocks/sample_encode_closer.go @@ -3,7 +3,6 @@ package aggregatemock import ( mock "github.com/stretchr/testify/mock" - core "github.com/yandex/pandora/core" ) diff --git a/core/aggregator/netsample/phout.go b/core/aggregator/netsample/phout.go index 7a770982c..a72733cf6 100644 --- a/core/aggregator/netsample/phout.go +++ b/core/aggregator/netsample/phout.go @@ -11,7 +11,6 @@ import ( "github.com/c2h5oh/datasize" "github.com/pkg/errors" "github.com/spf13/afero" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coreutil" ) diff --git a/core/aggregator/netsample/phout_test.go b/core/aggregator/netsample/phout_test.go index 95e734758..33f6a7bea 100644 --- a/core/aggregator/netsample/phout_test.go +++ b/core/aggregator/netsample/phout_test.go @@ -8,7 +8,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/spf13/afero" - "github.com/yandex/pandora/core" ) diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index b084a510b..d8f302c8e 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -79,8 +79,8 @@ func TestCustomSets(t *testing.T) { tag, int(userDuration.Nanoseconds()/1000), // keyRTTMicro int(latency.Nanoseconds()/1000), // keyLatencyMicro - reqBytes, // keyRequestBytes - respBytes, // keyResponseBytes + reqBytes, // keyRequestBytes + respBytes, // keyResponseBytes 110, 0, ) diff --git a/core/aggregator/reporter.go b/core/aggregator/reporter.go index 5a3cfed1b..c7809e897 100644 --- a/core/aggregator/reporter.go +++ b/core/aggregator/reporter.go @@ -8,11 +8,10 @@ package aggregator import ( "fmt" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coreutil" + "go.uber.org/atomic" + "go.uber.org/zap" ) type ReporterConfig struct { diff --git a/core/aggregator/reporter_test.go b/core/aggregator/reporter_test.go index 880ee14da..a1f950fec 100644 --- a/core/aggregator/reporter_test.go +++ b/core/aggregator/reporter_test.go @@ -10,11 +10,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/zap" - "go.uber.org/zap/zaptest/observer" - coremock "github.com/yandex/pandora/core/mocks" "github.com/yandex/pandora/lib/testutil" + "go.uber.org/zap" + "go.uber.org/zap/zaptest/observer" ) func TestReporter_DroppedErr(t *testing.T) { diff --git a/core/config/hooks.go b/core/config/hooks.go index 2b4df157a..7c4c360c2 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -17,9 +17,8 @@ import ( "github.com/c2h5oh/datasize" "github.com/facebookgo/stack" "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/yandex/pandora/lib/tag" + "go.uber.org/zap" ) var InvalidURLError = errors.New("string is not valid URL") diff --git a/core/coretest/sink.go b/core/coretest/sink.go index d54c33167..191c44111 100644 --- a/core/coretest/sink.go +++ b/core/coretest/sink.go @@ -14,7 +14,6 @@ import ( "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" ) diff --git a/core/coretest/source.go b/core/coretest/source.go index ae5ac8f4c..9aa94bdb7 100644 --- a/core/coretest/source.go +++ b/core/coretest/source.go @@ -14,7 +14,6 @@ import ( "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/lib/testutil" ) diff --git a/core/coreutil/schedule_test.go b/core/coreutil/schedule_test.go index 93d84f3c5..a4a3613b1 100644 --- a/core/coreutil/schedule_test.go +++ b/core/coreutil/schedule_test.go @@ -10,7 +10,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/schedule" ) diff --git a/core/coreutil/waiter_test.go b/core/coreutil/waiter_test.go index 4cb0309e8..d5629ecc2 100644 --- a/core/coreutil/waiter_test.go +++ b/core/coreutil/waiter_test.go @@ -11,7 +11,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core/schedule" ) diff --git a/core/datasink/file.go b/core/datasink/file.go index 48189f707..610cff137 100644 --- a/core/datasink/file.go +++ b/core/datasink/file.go @@ -10,7 +10,6 @@ import ( "os" "github.com/spf13/afero" - "github.com/yandex/pandora/core" ) diff --git a/core/datasink/file_test.go b/core/datasink/file_test.go index 018ba9720..df6ef0dd9 100644 --- a/core/datasink/file_test.go +++ b/core/datasink/file_test.go @@ -10,7 +10,6 @@ import ( "testing" "github.com/spf13/afero" - "github.com/yandex/pandora/core/coretest" ) diff --git a/core/datasource/file.go b/core/datasource/file.go index 0ebb346ef..f5a885521 100644 --- a/core/datasource/file.go +++ b/core/datasource/file.go @@ -10,7 +10,6 @@ import ( "os" "github.com/spf13/afero" - "github.com/yandex/pandora/core" ) diff --git a/core/engine/engine.go b/core/engine/engine.go index 957b5c749..62557538e 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -10,15 +10,13 @@ import ( "fmt" "sync" - "github.com/yandex/pandora/core/warmup" - "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/core/warmup" "github.com/yandex/pandora/lib/errutil" "github.com/yandex/pandora/lib/monitoring" + "go.uber.org/zap" ) type Config struct { diff --git a/core/engine/engine_test.go b/core/engine/engine_test.go index 062018a27..5729b7456 100644 --- a/core/engine/engine_test.go +++ b/core/engine/engine_test.go @@ -9,8 +9,6 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/errors" "github.com/stretchr/testify/mock" - "go.uber.org/atomic" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator" "github.com/yandex/pandora/core/config" @@ -18,6 +16,7 @@ import ( "github.com/yandex/pandora/core/provider" "github.com/yandex/pandora/core/schedule" "github.com/yandex/pandora/lib/ginkgoutil" + "go.uber.org/atomic" ) var _ = Describe("config validation", func() { diff --git a/core/engine/instance.go b/core/engine/instance.go index 42f8c882b..ffafe08b0 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -10,14 +10,12 @@ import ( "fmt" "io" - "github.com/yandex/pandora/core/warmup" - "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coreutil" + "github.com/yandex/pandora/core/warmup" "github.com/yandex/pandora/lib/tag" + "go.uber.org/zap" ) type instance struct { diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index e64d8fbf3..cf7165d3d 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -8,7 +8,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" - "github.com/yandex/pandora/core" coremock "github.com/yandex/pandora/core/mocks" "github.com/yandex/pandora/core/schedule" diff --git a/core/import/import.go b/core/import/import.go index 10294ac21..5caaa6f36 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -9,8 +9,6 @@ import ( "reflect" "github.com/spf13/afero" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/aggregator" "github.com/yandex/pandora/core/aggregator/netsample" @@ -23,6 +21,7 @@ import ( "github.com/yandex/pandora/core/register" "github.com/yandex/pandora/core/schedule" "github.com/yandex/pandora/lib/tag" + "go.uber.org/zap" ) const ( diff --git a/core/import/import_suite_test.go b/core/import/import_suite_test.go index 2d296839c..a83785439 100644 --- a/core/import/import_suite_test.go +++ b/core/import/import_suite_test.go @@ -10,14 +10,13 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/afero" "github.com/stretchr/testify/require" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/coretest" "github.com/yandex/pandora/core/plugin" "github.com/yandex/pandora/lib/ginkgoutil" "github.com/yandex/pandora/lib/testutil" + "go.uber.org/zap" ) func TestImport(t *testing.T) { diff --git a/core/plugin/pluginconfig/hooks.go b/core/plugin/pluginconfig/hooks.go index fe669bb49..4c3e44106 100644 --- a/core/plugin/pluginconfig/hooks.go +++ b/core/plugin/pluginconfig/hooks.go @@ -14,11 +14,10 @@ import ( "strings" "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/plugin" "github.com/yandex/pandora/lib/tag" + "go.uber.org/zap" ) func AddHooks() { diff --git a/core/plugin/ptest_test.go b/core/plugin/ptest_test.go index cfae16f84..69850d285 100644 --- a/core/plugin/ptest_test.go +++ b/core/plugin/ptest_test.go @@ -10,7 +10,6 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/yandex/pandora/core/config" ) diff --git a/core/provider/chunk_decoder.go b/core/provider/chunk_decoder.go index 0904b4497..2fd851ca7 100644 --- a/core/provider/chunk_decoder.go +++ b/core/provider/chunk_decoder.go @@ -10,7 +10,6 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/yandex/pandora/core" ) diff --git a/core/provider/decoder.go b/core/provider/decoder.go index 99beede72..01a923c38 100644 --- a/core/provider/decoder.go +++ b/core/provider/decoder.go @@ -11,11 +11,10 @@ import ( "io" "github.com/pkg/errors" - "go.uber.org/zap" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/lib/errutil" "github.com/yandex/pandora/lib/ioutil2" + "go.uber.org/zap" ) type NewAmmoDecoder func(deps core.ProviderDeps, source io.Reader) (AmmoDecoder, error) diff --git a/core/provider/json.go b/core/provider/json.go index 586935c58..820a991f0 100644 --- a/core/provider/json.go +++ b/core/provider/json.go @@ -9,7 +9,6 @@ import ( "io" jsoniter "github.com/json-iterator/go" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coreutil" "github.com/yandex/pandora/lib/ioutil2" diff --git a/core/provider/json_test.go b/core/provider/json_test.go index 1bb44f222..1690d0086 100644 --- a/core/provider/json_test.go +++ b/core/provider/json_test.go @@ -13,7 +13,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/datasource" ) diff --git a/core/provider/num_test.go b/core/provider/num_test.go index a7722cb67..caf7242f6 100644 --- a/core/provider/num_test.go +++ b/core/provider/num_test.go @@ -5,7 +5,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" ) diff --git a/core/schedule/composite_test.go b/core/schedule/composite_test.go index e4e0dc86c..67c053837 100644 --- a/core/schedule/composite_test.go +++ b/core/schedule/composite_test.go @@ -11,7 +11,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coretest" "go.uber.org/atomic" diff --git a/core/schedule/do_at.go b/core/schedule/do_at.go index e33b8ae23..dddcaf696 100644 --- a/core/schedule/do_at.go +++ b/core/schedule/do_at.go @@ -8,9 +8,8 @@ package schedule import ( "time" - "go.uber.org/atomic" - "github.com/yandex/pandora/core" + "go.uber.org/atomic" ) // DoAt returns when i'th operation should be performed, assuming that schedule diff --git a/core/schedule/schedule_suite_test.go b/core/schedule/schedule_suite_test.go index 88821b523..aea7fe558 100644 --- a/core/schedule/schedule_suite_test.go +++ b/core/schedule/schedule_suite_test.go @@ -7,7 +7,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/yandex/pandora/core" "github.com/yandex/pandora/core/coretest" "github.com/yandex/pandora/lib/ginkgoutil" diff --git a/core/schedule/start_sync.go b/core/schedule/start_sync.go index 4b2b5215f..43f35682b 100644 --- a/core/schedule/start_sync.go +++ b/core/schedule/start_sync.go @@ -6,9 +6,9 @@ package schedule import ( - "go.uber.org/atomic" - "sync" + + "go.uber.org/atomic" ) // StartSync is util to make schedule start goroutine safe. diff --git a/examples/custom_pandora/custom_main.go b/examples/custom_pandora/custom_main.go index b5304501d..c25569f85 100644 --- a/examples/custom_pandora/custom_main.go +++ b/examples/custom_pandora/custom_main.go @@ -10,13 +10,12 @@ import ( "time" "github.com/spf13/afero" - "go.uber.org/zap" - "github.com/yandex/pandora/cli" phttp "github.com/yandex/pandora/components/phttp/import" "github.com/yandex/pandora/core" coreimport "github.com/yandex/pandora/core/import" "github.com/yandex/pandora/core/register" + "go.uber.org/zap" ) type Ammo struct { diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 8103e13d0..8fe11de35 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -8,7 +8,6 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" - "github.com/pkg/errors" "github.com/yandex/pandora/lib/ginkgoutil" netmock "github.com/yandex/pandora/lib/netutil/mocks" diff --git a/lib/tag/debug.go b/lib/tag/debug.go index aaa7c857c..ee36c25b0 100644 --- a/lib/tag/debug.go +++ b/lib/tag/debug.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // Author: Vladimir Skipor +//go:build debug // +build debug package tag diff --git a/lib/tag/race.go b/lib/tag/race.go index a19547375..0cdaf0afb 100644 --- a/lib/tag/race.go +++ b/lib/tag/race.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // Author: Vladimir Skipor +//go:build race // +build race package tag diff --git a/main.go b/main.go index bcad8b157..dfd8cba40 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ package main import ( "github.com/spf13/afero" - "github.com/yandex/pandora/cli" example "github.com/yandex/pandora/components/example/import" grpc "github.com/yandex/pandora/components/grpc/import" From 89d8339d804a865a41f40e8f37033208dc2b86b2 Mon Sep 17 00:00:00 2001 From: ichigo Date: Wed, 7 Sep 2022 12:13:46 +0300 Subject: [PATCH 65/80] fix host header add decorator --- components/phttp/ammo/simple/raw/decoder.go | 26 --------- .../ammo/simple/raw/decoder_bench_test.go | 16 +++--- .../phttp/ammo/simple/raw/decoder_test.go | 29 ---------- components/phttp/ammo/simple/raw/provider.go | 13 +---- components/phttp/ammo/simple/request.go | 56 +++++++++++++++++++ components/phttp/ammo/simple/uri/decoder.go | 40 ++----------- .../phttp/ammo/simple/uri/decoder_test.go | 14 ----- components/phttp/ammo/simple/uri/provider.go | 4 +- .../phttp/ammo/simple/uri/provider_test.go | 1 - .../phttp/ammo/simple/uripost/decoder.go | 26 --------- .../phttp/ammo/simple/uripost/provider.go | 16 ++---- components/phttp/client.go | 8 +++ components/phttp/http.go | 31 +++++----- components/phttp/http_test.go | 21 +++---- components/phttp/import/import.go | 22 ++++---- components/phttp/import/import_suite_test.go | 6 +- docs/advanced.rst | 4 +- 17 files changed, 130 insertions(+), 203 deletions(-) create mode 100644 components/phttp/ammo/simple/request.go diff --git a/components/phttp/ammo/simple/raw/decoder.go b/components/phttp/ammo/simple/raw/decoder.go index b6b7e63e5..e34481d68 100644 --- a/components/phttp/ammo/simple/raw/decoder.go +++ b/components/phttp/ammo/simple/raw/decoder.go @@ -6,8 +6,6 @@ import ( "net/http" "strconv" "strings" - - "github.com/pkg/errors" ) type Header struct { @@ -29,30 +27,6 @@ func decodeRequest(reqString []byte) (req *http.Request, err error) { if err != nil { return } - if req.Host != "" { - req.URL.Host = req.Host - } req.RequestURI = "" return } - -func decodeHTTPConfigHeaders(headers []string) (configHTTPHeaders []Header, err error) { - for _, header := range headers { - line := []byte(header) - if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { - return nil, errors.New("header line should be like '[key: value]") - } - line = line[1 : len(line)-1] - colonIdx := bytes.IndexByte(line, ':') - if colonIdx < 0 { - return nil, errors.New("missing colon") - } - configHTTPHeaders = append( - configHTTPHeaders, - Header{ - string(bytes.TrimSpace(line[:colonIdx])), - string(bytes.TrimSpace(line[colonIdx+1:])), - }) - } - return -} diff --git a/components/phttp/ammo/simple/raw/decoder_bench_test.go b/components/phttp/ammo/simple/raw/decoder_bench_test.go index 6b6745572..adf049f4d 100644 --- a/components/phttp/ammo/simple/raw/decoder_bench_test.go +++ b/components/phttp/ammo/simple/raw/decoder_bench_test.go @@ -1,6 +1,10 @@ package raw -import "testing" +import ( + "testing" + + "github.com/yandex/pandora/components/phttp/ammo/simple" +) var ( benchTestConfigHeaders = []string{ @@ -27,16 +31,10 @@ func BenchmarkRawDecoder(b *testing.B) { func BenchmarkRawDecoderWithHeaders(b *testing.B) { b.StopTimer() - decodedHTTPConfigHeaders, _ := decodeHTTPConfigHeaders(benchTestConfigHeaders) + decodedHTTPConfigHeaders, _ := simple.DecodeHTTPConfigHeaders(benchTestConfigHeaders) b.StartTimer() for i := 0; i < b.N; i++ { req, _ := decodeRequest([]byte(benchTestRequest)) - for _, header := range decodedHTTPConfigHeaders { - if header.key == "Host" { - req.URL.Host = header.value - } else { - req.Header.Set(header.key, header.value) - } - } + simple.UpdateRequestWithHeaders(req, decodedHTTPConfigHeaders) } } diff --git a/components/phttp/ammo/simple/raw/decoder_test.go b/components/phttp/ammo/simple/raw/decoder_test.go index 5f8fb7673..696522f20 100644 --- a/components/phttp/ammo/simple/raw/decoder_test.go +++ b/components/phttp/ammo/simple/raw/decoder_test.go @@ -83,34 +83,5 @@ var _ = Describe("Decoder", func() { req, err := decodeRequest([]byte(raw)) Expect(err).To(BeNil()) Expect(req.Host).To(Equal("hostname.tld")) - Expect(req.URL.Host).To(Equal("hostname.tld")) - }) - It("should replace header Host from config", func() { - const host = "hostname.tld" - const newhost = "newhostname.tld" - - raw := "GET / HTTP/1.1\r\n" + - "Host: " + host + "\r\n" + - "Content-Length: 0\r\n" + - "\r\n" - configHeaders := []string{ - "[Host: " + newhost + "]", - "[SomeTestKey: sometestvalue]", - } - req, err := decodeRequest([]byte(raw)) - Expect(err).To(BeNil()) - Expect(req.Host).To(Equal(host)) - Expect(req.URL.Host).To(Equal(host)) - decodedConfigHeaders, _ := decodeHTTPConfigHeaders(configHeaders) - for _, header := range decodedConfigHeaders { - // special behavior for `Host` header - if header.key == "Host" { - req.URL.Host = header.value - } else { - req.Header.Set(header.key, header.value) - } - } - Expect(req.URL.Host).To(Equal(newhost)) - Expect(req.Header.Get("SomeTestKey")).To(Equal("sometestvalue")) }) }) diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index 230c96d59..45391dff4 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -75,7 +75,7 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { var passNum int var ammoNum int // parse and prepare Headers from config - decodedConfigHeaders, err := decodeHTTPConfigHeaders(p.Config.Headers) + decodedConfigHeaders, err := simple.DecodeHTTPConfigHeaders(p.Config.Headers) if err != nil { return err } @@ -109,15 +109,8 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { return errors.Wrapf(err, "failed to decode ammo at position: %v; data: %q", filePosition(ammoFile), buff) } - // redefine request Headers from config - for _, header := range decodedConfigHeaders { - // special behavior for `Host` header - if header.key == "Host" { - req.URL.Host = header.value - } else { - req.Header.Set(header.key, header.value) - } - } + // add new Headers to request from config + simple.UpdateRequestWithHeaders(req, decodedConfigHeaders) sh := p.Pool.Get().(*simple.Ammo) sh.Reset(req, tag) diff --git a/components/phttp/ammo/simple/request.go b/components/phttp/ammo/simple/request.go new file mode 100644 index 000000000..08e2f1f90 --- /dev/null +++ b/components/phttp/ammo/simple/request.go @@ -0,0 +1,56 @@ +// Copyright (c) 2017 Yandex LLC. All rights reserved. +// Use of this source code is governed by a MPL 2.0 +// license that can be found in the LICENSE file. +// Author: Vladimir Skipor + +package simple + +import ( + "bytes" + "net/http" + + "github.com/pkg/errors" +) + +type Header struct { + key string + value string +} + +func DecodeHTTPConfigHeaders(headers []string) (configHTTPHeaders []Header, err error) { + for _, header := range headers { + line := []byte(header) + if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { + return nil, errors.New("header line should be like '[key: value]") + } + line = line[1 : len(line)-1] + colonIdx := bytes.IndexByte(line, ':') + if colonIdx < 0 { + return nil, errors.New("missing colon") + } + configHTTPHeaders = append( + configHTTPHeaders, + Header{ + string(bytes.TrimSpace(line[:colonIdx])), + string(bytes.TrimSpace(line[colonIdx+1:])), + }) + } + return +} + +func UpdateRequestWithHeaders(req *http.Request, headers []Header) { + origHeaders := req.Header.Clone() + for _, header := range headers { + if origHeaders.Get(header.key) != "" { + continue + } + // special behavior for `Host` header + if header.key == "Host" { + if req.Host == "" { + req.Host = header.value + } + } else { + req.Header.Add(header.key, header.value) + } + } +} diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index d72621752..b38aaf0c2 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -23,12 +23,7 @@ type decoder struct { ammoNum int header http.Header - configHeaders []ConfigHeader -} - -type ConfigHeader struct { - key string - value string + configHeaders []simple.Header } func newDecoder(ctx context.Context, sink chan<- *simple.Ammo, pool *sync.Pool) *decoder { @@ -69,20 +64,13 @@ func (d *decoder) decodeURI(line []byte) error { // http.Request.Write sends Host header based on req.URL.Host if k == "Host" { req.Host = v[0] - req.URL.Host = v[0] } else { req.Header[k] = v } } - // redefine request Headers from config - for _, configHeader := range d.configHeaders { - if configHeader.key == "Host" { - req.Host = configHeader.value - req.URL.Host = configHeader.value - } else { - req.Header.Set(configHeader.key, configHeader.value) - } - } + + // add new Headers to request from config + simple.UpdateRequestWithHeaders(req, d.configHeaders) sh := d.pool.Get().(*simple.Ammo) sh.Reset(req, tag) @@ -118,23 +106,3 @@ func (d *decoder) ResetHeader() { delete(d.header, k) } } - -func decodeHTTPConfigHeaders(headers []string) (configHTTPHeaders []ConfigHeader, err error) { - for _, header := range headers { - line := []byte(header) - if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { - return nil, errors.New("header line should be like '[key: value]") - } - line = line[1 : len(line)-1] - colonIdx := bytes.IndexByte(line, ':') - if colonIdx < 0 { - return nil, errors.New("missing colon") - } - preparedHeader := ConfigHeader{ - string(bytes.TrimSpace(line[:colonIdx])), - string(bytes.TrimSpace(line[colonIdx+1:])), - } - configHTTPHeaders = append(configHTTPHeaders, preparedHeader) - } - return -} diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index 19ea19f02..3f7e0354c 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -68,7 +68,6 @@ var _ = Describe("Decoder", func() { req, sample := sh.Request() Expect(*req.URL).To(MatchFields(IgnoreExtras, Fields{ "Path": Equal(line), - "Host": Equal(host), "Scheme": BeEmpty(), })) Expect(req.Host).To(Equal(host)) @@ -94,7 +93,6 @@ var _ = Describe("Decoder", func() { req, sample := sh.Request() Expect(*req.URL).To(MatchFields(IgnoreExtras, Fields{ "Path": Equal("/some/path"), - "Host": Equal(host), "Scheme": BeEmpty(), })) Expect(req.Host).To(Equal(host)) @@ -141,18 +139,6 @@ var _ = Describe("Decoder", func() { "C": []string{""}, })) }) - It("overwrite by config", func() { - decodedConfigHeaders, _ := decodeHTTPConfigHeaders([]string{ - "[Host: youhost.tld]", - "[SomeHeader: somevalue]", - }) - decoder.configHeaders = decodedConfigHeaders - cfgHeaders := []ConfigHeader{ - {"Host", "youhost.tld"}, - {"SomeHeader", "somevalue"}, - } - Expect(decoder.configHeaders).To(Equal(cfgHeaders)) - }) }) It("Reset", func() { decoder.header.Set("a", "b") diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index aead695bd..0751d5507 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -20,7 +20,7 @@ type Config struct { File string // Limit limits total num of ammo. Unlimited if zero. Limit int `validate:"min=0"` - // Redefine HTTP headers + // Additional HTTP headers Headers []string // Passes limits ammo file passes. Unlimited if zero. Passes int `validate:"min=0"` @@ -75,7 +75,7 @@ type Provider struct { func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { p.decoder = newDecoder(ctx, p.Sink, &p.Pool) // parse and prepare Headers from config - decodedConfigHeaders, err := decodeHTTPConfigHeaders(p.Config.Headers) + decodedConfigHeaders, err := simple.DecodeHTTPConfigHeaders(p.Config.Headers) if err != nil { return err } diff --git a/components/phttp/ammo/simple/uri/provider_test.go b/components/phttp/ammo/simple/uri/provider_test.go index b1ceb12a6..ec2245ec3 100644 --- a/components/phttp/ammo/simple/uri/provider_test.go +++ b/components/phttp/ammo/simple/uri/provider_test.go @@ -146,7 +146,6 @@ var _ = Describe("provider decode", func() { "Host": Equal(expectedData.host), "URL": PointTo(MatchFields(IgnoreExtras, Fields{ "Scheme": BeEmpty(), - "Host": Equal(expectedData.host), "Path": Equal(expectedData.path), })), "Header": Equal(expectedData.header), diff --git a/components/phttp/ammo/simple/uripost/decoder.go b/components/phttp/ammo/simple/uripost/decoder.go index 20f26f2cb..504eb0a21 100644 --- a/components/phttp/ammo/simple/uripost/decoder.go +++ b/components/phttp/ammo/simple/uripost/decoder.go @@ -8,11 +8,6 @@ import ( "github.com/pkg/errors" ) -type Header struct { - key string - value string -} - func decodeHeader(line []byte) (key string, val string, err error) { if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { return key, val, errors.New("header line should be like '[key: value]'") @@ -49,24 +44,3 @@ func decodeURI(uriString []byte) (bodySize int, uri string, tag string, err erro return } - -func decodeHTTPConfigHeaders(headers []string) (configHTTPHeaders []Header, err error) { - for _, header := range headers { - line := []byte(header) - if len(line) < 3 || line[0] != '[' || line[len(line)-1] != ']' { - return nil, errors.New("header line should be like '[key: value]") - } - line = line[1 : len(line)-1] - colonIdx := bytes.IndexByte(line, ':') - if colonIdx < 0 { - return nil, errors.New("missing colon") - } - configHTTPHeaders = append( - configHTTPHeaders, - Header{ - string(bytes.TrimSpace(line[:colonIdx])), - string(bytes.TrimSpace(line[colonIdx+1:])), - }) - } - return -} diff --git a/components/phttp/ammo/simple/uripost/provider.go b/components/phttp/ammo/simple/uripost/provider.go index 9f6f16a6d..5edd07a26 100644 --- a/components/phttp/ammo/simple/uripost/provider.go +++ b/components/phttp/ammo/simple/uripost/provider.go @@ -23,7 +23,7 @@ type Config struct { File string `validate:"required"` // Limit limits total num of ammo. Unlimited if zero. Limit int `validate:"min=0"` - // Redefine HTTP headers + // Additional HTTP headers Headers []string // Passes limits ammo file passes. Unlimited if zero. Passes int `validate:"min=0"` @@ -55,7 +55,7 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { header := make(http.Header) // parse and prepare Headers from config - decodedConfigHeaders, err := decodeHTTPConfigHeaders(p.Config.Headers) + decodedConfigHeaders, err := simple.DecodeHTTPConfigHeaders(p.Config.Headers) if err != nil { return err } @@ -103,21 +103,13 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { // http.Request.Write sends Host header based on req.URL.Host if k == "Host" { req.Host = v[0] - req.URL.Host = v[0] } else { req.Header[k] = v } } - // redefine request Headers from config - for _, header := range decodedConfigHeaders { - // special behavior for `Host` header - if header.key == "Host" { - req.URL.Host = header.value - } else { - req.Header.Set(header.key, header.value) - } - } + // add new Headers to request from config + simple.UpdateRequestWithHeaders(req, decodedConfigHeaders) sh := p.Pool.Get().(*simple.Ammo) sh.Reset(req, tag) diff --git a/components/phttp/client.go b/components/phttp/client.go index 4af97806e..10502a8ee 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -171,3 +171,11 @@ func checkHTTP2(state *tls.ConnectionState) error { } return nil } + +func getHostWithoutPort(target string) string { + host, _, err := net.SplitHostPort(target) + if err != nil { + host = target + } + return host +} diff --git a/components/phttp/http.go b/components/phttp/http.go index 0e8caf93c..df1451345 100644 --- a/components/phttp/http.go +++ b/components/phttp/http.go @@ -28,14 +28,14 @@ type HTTP2GunConfig struct { Client ClientConfig `config:",squash"` } -func NewHTTPGun(conf HTTPGunConfig, answLog *zap.Logger) *HTTPGun { +func NewHTTPGun(conf HTTPGunConfig, answLog *zap.Logger, targetResolved string) *HTTPGun { transport := NewTransport(conf.Client.Transport, NewDialer(conf.Client.Dialer).DialContext) client := newClient(transport, conf.Client.Redirect) - return NewClientGun(client, conf.Gun, answLog) + return NewClientGun(client, conf.Gun, answLog, targetResolved) } // NewHTTP2Gun return simple HTTP/2 gun that can shoot sequentially through one connection. -func NewHTTP2Gun(conf HTTP2GunConfig, answLog *zap.Logger) (*HTTPGun, error) { +func NewHTTP2Gun(conf HTTP2GunConfig, answLog *zap.Logger, targetResolved string) (*HTTPGun, error) { if !conf.Gun.SSL { // Open issue on github if you really need this feature. return nil, errors.New("HTTP/2.0 over TCP is not supported. Please leave SSL option true by default.") @@ -44,10 +44,10 @@ func NewHTTP2Gun(conf HTTP2GunConfig, answLog *zap.Logger) (*HTTPGun, error) { client := newClient(transport, conf.Client.Redirect) // Will panic and cancel shooting whet target doesn't support HTTP/2. client = &panicOnHTTP1Client{client} - return NewClientGun(client, conf.Gun, answLog), nil + return NewClientGun(client, conf.Gun, answLog, targetResolved), nil } -func NewClientGun(client Client, conf ClientGunConfig, answLog *zap.Logger) *HTTPGun { +func NewClientGun(client Client, conf ClientGunConfig, answLog *zap.Logger, targetResolved string) *HTTPGun { scheme := "http" if conf.SSL { scheme = "https" @@ -63,25 +63,30 @@ func NewClientGun(client Client, conf ClientGunConfig, answLog *zap.Logger) *HTT }, AnswLog: answLog, }, - scheme: scheme, - target: conf.Target, - client: client, + scheme: scheme, + hostname: getHostWithoutPort(conf.Target), + targetResolved: targetResolved, + client: client, } return &g } type HTTPGun struct { BaseGun - scheme string - target string - client Client + scheme string + hostname string + targetResolved string + client Client } var _ Gun = (*HTTPGun)(nil) func (g *HTTPGun) Do(req *http.Request) (*http.Response, error) { - req.Host = req.URL.Host - req.URL.Host = g.target + if req.Host == "" { + req.Host = g.hostname + } + + req.URL.Host = g.targetResolved req.URL.Scheme = g.scheme return g.client.Do(req) } diff --git a/components/phttp/http_test.go b/components/phttp/http_test.go index 602585c26..be5cb5c7d 100644 --- a/components/phttp/http_test.go +++ b/components/phttp/http_test.go @@ -46,9 +46,10 @@ var _ = Describe("BaseGun", func() { defer server.Close() log := zap.NewNop() conf := DefaultHTTPGunConfig() - conf.Gun.Target = strings.TrimPrefix(server.URL, "http://") + conf.Gun.Target = host + ":80" + targetResolved := strings.TrimPrefix(server.URL, "http://") results := &netsample.TestAggregator{} - httpGun := NewHTTPGun(conf, log) + httpGun := NewHTTPGun(conf, log, targetResolved) _ = httpGun.Bind(results, testDeps()) am := newAmmoReq(expectedReq) @@ -58,9 +59,9 @@ var _ = Describe("BaseGun", func() { Expect(*actualReq).To(MatchFields(IgnoreExtras, Fields{ "Method": Equal("GET"), "Proto": Equal("HTTP/1.1"), - "Host": Equal(host), // Not server host, but host from ammo. + "Host": Equal(host), // Server host "URL": PointTo(MatchFields(IgnoreExtras, Fields{ - "Host": BeEmpty(), // Server request. + "Host": BeEmpty(), // Set in Do(). "Path": Equal(path), })), })) @@ -98,7 +99,7 @@ var _ = Describe("HTTP", func() { conf := DefaultHTTPGunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Gun.SSL = https - gun := NewHTTPGun(conf, log) + gun := NewHTTPGun(conf, log, conf.Gun.Target) var aggr netsample.TestAggregator _ = gun.Bind(&aggr, testDeps()) gun.Shoot(newAmmoURL("/")) @@ -124,7 +125,7 @@ var _ = Describe("HTTP", func() { conf := DefaultHTTPGunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Client.Redirect = redirect - gun := NewHTTPGun(conf, log) + gun := NewHTTPGun(conf, log, conf.Gun.Target) var aggr netsample.TestAggregator _ = gun.Bind(&aggr, testDeps()) gun.Shoot(newAmmoURL("/redirect")) @@ -162,7 +163,7 @@ var _ = Describe("HTTP", func() { conf := DefaultHTTPGunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Gun.SSL = true - gun := NewHTTPGun(conf, log) + gun := NewHTTPGun(conf, log, conf.Gun.Target) var results netsample.TestAggregator _ = gun.Bind(&results, testDeps()) gun.Shoot(newAmmoURL("/")) @@ -186,7 +187,7 @@ var _ = Describe("HTTP/2", func() { log := zap.NewNop() conf := DefaultHTTP2GunConfig() conf.Gun.Target = server.Listener.Addr().String() - gun, _ := NewHTTP2Gun(conf, log) + gun, _ := NewHTTP2Gun(conf, log, conf.Gun.Target) var results netsample.TestAggregator _ = gun.Bind(&results, testDeps()) gun.Shoot(newAmmoURL("/")) @@ -201,7 +202,7 @@ var _ = Describe("HTTP/2", func() { log := zap.NewNop() conf := DefaultHTTP2GunConfig() conf.Gun.Target = server.Listener.Addr().String() - gun, _ := NewHTTP2Gun(conf, log) + gun, _ := NewHTTP2Gun(conf, log, conf.Gun.Target) var results netsample.TestAggregator _ = gun.Bind(&results, testDeps()) var r interface{} @@ -224,7 +225,7 @@ var _ = Describe("HTTP/2", func() { conf := DefaultHTTP2GunConfig() conf.Gun.Target = server.Listener.Addr().String() conf.Gun.SSL = false - _, err := NewHTTP2Gun(conf, log) + _, err := NewHTTP2Gun(conf, log, conf.Gun.Target) Expect(err).To(HaveOccurred()) }) diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index f4888d9e8..727d9f77c 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -40,22 +40,22 @@ func Import(fs afero.Fs) { }) register.Gun("http", func(conf phttp.HTTPGunConfig) func() core.Gun { - _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) + targetResolved, _ := preResolveTargetAddr(&conf.Client, conf.Gun.Target) answLog := answlog.Init(conf.Gun.Base.AnswLog.Path) - return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf, answLog)) } + return func() core.Gun { return phttp.WrapGun(phttp.NewHTTPGun(conf, answLog, targetResolved)) } }, phttp.DefaultHTTPGunConfig) register.Gun("http2", func(conf phttp.HTTP2GunConfig) func() (core.Gun, error) { - _ = preResolveTargetAddr(&conf.Client, &conf.Gun.Target) + targetResolved, _ := preResolveTargetAddr(&conf.Client, conf.Gun.Target) answLog := answlog.Init(conf.Gun.Base.AnswLog.Path) return func() (core.Gun, error) { - gun, err := phttp.NewHTTP2Gun(conf, answLog) + gun, err := phttp.NewHTTP2Gun(conf, answLog, targetResolved) return phttp.WrapGun(gun), err } }, phttp.DefaultHTTP2GunConfig) register.Gun("connect", func(conf phttp.ConnectGunConfig) func() core.Gun { - _ = preResolveTargetAddr(&conf.Client, &conf.Target) + conf.Target, _ = preResolveTargetAddr(&conf.Client, conf.Target) answLog := answlog.Init(conf.BaseGunConfig.AnswLog.Path) return func() core.Gun { return phttp.WrapGun(phttp.NewConnectGun(conf, answLog)) @@ -69,22 +69,24 @@ func Import(fs afero.Fs) { // If we can resolve accessible target addr - use it as target, not use caching. // Otherwise just use DNS cache - we should not fail shooting, we should try to // connect on every shoot. DNS cache will save resolved addr after first successful connect. -func preResolveTargetAddr(clientConf *phttp.ClientConfig, target *string) (err error) { +func preResolveTargetAddr(clientConf *phttp.ClientConfig, target string) (targetAddr string, err error) { + targetAddr = target + if !clientConf.Dialer.DNSCache { return } - if endpointIsResolved(*target) { + if endpointIsResolved(target) { clientConf.Dialer.DNSCache = false return } - resolved, err := netutil.LookupReachable(*target) + resolved, err := netutil.LookupReachable(target) if err != nil { zap.L().Warn("DNS target pre resolve failed", - zap.String("target", *target), zap.Error(err)) + zap.String("target", target), zap.Error(err)) return } clientConf.Dialer.DNSCache = false - *target = resolved + targetAddr = resolved return } diff --git a/components/phttp/import/import_suite_test.go b/components/phttp/import/import_suite_test.go index 98b5e47cc..fd427c25a 100644 --- a/components/phttp/import/import_suite_test.go +++ b/components/phttp/import/import_suite_test.go @@ -39,7 +39,7 @@ var _ = Describe("preResolveTargetAddr", func() { target := "localhost:" + port expectedResolved := "127.0.0.1:" + port - err = preResolveTargetAddr(conf, &target) + target, err = preResolveTargetAddr(conf, target) Expect(err).NotTo(HaveOccurred()) Expect(conf.Dialer.DNSCache).To(BeFalse()) @@ -52,7 +52,7 @@ var _ = Describe("preResolveTargetAddr", func() { const addr = "127.0.0.1:80" target := addr - err := preResolveTargetAddr(conf, &target) + target, err := preResolveTargetAddr(conf, target) Expect(err).NotTo(HaveOccurred()) Expect(conf.Dialer.DNSCache).To(BeFalse()) Expect(target).To(Equal(addr)) @@ -64,7 +64,7 @@ var _ = Describe("preResolveTargetAddr", func() { const addr = "localhost:54321" target := addr - err := preResolveTargetAddr(conf, &target) + target, err := preResolveTargetAddr(conf, target) Expect(err).To(HaveOccurred()) Expect(conf.Dialer.DNSCache).To(BeTrue()) Expect(target).To(Equal(addr)) diff --git a/docs/advanced.rst b/docs/advanced.rst index 03d2d0a52..d82c99710 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -70,7 +70,7 @@ Config sample: type: raw # ammo format file: ./ammofile # ammo file path -You can redefine any headers using special config option `headers`. Format: list of strings. +You can define common headers using special config option `headers`. Headers in ammo file have priority. Format: list of strings. Example: @@ -111,7 +111,7 @@ Config sample: file: ./ammofile # ammo file path -You can redefine any headers using special config option `headers`. Format: list of strings. +You can define common headers using special config option `headers`. Headers in ammo file have priority. Format: list of strings. Example: From deb7d993544a127981fb5cfd89eb72ab5570b015 Mon Sep 17 00:00:00 2001 From: nsamokhin Date: Thu, 8 Sep 2022 18:21:16 +0300 Subject: [PATCH 66/80] Add chosencases setting (similar to phantom) add chosencases config option --- components/grpc/ammo/grpcjson/provider.go | 5 +++ components/phttp/ammo/simple/ammo.go | 4 +++ .../phttp/ammo/simple/jsonline/provider.go | 6 ++++ components/phttp/ammo/simple/raw/provider.go | 7 ++++- components/phttp/ammo/simple/uri/decoder.go | 16 +++++++--- .../phttp/ammo/simple/uri/decoder_test.go | 4 +-- components/phttp/ammo/simple/uri/provider.go | 7 +++-- .../phttp/ammo/simple/uripost/provider.go | 7 ++++- docs/advanced.rst | 31 ++++++++++++++++++- lib/confutil/chosen_cases_filter.go | 15 +++++++++ lib/confutil/chosen_cases_filter_test.go | 25 +++++++++++++++ 11 files changed, 114 insertions(+), 13 deletions(-) create mode 100644 lib/confutil/chosen_cases_filter.go create mode 100644 lib/confutil/chosen_cases_filter_test.go diff --git a/components/grpc/ammo/grpcjson/provider.go b/components/grpc/ammo/grpcjson/provider.go index eaff8e02d..067012fec 100644 --- a/components/grpc/ammo/grpcjson/provider.go +++ b/components/grpc/ammo/grpcjson/provider.go @@ -13,6 +13,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" "github.com/yandex/pandora/components/grpc/ammo" + "github.com/yandex/pandora/lib/confutil" "go.uber.org/zap" ) @@ -49,6 +50,7 @@ type Config struct { //Maximum number of byte in an ammo. Default is bufio.MaxScanTokenSize MaxAmmoSize int Source Source `config:"source"` + ChosenCases []string } func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { @@ -70,6 +72,9 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { return errors.Wrapf(err, "failed to decode ammo at line: %v; data: %q", line, data) } } + if !confutil.IsChosenCase(a.Tag, p.Config.ChosenCases) { + continue + } ammoNum++ select { case p.Sink <- a: diff --git a/components/phttp/ammo/simple/ammo.go b/components/phttp/ammo/simple/ammo.go index 6db888e39..5fdc5e756 100644 --- a/components/phttp/ammo/simple/ammo.go +++ b/components/phttp/ammo/simple/ammo.go @@ -51,4 +51,8 @@ func (a *Ammo) IsValid() bool { return !a.isInvalid } +func (a *Ammo) Tag() string { + return a.tag +} + var _ phttp.Ammo = (*Ammo)(nil) diff --git a/components/phttp/ammo/simple/jsonline/provider.go b/components/phttp/ammo/simple/jsonline/provider.go index dd59ef317..25c5f540f 100644 --- a/components/phttp/ammo/simple/jsonline/provider.go +++ b/components/phttp/ammo/simple/jsonline/provider.go @@ -14,6 +14,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/lib/confutil" "go.uber.org/zap" ) @@ -41,10 +42,12 @@ type Config struct { ContinueOnError bool //Maximum number of byte in an ammo. Default is bufio.MaxScanTokenSize MaxAmmoSize int + ChosenCases []string } func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { var ammoNum, passNum int + for { passNum++ scanner := bufio.NewScanner(ammoFile) @@ -62,6 +65,9 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { return errors.Wrapf(err, "failed to decode ammo at line: %v; data: %q", line, data) } } + if !confutil.IsChosenCase(a.Tag(), p.Config.ChosenCases) { + continue + } ammoNum++ select { case p.Sink <- a: diff --git a/components/phttp/ammo/simple/raw/provider.go b/components/phttp/ammo/simple/raw/provider.go index 45391dff4..25100bb4e 100644 --- a/components/phttp/ammo/simple/raw/provider.go +++ b/components/phttp/ammo/simple/raw/provider.go @@ -8,6 +8,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/lib/confutil" "go.uber.org/zap" ) @@ -53,7 +54,8 @@ type Config struct { // Redefine HTTP headers Headers []string // Passes limits ammo file passes. Unlimited if zero. - Passes int `validate:"min=0"` + Passes int `validate:"min=0"` + ChosenCases []string } func NewProvider(fs afero.Fs, conf Config) *Provider { @@ -100,6 +102,9 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { if reqSize == 0 { break // start over from the beginning of file if ammo size is 0 } + if !confutil.IsChosenCase(tag, p.Config.ChosenCases) { + continue + } buff := make([]byte, reqSize) if n, err := io.ReadFull(reader, buff); err != nil { return errors.Wrapf(err, "failed to read ammo at position: %v; tried to read: %v; have read: %v", filePosition(ammoFile), reqSize, n) diff --git a/components/phttp/ammo/simple/uri/decoder.go b/components/phttp/ammo/simple/uri/decoder.go index b38aaf0c2..30aa6c51e 100644 --- a/components/phttp/ammo/simple/uri/decoder.go +++ b/components/phttp/ammo/simple/uri/decoder.go @@ -14,6 +14,7 @@ import ( "github.com/pkg/errors" "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/lib/confutil" ) type decoder struct { @@ -24,14 +25,16 @@ type decoder struct { ammoNum int header http.Header configHeaders []simple.Header + chosenCases []string } -func newDecoder(ctx context.Context, sink chan<- *simple.Ammo, pool *sync.Pool) *decoder { +func newDecoder(ctx context.Context, sink chan<- *simple.Ammo, pool *sync.Pool, chosenCases []string) *decoder { return &decoder{ - sink: sink, - header: http.Header{}, - pool: pool, - ctx: ctx, + sink: sink, + header: http.Header{}, + pool: pool, + ctx: ctx, + chosenCases: chosenCases, } } @@ -56,6 +59,9 @@ func (d *decoder) decodeURI(line []byte) error { if len(parts) > 1 { tag = parts[1] } + if !confutil.IsChosenCase(tag, d.chosenCases) { + return nil + } req, err := http.NewRequest("GET", string(url), nil) if err != nil { return errors.Wrap(err, "uri decode") diff --git a/components/phttp/ammo/simple/uri/decoder_test.go b/components/phttp/ammo/simple/uri/decoder_test.go index 3f7e0354c..c3b731218 100644 --- a/components/phttp/ammo/simple/uri/decoder_test.go +++ b/components/phttp/ammo/simple/uri/decoder_test.go @@ -21,7 +21,7 @@ func newAmmoPool() *sync.Pool { var _ = Describe("Decoder", func() { It("uri decode ctx cancel", func() { ctx, cancel := context.WithCancel(context.Background()) - decoder := newDecoder(ctx, make(chan *simple.Ammo), newAmmoPool()) + decoder := newDecoder(ctx, make(chan *simple.Ammo), newAmmoPool(), nil) cancel() err := decoder.Decode([]byte("/some/path")) Expect(err).To(Equal(context.Canceled)) @@ -32,7 +32,7 @@ var _ = Describe("Decoder", func() { ) BeforeEach(func() { ammoCh = make(chan *simple.Ammo, 10) - decoder = newDecoder(context.Background(), ammoCh, newAmmoPool()) + decoder = newDecoder(context.Background(), ammoCh, newAmmoPool(), nil) }) DescribeTable("invalid input", func(line string) { diff --git a/components/phttp/ammo/simple/uri/provider.go b/components/phttp/ammo/simple/uri/provider.go index 0751d5507..a763d5c9f 100644 --- a/components/phttp/ammo/simple/uri/provider.go +++ b/components/phttp/ammo/simple/uri/provider.go @@ -23,8 +23,9 @@ type Config struct { // Additional HTTP headers Headers []string // Passes limits ammo file passes. Unlimited if zero. - Passes int `validate:"min=0"` - Uris []string + Passes int `validate:"min=0"` + Uris []string + ChosenCases []string } // TODO: pass logger and metricsRegistry @@ -73,7 +74,7 @@ type Provider struct { } func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { - p.decoder = newDecoder(ctx, p.Sink, &p.Pool) + p.decoder = newDecoder(ctx, p.Sink, &p.Pool, p.Config.ChosenCases) // parse and prepare Headers from config decodedConfigHeaders, err := simple.DecodeHTTPConfigHeaders(p.Config.Headers) if err != nil { diff --git a/components/phttp/ammo/simple/uripost/provider.go b/components/phttp/ammo/simple/uripost/provider.go index 5edd07a26..28c5b8440 100644 --- a/components/phttp/ammo/simple/uripost/provider.go +++ b/components/phttp/ammo/simple/uripost/provider.go @@ -11,6 +11,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/afero" "github.com/yandex/pandora/components/phttp/ammo/simple" + "github.com/yandex/pandora/lib/confutil" "go.uber.org/zap" ) @@ -26,7 +27,8 @@ type Config struct { // Additional HTTP headers Headers []string // Passes limits ammo file passes. Unlimited if zero. - Passes int `validate:"min=0"` + Passes int `validate:"min=0"` + ChosenCases []string } func NewProvider(fs afero.Fs, conf Config) *Provider { @@ -90,6 +92,9 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error { if bodySize == 0 { break // start over from the beginning of file if ammo size is 0 } + if !confutil.IsChosenCase(tag, p.Config.ChosenCases) { + continue + } buff := make([]byte, bodySize) if n, err := io.ReadFull(reader, buff); err != nil { return errors.Wrapf(err, "failed to read ammo at position: %v; tried to read: %v; have read: %v", filePosition(ammoFile), bodySize, n) diff --git a/docs/advanced.rst b/docs/advanced.rst index d82c99710..25e843242 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -18,7 +18,7 @@ Pay attention to special header `Host` defined ``outside`` of Headers dictionary Ammofile sample: :: - {"uri": "/", "method": "GET", "headers": {"Accept": "*/*", "Accept-Encoding": "gzip, deflate", "User-Agent": "Pandora"}, "host": "example.com"} + {"tag": "tag1", "uri": "/", "method": "GET", "headers": {"Accept": "*/*", "Accept-Encoding": "gzip, deflate", "User-Agent": "Pandora"}, "host": "example.com"} Config sample: @@ -124,3 +124,32 @@ Example: headers: - "[Host: yourhost.tld]" - "[User-Agent: some user agent]" + +Ammo filters +------------ + +Each http ammo provider lets you choose specific ammo for your test from ammo file with `chosencases` setting: +.. code-block:: yaml + + pools: + - ammo: + type: uri # ammo format + chosencases: ["tag1", "tag2"] # use only "tag1" and "tag2" ammo for this test + file: ./ammofile # ammo file path + +Tags are defined in ammo files as shown below: + +http/json: +:: + {"tag": "tag1", "uri": "/", + +raw (request-style): +:: + 73 tag1 + GET / HTTP/1.0 + +uri-style: +:: + /?drg tag1 + / + /buy tag2 \ No newline at end of file diff --git a/lib/confutil/chosen_cases_filter.go b/lib/confutil/chosen_cases_filter.go new file mode 100644 index 000000000..bd1619a5c --- /dev/null +++ b/lib/confutil/chosen_cases_filter.go @@ -0,0 +1,15 @@ +package confutil + +// Creates filter that returns true if ammo tag is in chosenCases. If no chosenCases provided - returns true +func IsChosenCase(checkCase string, chosenCases []string) bool { + if len(chosenCases) == 0 { + return true + } + + for _, c := range chosenCases { + if c == checkCase { + return true + } + } + return false +} diff --git a/lib/confutil/chosen_cases_filter_test.go b/lib/confutil/chosen_cases_filter_test.go new file mode 100644 index 000000000..904164675 --- /dev/null +++ b/lib/confutil/chosen_cases_filter_test.go @@ -0,0 +1,25 @@ +package confutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +type testCase struct { + ammoTag string + expected bool +} + +func TestChosenCases(t *testing.T) { + cases := []string{"tag1", "tag3"} + + tests := []testCase{ + {"tag1", true}, + {"tag2", false}, + } + + for _, tc := range tests { + assert.Equal(t, tc.expected, IsChosenCase(tc.ammoTag, cases)) + } +} From 2262a93c36917c233aebc322c60f4fc5f7df8541 Mon Sep 17 00:00:00 2001 From: nsamokhin Date: Fri, 9 Sep 2022 12:07:57 +0300 Subject: [PATCH 67/80] Allow custom variables parsers for yaml config. Add env var injection support allow env variables in pandora yaml config --- core/config/config.go | 1 + core/config/config_test.go | 30 ++++ core/config/hooks.go | 20 +++ core/import/import.go | 4 + lib/confutil/chosen_cases_filter_test.go | 10 +- lib/confutil/custom_tag_resolver.go | 178 +++++++++++++++++++++++ lib/confutil/custom_tag_resolver_test.go | 122 ++++++++++++++++ lib/confutil/env_var_resolver.go | 24 +++ lib/confutil/env_var_resolver_test.go | 37 +++++ 9 files changed, 421 insertions(+), 5 deletions(-) create mode 100644 lib/confutil/custom_tag_resolver.go create mode 100644 lib/confutil/custom_tag_resolver_test.go create mode 100644 lib/confutil/env_var_resolver.go create mode 100644 lib/confutil/env_var_resolver_test.go diff --git a/core/config/config.go b/core/config/config.go index 429cbbaf8..5652abc91 100644 --- a/core/config/config.go +++ b/core/config/config.go @@ -84,6 +84,7 @@ func AddKindHook(hook KindHook) (_ struct{}) { func DefaultHooks() []mapstructure.DecodeHookFunc { return []mapstructure.DecodeHookFunc{ + VariableInjectHook, DebugHook, TextUnmarshallerHook, mapstructure.StringToTimeDurationHookFunc(), diff --git a/core/config/config_test.go b/core/config/config_test.go index a602c6bc1..33086e662 100644 --- a/core/config/config_test.go +++ b/core/config/config_test.go @@ -6,12 +6,14 @@ package config import ( + "net" "testing" "time" "github.com/facebookgo/stack" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/yandex/pandora/lib/confutil" ) type M map[string]interface{} @@ -231,3 +233,31 @@ func TestNextSquash(t *testing.T) { require.NoError(t, err) assert.Equal(t, "baz", data.Level1.Level2.Foo) } + +func TestConfigEnvVarReplacement(t *testing.T) { + confutil.RegisterTagResolver("", confutil.EnvTagResolver) + confutil.RegisterTagResolver("ENV", confutil.EnvTagResolver) + + t.Setenv("ENV_VAR_1", "value1") + t.Setenv("VAR_2", "value2") + t.Setenv("INT_VAR_3", "15") + t.Setenv("IP_SEQ", "1.2") + var l1 struct { + Val1 string + Val2 string + Val3 int + Val4 net.IP + } + + err := Decode(M{ + "val1": "aa-${ENV_VAR_1}", + "val2": "${ENV:VAR_2}", + "val3": "${INT_VAR_3}", + "val4": "1.1.${ENV:IP_SEQ}", + }, &l1) + assert.NoError(t, err) + assert.Equal(t, "aa-value1", l1.Val1) + assert.Equal(t, "value2", l1.Val2) + assert.Equal(t, 15, l1.Val3) + assert.Equal(t, net.IPv4(1, 1, 1, 2), l1.Val4) +} diff --git a/core/config/hooks.go b/core/config/hooks.go index 7c4c360c2..0fe69096b 100644 --- a/core/config/hooks.go +++ b/core/config/hooks.go @@ -17,6 +17,7 @@ import ( "github.com/c2h5oh/datasize" "github.com/facebookgo/stack" "github.com/pkg/errors" + "github.com/yandex/pandora/lib/confutil" "github.com/yandex/pandora/lib/tag" "go.uber.org/zap" ) @@ -137,3 +138,22 @@ func DebugHook(f reflect.Type, t reflect.Type, data interface{}) (p interface{}, ) return } + +// VariableInjectHook injects values into ${VAR_NAME} placeholders +func VariableInjectHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + + str := data.(string) + res, err := confutil.ResolveCustomTags(str, t) + if err == confutil.ErrNoTagsFound { + return data, nil + } + + if err != nil { + return data, err + } + + return res, nil +} diff --git a/core/import/import.go b/core/import/import.go index 5caaa6f36..6d436094a 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -20,6 +20,7 @@ import ( "github.com/yandex/pandora/core/provider" "github.com/yandex/pandora/core/register" "github.com/yandex/pandora/core/schedule" + "github.com/yandex/pandora/lib/confutil" "github.com/yandex/pandora/lib/tag" "go.uber.org/zap" ) @@ -93,6 +94,9 @@ func Import(fs afero.Fs) { config.AddTypeHook(sinkStringHook) config.AddTypeHook(scheduleSliceToCompositeConfigHook) + confutil.RegisterTagResolver("", confutil.EnvTagResolver) + confutil.RegisterTagResolver("ENV", confutil.EnvTagResolver) + // Required for decoding plugins. Need to be added after Composite Schedule hacky hook. pluginconfig.AddHooks() } diff --git a/lib/confutil/chosen_cases_filter_test.go b/lib/confutil/chosen_cases_filter_test.go index 904164675..c73a42c69 100644 --- a/lib/confutil/chosen_cases_filter_test.go +++ b/lib/confutil/chosen_cases_filter_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/assert" ) -type testCase struct { - ammoTag string - expected bool -} - func TestChosenCases(t *testing.T) { + type testCase struct { + ammoTag string + expected bool + } + cases := []string{"tag1", "tag3"} tests := []testCase{ diff --git a/lib/confutil/custom_tag_resolver.go b/lib/confutil/custom_tag_resolver.go new file mode 100644 index 000000000..6fd2be5a0 --- /dev/null +++ b/lib/confutil/custom_tag_resolver.go @@ -0,0 +1,178 @@ +package confutil + +import ( + "errors" + "fmt" + "reflect" + "regexp" + "strconv" + "strings" +) + +var ( + notoken = "" + ErrNoTagsFound = errors.New("no tags found") + ErrUnsupportedKind = errors.New("unsupported kind") + ErrCantCastVariableToTargetType = errors.New("can't cast variable") + ErrResolverNotRegistered = errors.New("unknown tag type") +) + +type TagResolver func(string) (string, error) + +type tagEntry struct { + tagType string + string string + varname string +} + +var resolvers map[string]TagResolver = make(map[string]TagResolver) + +// Register custom tag resolver for config variables +func RegisterTagResolver(tagType string, resolver TagResolver) { + tagType = strings.ToLower(tagType) + // silent overwrite existing resolver + resolvers[tagType] = resolver +} + +func getTagResolver(tagType string) (TagResolver, error) { + tagType = strings.ToLower(tagType) + r, ok := resolvers[tagType] + if !ok { + return nil, ErrResolverNotRegistered + } + return r, nil +} + +// Resolve config variables in format ${tagType:variable} +func ResolveCustomTags(s string, targetType reflect.Type) (interface{}, error) { + tokens, err := findTags(s) + if err != nil { + return nil, err + } + + if len(tokens) == 0 { + return s, ErrNoTagsFound + } + + res := s + for _, t := range tokens { + resolver, err := getTagResolver(t.tagType) + if err == ErrResolverNotRegistered { + continue + } else if err != nil { + return nil, err + } + + resolved, err := resolver(t.varname) + if err != nil { + return nil, err + } + res = strings.ReplaceAll(res, t.string, resolved) + } + + // cast to target kind only if the whole value is a tag + // otherwise let other hooks process result + if len(tokens) == 1 && strings.TrimSpace(s) == tokens[0].string { + return cast(res, targetType) + } else { + return res, nil + } +} + +func findTags(s string) ([]*tagEntry, error) { + tagRegexp := regexp.MustCompile(`\$\{(?:([^}]+?):)?([^{}]+?)\}`) + tokensFound := tagRegexp.FindAllStringSubmatch(s, -1) + result := make([]*tagEntry, 0, len(tokensFound)) + + for _, token := range tokensFound { + tag := &tagEntry{ + tagType: strings.TrimSpace(token[1]), + varname: strings.TrimSpace(token[2]), + string: token[0], + } + result = append(result, tag) + } + + return result, nil +} + +func cast(v string, t reflect.Type) (interface{}, error) { + switch t.Kind() { + case reflect.Bool: + return castBool(v) + case reflect.Int, + reflect.Int8, + reflect.Int16, + reflect.Int32, + reflect.Int64, + reflect.Uint, + reflect.Uint8, + reflect.Uint16, + reflect.Uint32, + reflect.Uint64: + return castInt(v, t) + case reflect.Float32, + reflect.Float64: + return castFloat(v, t) + case reflect.String: + return v, nil + } + return nil, ErrUnsupportedKind +} + +func castBool(v string) (interface{}, error) { + res, err := strconv.ParseBool(v) + if err != nil { + return false, fmt.Errorf("'%s' cast to bool failed: %w", v, ErrCantCastVariableToTargetType) + } + + return res, nil +} + +func castInt(v string, t reflect.Type) (interface{}, error) { + intV, err := strconv.ParseInt(v, 0, t.Bits()) + if err != nil { + return nil, fmt.Errorf("'%s' cast to %s failed: %w", v, t, ErrCantCastVariableToTargetType) + } + + switch t.Kind() { + case reflect.Int: + return int(intV), nil + case reflect.Int8: + return int8(intV), nil + case reflect.Int16: + return int16(intV), nil + case reflect.Int32: + return int32(intV), nil + case reflect.Int64: + return int64(intV), nil + case reflect.Uint: + return uint(intV), nil + case reflect.Uint8: + return uint8(intV), nil + case reflect.Uint16: + return uint16(intV), nil + case reflect.Uint32: + return uint32(intV), nil + case reflect.Uint64: + return uint64(intV), nil + } + + return nil, ErrUnsupportedKind +} + +func castFloat(v string, t reflect.Type) (interface{}, error) { + intV, err := strconv.ParseFloat(v, 64) + if err != nil { + return 0.0, fmt.Errorf("'%s' cast to %s failed: %w", v, t, ErrCantCastVariableToTargetType) + } + + switch t.Kind() { + case reflect.Float32: + return float32(intV), nil + case reflect.Float64: + return float64(intV), nil + } + + return nil, ErrUnsupportedKind +} diff --git a/lib/confutil/custom_tag_resolver_test.go b/lib/confutil/custom_tag_resolver_test.go new file mode 100644 index 000000000..5a887d580 --- /dev/null +++ b/lib/confutil/custom_tag_resolver_test.go @@ -0,0 +1,122 @@ +package confutil + +import ( + "fmt" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStringToExpectedCast(t *testing.T) { + type testCase struct { + val string + expected interface{} + err error + } + + tests := []testCase{ + {"True", true, nil}, + {"T", true, nil}, + {"t", true, nil}, + {"TRUE", true, nil}, + {"true", true, nil}, + {"1", true, nil}, + {"False", false, nil}, + {"false", false, nil}, + {"0", false, nil}, + {"f", false, nil}, + {"", false, ErrCantCastVariableToTargetType}, + + {"11", uint(11), nil}, + {"10", uint8(10), nil}, + {"10", uint16(10), nil}, + {"10", uint32(10), nil}, + {"10", uint64(10), nil}, + {"11", int(11), nil}, + {"10", int8(10), nil}, + {"10", int16(10), nil}, + {"10", int32(10), nil}, + {"10", int64(10), nil}, + {"", int(0), ErrCantCastVariableToTargetType}, + {"asdf", int(0), ErrCantCastVariableToTargetType}, + {" -14", int(0), ErrCantCastVariableToTargetType}, + + {"-10", float32(-10), nil}, + {"10.23", float32(10.23), nil}, + {"-10", float64(-10), nil}, + {"10.23", float64(10.23), nil}, + {"", float64(0), ErrCantCastVariableToTargetType}, + {"asdf", float64(0), ErrCantCastVariableToTargetType}, + {" -14", float64(0), ErrCantCastVariableToTargetType}, + + {"10", "10", nil}, + {"value-port", "value-port", nil}, + {"", "", nil}, + } + + for _, test := range tests { + expectedType := reflect.TypeOf(test.expected) + t.Run(fmt.Sprintf("Test string to %s cast", expectedType), func(t *testing.T) { + actual, err := cast(test.val, expectedType) + if test.err == nil { + assert.NoError(t, err) + assert.Exactly(t, test.expected, actual) + } else { + assert.ErrorIs(t, err, test.err) + } + + }) + } +} + +func TestFindTokens(t *testing.T) { + type testCase struct { + val string + expected []*tagEntry + err error + } + + tests := []testCase{ + { + "${token}", + []*tagEntry{{string: "${token}", tagType: "", varname: "token"}}, + nil, + }, + { + "${token}-${ second\t}", + []*tagEntry{ + {string: "${token}", tagType: "", varname: "token"}, + {string: "${ second\t}", tagType: "", varname: "second"}, + }, + nil, + }, + { + "asdf${ee:token}aa", + []*tagEntry{ + {string: "${ee:token}", tagType: "ee", varname: "token"}, + }, + nil, + }, + { + "asdf${ee: to:ken}aa-${ e2 :to }ken}", + []*tagEntry{ + {string: "${ee: to:ken}", tagType: "ee", varname: "to:ken"}, + {string: "${ e2 :to }", tagType: "e2", varname: "to"}, + }, + nil, + }, + } + + for _, test := range tests { + t.Run(fmt.Sprintf("Test findTokens in %s", test.val), func(t *testing.T) { + actual, err := findTags(test.val) + if test.err == nil { + assert.NoError(t, err) + assert.EqualValues(t, test.expected, actual) + } else { + assert.ErrorIs(t, err, test.err) + } + }) + } +} diff --git a/lib/confutil/env_var_resolver.go b/lib/confutil/env_var_resolver.go new file mode 100644 index 000000000..a3cb79072 --- /dev/null +++ b/lib/confutil/env_var_resolver.go @@ -0,0 +1,24 @@ +package confutil + +import ( + "errors" + "fmt" + "os" +) + +var ErrEnvVariableNotProvided error = errors.New("env variable not set") + +// Resolve custom tag token with env variable value +var EnvTagResolver TagResolver = envTokenResolver + +func envTokenResolver(in string) (string, error) { + // TODO: windows os is case-insensitive for env variables, + // so it may requre to load all vars and lookup for env var manually + + val, ok := os.LookupEnv(in) + if !ok { + return "", fmt.Errorf("%s: %w", in, ErrEnvVariableNotProvided) + } + + return val, nil +} diff --git a/lib/confutil/env_var_resolver_test.go b/lib/confutil/env_var_resolver_test.go new file mode 100644 index 000000000..0d452032b --- /dev/null +++ b/lib/confutil/env_var_resolver_test.go @@ -0,0 +1,37 @@ +package confutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEnvVarResolver(t *testing.T) { + type testCase struct { + varname string + val string + err error + } + + tests := []testCase{ + {"SOME_BOOL", "True", nil}, + {"INT_VALUE", "10", nil}, + {"V_NAME", "10", nil}, + } + + for _, test := range tests { + t.Setenv(test.varname, test.val) + } + + tests = append(tests, testCase{"NOT_EXISTS", "", ErrEnvVariableNotProvided}) + + for _, test := range tests { + actual, err := envTokenResolver(test.varname) + if test.err != nil { + assert.ErrorIs(t, err, test.err) + } else { + assert.NoError(t, err) + assert.Exactly(t, test.val, actual) + } + } +} From 41e92cf5adfb014aa0f200e49e99e69a12894d0f Mon Sep 17 00:00:00 2001 From: lix0 Date: Mon, 12 Sep 2022 20:08:09 +0300 Subject: [PATCH 68/80] Up pandora version to the 0.3.9 --- cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index d6ee6be85..1e40f5b06 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -24,7 +24,7 @@ import ( "go.uber.org/zap/zapcore" ) -const Version = "0.3.8" +const Version = "0.3.9" const defaultConfigFile = "load" const stdinConfigSelector = "-" From ea3de63db807fd2d57813e6a138b71cb908e693f Mon Sep 17 00:00:00 2001 From: nsamokhin Date: Tue, 13 Sep 2022 11:13:08 +0300 Subject: [PATCH 69/80] use testify instead of magiconair/properties use testify instead of magiconair/properties --- core/coreutil/buffer_size_config_test.go | 2 +- go.mod | 1 - go.sum | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/core/coreutil/buffer_size_config_test.go b/core/coreutil/buffer_size_config_test.go index 13223be73..aeb8fbd13 100644 --- a/core/coreutil/buffer_size_config_test.go +++ b/core/coreutil/buffer_size_config_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/c2h5oh/datasize" - "github.com/magiconair/properties/assert" + "github.com/stretchr/testify/assert" ) func TestBufferSizeConfig_BufferSizeOrDefault(t *testing.T) { diff --git a/go.mod b/go.mod index 565b6cadc..89c3b8493 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/hashicorp/go-multierror v0.0.0-20171204182908-b7773ae21874 github.com/jhump/protoreflect v1.10.1 github.com/json-iterator/go v0.0.0-20180214060632-e7c7f3b33712 - github.com/magiconair/properties v1.7.6 github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 github.com/onsi/ginkgo v1.4.0 github.com/onsi/gomega v1.3.0 diff --git a/go.sum b/go.sum index 53cccadaa..f9b39fb6e 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.7.6 h1:U+1DqNen04MdEPgFiIwdOUiqZ8qPa37xgogX/sd3+54= -github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= From 8d9401b37524b58aa7a7b406e90f71fb8f802f0e Mon Sep 17 00:00:00 2001 From: nsamokhin Date: Tue, 13 Sep 2022 13:15:21 +0300 Subject: [PATCH 70/80] graceful shutdown on sigint, sigterm pandora graceful shutdown test. handle SIGINT, SIGTERM signals --- cli/cli.go | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 1e40f5b06..38a958521 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -128,30 +128,41 @@ func Run() { errs := make(chan error) go runEngine(ctx, pandora, errs) + // waiting for signal or error message from engine + awaitPandoraTermination(pandora, cancel, errs, log) + log.Info("Engine run successfully finished") +} + +// helper function that awaits pandora run +func awaitPandoraTermination(pandora *engine.Engine, gracefulShutdown func(), errs chan error, log *zap.Logger) { sigs := make(chan os.Signal, 2) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) - // waiting for signal or error message from engine select { case sig := <-sigs: + var interruptTimeout = 3 * time.Second switch sig { case syscall.SIGINT: - const interruptTimeout = 5 * time.Second - log.Info("SIGINT received. Trying to stop gracefully.", zap.Duration("timeout", interruptTimeout)) - cancel() - select { - case <-time.After(interruptTimeout): - log.Fatal("Interrupt timeout exceeded") - case sig := <-sigs: - log.Fatal("Another signal received. Quiting.", zap.Stringer("signal", sig)) - case err := <-errs: - log.Fatal("Engine interrupted", zap.Error(err)) - } + // await gun timeout but no longer than 30 sec. + interruptTimeout = 30 * time.Second + log.Info("SIGINT received. Graceful shutdown.", zap.Duration("timeout", interruptTimeout)) + gracefulShutdown() case syscall.SIGTERM: - log.Fatal("SIGTERM received. Quiting.") + log.Info("SIGTERM received. Trying to stop gracefully.", zap.Duration("timeout", interruptTimeout)) + gracefulShutdown() default: log.Fatal("Unexpected signal received. Quiting.", zap.Stringer("signal", sig)) } + + select { + case <-time.After(interruptTimeout): + log.Fatal("Interrupt timeout exceeded") + case sig := <-sigs: + log.Fatal("Another signal received. Quiting.", zap.Stringer("signal", sig)) + case err := <-errs: + log.Fatal("Engine interrupted", zap.Error(err)) + } + case err := <-errs: switch err { case nil: @@ -159,7 +170,7 @@ func Run() { case err: const awaitTimeout = 3 * time.Second log.Error("Engine run failed. Awaiting started tasks.", zap.Error(err), zap.Duration("timeout", awaitTimeout)) - cancel() + gracefulShutdown() time.AfterFunc(awaitTimeout, func() { log.Fatal("Engine tasks timeout exceeded.") }) @@ -167,7 +178,6 @@ func Run() { log.Fatal("Engine run failed. Pandora graceful shutdown successfully finished") } } - log.Info("Engine run successfully finished") } func runEngine(ctx context.Context, engine *engine.Engine, errs chan error) { From fc3dec50263c8f471b8752cfc42eb284aa23ec3b Mon Sep 17 00:00:00 2001 From: ichigo Date: Tue, 13 Sep 2022 16:28:12 +0300 Subject: [PATCH 71/80] add drop shooting if slow down add drop shooting if slow down --- cli/cli.go | 2 +- core/aggregator/netsample/sample.go | 14 ++++++++- core/coreutil/waiter.go | 20 ++++++++++-- core/engine/engine.go | 4 +-- core/engine/instance.go | 48 ++++++++++++++++++----------- core/engine/instance_test.go | 4 ++- 6 files changed, 67 insertions(+), 25 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 38a958521..2310e55d2 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -24,7 +24,7 @@ import ( "go.uber.org/zap/zapcore" ) -const Version = "0.3.9" +const Version = "0.4.0" const defaultConfigFile = "load" const stdinConfigSelector = "-" diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index 0dc1dc4fd..af76ae4c8 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -17,7 +17,9 @@ import ( ) const ( - ProtoCodeError = 999 + ProtoCodeError = 999 + DiscardedShootCodeError = 777 + DiscardedShootTag = "discarded" ) const ( @@ -150,3 +152,13 @@ func getErrno(err error) int { } } } + +func DiscardedShootSample() *Sample { + sample := &Sample{ + timeStamp: time.Now(), + tags: DiscardedShootTag, + } + sample.SetUserNet(DiscardedShootCodeError) + + return sample +} diff --git a/core/coreutil/waiter.go b/core/coreutil/waiter.go index 06cd1c3fb..88d3ce3dc 100644 --- a/core/coreutil/waiter.go +++ b/core/coreutil/waiter.go @@ -14,8 +14,9 @@ import ( // Waiter goroutine unsafe wrapper for efficient waiting schedule. type Waiter struct { - sched core.Schedule - ctx context.Context + sched core.Schedule + ctx context.Context + slowDownItems int // Lazy initialized. timer *time.Timer @@ -33,23 +34,28 @@ func (w *Waiter) Wait() (ok bool) { // Check, that context is not done. Very quick: 5 ns for op, due to benchmark. select { case <-w.ctx.Done(): + w.slowDownItems = 0 return false default: } next, ok := w.sched.Next() if !ok { + w.slowDownItems = 0 return false } // Get current time lazily. // For once schedule, for example, we need to get it only once. if next.Before(w.lastNow) { + w.slowDownItems++ return true } w.lastNow = time.Now() waitFor := next.Sub(w.lastNow) if waitFor <= 0 { + w.slowDownItems++ return true } + w.slowDownItems = 0 // Lazy init. We don't need timer for unlimited and once schedule. if w.timer == nil { w.timer = time.NewTimer(waitFor) @@ -64,6 +70,16 @@ func (w *Waiter) Wait() (ok bool) { } } +// IsSlowDown returns true, if schedule contains 2 elements before current time. +func (w *Waiter) IsSlowDown() (ok bool) { + select { + case <-w.ctx.Done(): + return false + default: + return w.slowDownItems >= 2 + } +} + // IsFinished is quick check, that wait context is not canceled and there are some tokens left in // schedule. func (w *Waiter) IsFinished() (ok bool) { diff --git a/core/engine/engine.go b/core/engine/engine.go index 62557538e..a5ac5ed6e 100644 --- a/core/engine/engine.go +++ b/core/engine/engine.go @@ -31,6 +31,7 @@ type InstancePoolConfig struct { RPSPerInstance bool `config:"rps-per-instance"` NewRPSSchedule func() (core.Schedule, error) `config:"rps" validate:"required"` StartupSchedule core.Schedule `config:"startup" validate:"required"` + DiscardOverflow bool `config:"discard_overflow"` } // TODO(skipor): use something github.com/rcrowley/go-metrics based. @@ -362,10 +363,9 @@ func (p *instancePool) startInstances( newInstanceSchedule func() (core.Schedule, error), runRes chan<- instanceRunResult) (started int, err error) { deps := instanceDeps{ - p.Aggregator, newInstanceSchedule, p.NewGun, - instanceSharedDeps{p.Provider, p.metrics, p.gunWarmUpResult}, + instanceSharedDeps{p.Provider, p.metrics, p.gunWarmUpResult, p.Aggregator, p.DiscardOverflow}, } waiter := coreutil.NewWaiter(p.StartupSchedule, startCtx) diff --git a/core/engine/instance.go b/core/engine/instance.go index ffafe08b0..fdcd0b6a1 100644 --- a/core/engine/instance.go +++ b/core/engine/instance.go @@ -12,6 +12,7 @@ import ( "github.com/pkg/errors" "github.com/yandex/pandora/core" + "github.com/yandex/pandora/core/aggregator/netsample" "github.com/yandex/pandora/core/coreutil" "github.com/yandex/pandora/core/warmup" "github.com/yandex/pandora/lib/tag" @@ -51,7 +52,6 @@ func newInstance(ctx context.Context, log *zap.Logger, poolID string, id int, de } type instanceDeps struct { - aggregator core.Aggregator newSchedule func() (core.Schedule, error) newGun func() (core.Gun, error) instanceSharedDeps @@ -61,6 +61,8 @@ type instanceSharedDeps struct { provider core.Provider Metrics gunWarmUpResult interface{} + aggregator core.Aggregator + discardOverflow bool } // Run blocks until ammo finish, error or context cancel. @@ -88,24 +90,34 @@ func (i *instance) shoot(ctx context.Context) (err error) { // Checking, that schedule is not finished, required, to not consume extra ammo, // on finish in case of per instance schedule. for !waiter.IsFinished() { - ammo, ok := i.provider.Acquire() - if !ok { - i.log.Debug("Out of ammo") - return outOfAmmoErr + err := func() error { + ammo, ok := i.provider.Acquire() + if !ok { + i.log.Debug("Out of ammo") + return outOfAmmoErr + } + defer i.provider.Release(ammo) + if tag.Debug { + i.log.Debug("Ammo acquired", zap.Any("ammo", ammo)) + } + if !waiter.Wait() { + return nil + } + if !i.discardOverflow || !waiter.IsSlowDown() { + i.Metrics.Request.Add(1) + if tag.Debug { + i.log.Debug("Shooting", zap.Any("ammo", ammo)) + } + i.gun.Shoot(ammo) + i.Metrics.Response.Add(1) + } else { + i.aggregator.Report(netsample.DiscardedShootSample()) + } + return nil + }() + if err != nil { + return err } - if tag.Debug { - i.log.Debug("Ammo acquired", zap.Any("ammo", ammo)) - } - if !waiter.Wait() { - break - } - i.Metrics.Request.Add(1) - if tag.Debug { - i.log.Debug("Shooting", zap.Any("ammo", ammo)) - } - i.gun.Shoot(ammo) - i.Metrics.Response.Add(1) - i.provider.Release(ammo) } return ctx.Err() } diff --git a/core/engine/instance_test.go b/core/engine/instance_test.go index cf7165d3d..029d93aa6 100644 --- a/core/engine/instance_test.go +++ b/core/engine/instance_test.go @@ -47,13 +47,15 @@ var _ = Describe("Instance", func() { JustBeforeEach(func() { deps := instanceDeps{ - aggregator, + newSchedule, newGun, instanceSharedDeps{ provider, metrics, nil, + aggregator, + false, }, } ins, insCreateErr = newInstance(ctx, ginkgoutil.NewLogger(), "pool_0", 0, deps) From 7f423e9197403e8ff0110431c60ce320da2e9275 Mon Sep 17 00:00:00 2001 From: ichigo Date: Tue, 13 Sep 2022 16:34:02 +0300 Subject: [PATCH 72/80] grpc dial timeout add dial timeout --- components/grpc/core.go | 9 +++++++-- components/phttp/import/import.go | 2 +- lib/netutil/dial.go | 5 +++-- lib/netutil/netutil_suite_test.go | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index c17c2aa33..ab7bf0beb 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -31,7 +31,8 @@ type Sample struct { } type grpcDialOptions struct { - Authority string `config:"authority"` + Authority string `config:"authority"` + Timeout time.Duration `config:"timeout"` } type GunConfig struct { @@ -184,7 +185,11 @@ func makeGRPCConnect(target string, isTLS bool, dialOptions grpcDialOptions) (co } else { opts = append(opts, grpc.WithInsecure()) } - opts = append(opts, grpc.WithTimeout(time.Second)) + timeout := time.Second + if dialOptions.Timeout != 0 { + timeout = dialOptions.Timeout + } + opts = append(opts, grpc.WithTimeout(timeout)) opts = append(opts, grpc.WithUserAgent("load test, pandora universal grpc shooter")) if dialOptions.Authority != "" { diff --git a/components/phttp/import/import.go b/components/phttp/import/import.go index 727d9f77c..3441b80f1 100644 --- a/components/phttp/import/import.go +++ b/components/phttp/import/import.go @@ -79,7 +79,7 @@ func preResolveTargetAddr(clientConf *phttp.ClientConfig, target string) (target clientConf.Dialer.DNSCache = false return } - resolved, err := netutil.LookupReachable(target) + resolved, err := netutil.LookupReachable(target, clientConf.Dialer.Timeout) if err != nil { zap.L().Warn("DNS target pre resolve failed", zap.String("target", target), zap.Error(err)) diff --git a/lib/netutil/dial.go b/lib/netutil/dial.go index cc7b7527b..e03de0a9d 100644 --- a/lib/netutil/dial.go +++ b/lib/netutil/dial.go @@ -9,6 +9,7 @@ import ( "context" "net" "sync" + "time" "github.com/pkg/errors" ) @@ -56,8 +57,8 @@ var DefaultDNSCache = &SimpleDNSCache{} // This method has much more overhead, but get guaranteed reachable resolved addr. // Example: host is resolved to IPv4 and IPv6, but IPv4 is not working on machine. // LookupReachable will return IPv6 in that case. -func LookupReachable(addr string) (string, error) { - d := net.Dialer{DualStack: true} +func LookupReachable(addr string, timeout time.Duration) (string, error) { + d := net.Dialer{DualStack: true, Timeout: timeout} conn, err := d.Dial("tcp", addr) if err != nil { return "", err diff --git a/lib/netutil/netutil_suite_test.go b/lib/netutil/netutil_suite_test.go index 8fe11de35..a397d4121 100644 --- a/lib/netutil/netutil_suite_test.go +++ b/lib/netutil/netutil_suite_test.go @@ -5,6 +5,7 @@ import ( "net" "strconv" "testing" + "time" "github.com/onsi/ginkgo" "github.com/onsi/gomega" @@ -28,7 +29,7 @@ var _ = ginkgo.Describe("DNS", func() { addr := "localhost:" + port expectedResolved := "127.0.0.1:" + port - resolved, err := LookupReachable(addr) + resolved, err := LookupReachable(addr, time.Second) gomega.Expect(err).NotTo(gomega.HaveOccurred()) gomega.Expect(resolved).To(gomega.Equal(expectedResolved)) }) From 7e6ca6575d92284de5642c92e85086f4ce895e86 Mon Sep 17 00:00:00 2001 From: nsamokhin Date: Wed, 14 Sep 2022 16:07:57 +0300 Subject: [PATCH 73/80] Pandora: remove dep on fatih/structs remove github.com/fatih/structs dependency --- components/phttp/client.go | 21 ++++++++++++++++----- core/aggregator/jsonlines.go | 8 +++++--- core/config/config.go | 29 +++++++++++++++++++++++------ core/config/config_test.go | 1 - go.mod | 1 - go.sum | 2 -- 6 files changed, 44 insertions(+), 18 deletions(-) diff --git a/components/phttp/client.go b/components/phttp/client.go index 10502a8ee..e54fcd8cd 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -13,7 +13,6 @@ import ( "time" "github.com/pkg/errors" - "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/lib/netutil" "go.uber.org/zap" "golang.org/x/net/http2" @@ -64,8 +63,12 @@ func DefaultDialerConfig() DialerConfig { } func NewDialer(conf DialerConfig) netutil.Dialer { - d := &net.Dialer{} - config.Map(d, conf) + d := &net.Dialer{ + Timeout: conf.Timeout, + DualStack: conf.DualStack, + FallbackDelay: conf.FallbackDelay, + KeepAlive: conf.KeepAlive, + } if !conf.DNSCache { return d } @@ -96,12 +99,20 @@ func DefaultTransportConfig() TransportConfig { } func NewTransport(conf TransportConfig, dial netutil.DialerFunc) *http.Transport { - tr := &http.Transport{} + tr := &http.Transport{ + TLSHandshakeTimeout: conf.TLSHandshakeTimeout, + DisableKeepAlives: conf.DisableKeepAlives, + DisableCompression: conf.DisableCompression, + MaxIdleConns: conf.MaxIdleConns, + MaxIdleConnsPerHost: conf.MaxIdleConnsPerHost, + IdleConnTimeout: conf.IdleConnTimeout, + ResponseHeaderTimeout: conf.ResponseHeaderTimeout, + ExpectContinueTimeout: conf.ExpectContinueTimeout, + } tr.TLSClientConfig = &tls.Config{ InsecureSkipVerify: true, // We should not spend time for this stuff. NextProtos: []string{"http/1.1"}, // Disable HTTP/2. Use HTTP/2 transport explicitly, if needed. } - config.Map(tr, conf) tr.DialContext = dial return tr } diff --git a/core/aggregator/jsonlines.go b/core/aggregator/jsonlines.go index 2d19b9067..a66e26eeb 100644 --- a/core/aggregator/jsonlines.go +++ b/core/aggregator/jsonlines.go @@ -11,7 +11,6 @@ import ( jsoniter "github.com/json-iterator/go" "github.com/yandex/pandora/core" - "github.com/yandex/pandora/core/config" "github.com/yandex/pandora/core/coreutil" "github.com/yandex/pandora/lib/ioutil2" ) @@ -51,8 +50,11 @@ func NewJSONLinesAggregator(conf JSONLineAggregatorConfig) core.Aggregator { } func NewJSONEncoder(w io.Writer, conf JSONLineEncoderConfig) SampleEncoder { - var apiConfig jsoniter.Config - config.Map(&apiConfig, conf.JSONIterConfig) + apiConfig := jsoniter.Config{ + SortMapKeys: conf.JSONIterConfig.SortMapKeys, + MarshalFloatWith6Digits: conf.JSONIterConfig.MarshalFloatWith6Digits, + } + api := apiConfig.Froze() // NOTE(skipor): internal buffering is not working really. Don't know why // OPTIMIZE(skipor): don't wrap into buffer, if already ioutil2.ByteWriter diff --git a/core/config/config.go b/core/config/config.go index 5652abc91..37f24d2ea 100644 --- a/core/config/config.go +++ b/core/config/config.go @@ -6,7 +6,6 @@ package config import ( - "github.com/fatih/structs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" ) @@ -39,18 +38,36 @@ func DecodeAndValidate(conf interface{}, result interface{}) error { // in such case you can from this subset of fields struct Single, decode config // into it, and map it on Multi. func Map(dst, src interface{}) { - conf := &mapstructure.DecoderConfig{ + // dst and src conf for compatibility with old fatih/structs. + // src map from "map:" tags -> tmp -> map to "mapstructure:" tags in dst + dstConf := &mapstructure.DecoderConfig{ ErrorUnused: true, ZeroFields: true, Result: dst, } - d, err := mapstructure.NewDecoder(conf) + d, err := mapstructure.NewDecoder(dstConf) if err != nil { panic(err) } - s := structs.New(src) - s.TagName = "map" - err = d.Decode(s.Map()) + + tmp := make(map[string]interface{}) + srcConf := &mapstructure.DecoderConfig{ + ErrorUnused: true, + ZeroFields: true, + Result: &tmp, + TagName: "map", + } + s, err := mapstructure.NewDecoder(srcConf) + if err != nil { + panic(err) + } + + err = s.Decode(src) + if err != nil { + panic(err) + } + + err = d.Decode(tmp) if err != nil { panic(err) } diff --git a/core/config/config_test.go b/core/config/config_test.go index 33086e662..9041a6c55 100644 --- a/core/config/config_test.go +++ b/core/config/config_test.go @@ -186,7 +186,6 @@ func TestMapTagged(t *testing.T) { Map(n, &M{SomeOtherFieldName: MultiStrings{A: "a"}}) assert.Equal(t, &N{A: "a", MultiStrings: MultiStrings{A: "a"}}, n) } - func TestDeltaUpdate(t *testing.T) { var l2 Level2 err := Decode(M{ diff --git a/go.mod b/go.mod index 89c3b8493..53dfa8ed0 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4 - github.com/fatih/structs v1.0.0 github.com/ghodss/yaml v1.0.0 github.com/hashicorp/go-multierror v0.0.0-20171204182908-b7773ae21874 github.com/jhump/protoreflect v1.10.1 diff --git a/go.sum b/go.sum index f9b39fb6e..d5b85f7e5 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,6 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4 h1:fP04zlkPjAGpsduG7xN3rRkxjAqkJaIQnnkNYYw/pAk= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4/go.mod h1:SBHk9aNQtiw4R4bEuzHjVmZikkUKCnO1v3lPQ21HZGk= -github.com/fatih/structs v1.0.0 h1:BrX964Rv5uQ3wwS+KRUAJCBBw5PQmgJfJ6v4yly5QwU= -github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= From 0caa737541f11072902b05ec5fe1304efa526f0e Mon Sep 17 00:00:00 2001 From: nsamokhin Date: Thu, 22 Sep 2022 10:17:22 +0300 Subject: [PATCH 74/80] pandora: fix env var to config Duration field cast fix cast errors when parsing env variable to time.Duration --- cli/cli.go | 2 +- core/config/config_test.go | 4 ++++ lib/confutil/custom_tag_resolver.go | 12 +++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 2310e55d2..b8b0be6f4 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -24,7 +24,7 @@ import ( "go.uber.org/zap/zapcore" ) -const Version = "0.4.0" +const Version = "0.4.1" const defaultConfigFile = "load" const stdinConfigSelector = "-" diff --git a/core/config/config_test.go b/core/config/config_test.go index 9041a6c55..dde391b62 100644 --- a/core/config/config_test.go +++ b/core/config/config_test.go @@ -241,11 +241,13 @@ func TestConfigEnvVarReplacement(t *testing.T) { t.Setenv("VAR_2", "value2") t.Setenv("INT_VAR_3", "15") t.Setenv("IP_SEQ", "1.2") + t.Setenv("DURATION", "30s") var l1 struct { Val1 string Val2 string Val3 int Val4 net.IP + Val5 time.Duration } err := Decode(M{ @@ -253,10 +255,12 @@ func TestConfigEnvVarReplacement(t *testing.T) { "val2": "${ENV:VAR_2}", "val3": "${INT_VAR_3}", "val4": "1.1.${ENV:IP_SEQ}", + "val5": "${DURATION}", }, &l1) assert.NoError(t, err) assert.Equal(t, "aa-value1", l1.Val1) assert.Equal(t, "value2", l1.Val2) assert.Equal(t, 15, l1.Val3) assert.Equal(t, net.IPv4(1, 1, 1, 2), l1.Val4) + assert.Equal(t, 30*time.Second, l1.Val5) } diff --git a/lib/confutil/custom_tag_resolver.go b/lib/confutil/custom_tag_resolver.go index 6fd2be5a0..8ab249e67 100644 --- a/lib/confutil/custom_tag_resolver.go +++ b/lib/confutil/custom_tag_resolver.go @@ -70,13 +70,15 @@ func ResolveCustomTags(s string, targetType reflect.Type) (interface{}, error) { res = strings.ReplaceAll(res, t.string, resolved) } - // cast to target kind only if the whole value is a tag - // otherwise let other hooks process result + // try to cast result to target type, because mapstructure will not attempt to cast strings to bool, int and floats + // if target type is unknown, we still let other hooks process result (time.Duration, ipv4 and other hooks will do) if len(tokens) == 1 && strings.TrimSpace(s) == tokens[0].string { - return cast(res, targetType) - } else { - return res, nil + castedRes, err := cast(res, targetType) + if err == nil || !errors.Is(err, ErrCantCastVariableToTargetType) { + return castedRes, err + } } + return res, nil } func findTags(s string) ([]*tagEntry, error) { From e3cab85b4cf4ceed579cbc9795505cd08a057d40 Mon Sep 17 00:00:00 2001 From: sabevzenko Date: Tue, 27 Sep 2022 15:25:55 +0300 Subject: [PATCH 75/80] prepare fo gofmt1.19: 400-600 prepare for gofmt1.19 200-400 --- core/import/import.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/import/import.go b/core/import/import.go index 6d436094a..87f88255c 100644 --- a/core/import/import.go +++ b/core/import/import.go @@ -30,7 +30,7 @@ const ( compositeScheduleKey = "composite" ) -//getter for fs to avoid afero dependency in custom guns +// getter for fs to avoid afero dependency in custom guns func GetFs() afero.Fs { return afero.NewOsFs() } From 0fe25d2b8737e00a014f5e8fb89822052357a713 Mon Sep 17 00:00:00 2001 From: sabevzenko Date: Thu, 13 Oct 2022 17:40:14 +0300 Subject: [PATCH 76/80] httptrace and req/resp dumps for Sample httptrace and req/resp dumps for Sample --- components/phttp/base.go | 48 ++++++++++++++++- components/phttp/trace.go | 65 ++++++++++++++++++++++++ core/aggregator/netsample/sample.go | 14 ++++- core/aggregator/netsample/sample_test.go | 2 +- 4 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 components/phttp/trace.go diff --git a/components/phttp/base.go b/components/phttp/base.go index 985985762..7d5756b5f 100644 --- a/components/phttp/base.go +++ b/components/phttp/base.go @@ -12,6 +12,7 @@ import ( "io" "io/ioutil" "net/http" + "net/http/httptrace" "net/http/httputil" "net/url" @@ -26,8 +27,9 @@ const ( ) type BaseGunConfig struct { - AutoTag AutoTagConfig `config:"auto-tag"` - AnswLog AnswLogConfig `config:"answlog"` + AutoTag AutoTagConfig `config:"auto-tag"` + AnswLog AnswLogConfig `config:"answlog"` + HTTPTrace HTTPTraceConfig `config:"httptrace"` } // AutoTagConfig configure automatic tags generation based on ammo URI. First AutoTag URI path elements becomes tag. @@ -44,6 +46,11 @@ type AnswLogConfig struct { Filter string `config:"filter" valid:"oneof=all warning error"` } +type HTTPTraceConfig struct { + DumpEnabled bool `config:"dump"` + TraceEnabled bool `config:"trace"` +} + func DefaultBaseGunConfig() BaseGunConfig { return BaseGunConfig{ AutoTagConfig{ @@ -56,6 +63,10 @@ func DefaultBaseGunConfig() BaseGunConfig { Path: "answ.log", Filter: "error", }, + HTTPTraceConfig{ + DumpEnabled: false, + TraceEnabled: false, + }, } } @@ -136,8 +147,41 @@ func (b *BaseGun) Shoot(ammo Ammo) { err = errors.WithStack(err) }() + var timings *TraceTimings + if b.Config.HTTPTrace.TraceEnabled { + var clientTracer *httptrace.ClientTrace + clientTracer, timings = createHTTPTrace() + req = req.WithContext(httptrace.WithClientTrace(req.Context(), clientTracer)) + } + if b.Config.HTTPTrace.DumpEnabled { + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + b.Log.Error("DumpRequest error", zap.Error(err)) + } else { + sample.SetRequestBytes(len(requestDump)) + } + } var res *http.Response res, err = b.Do(req) + + if b.Config.HTTPTrace.TraceEnabled && timings != nil { + sample.SetReceiveTime(timings.GetReceiveTime()) + } + + if b.Config.HTTPTrace.DumpEnabled && res != nil { + responseDump, err := httputil.DumpResponse(res, true) + if err != nil { + b.Log.Error("DumpResponse error", zap.Error(err)) + } else { + sample.SetResponseBytes(len(responseDump)) + } + } + if b.Config.HTTPTrace.TraceEnabled && timings != nil { + sample.SetConnectTime(timings.GetConnectTime()) + sample.SetSendTime(timings.GetSendTime()) + sample.SetLatency(timings.GetLatency()) + } + if err != nil { b.Log.Warn("Request fail", zap.Error(err)) return diff --git a/components/phttp/trace.go b/components/phttp/trace.go new file mode 100644 index 000000000..70cedaa45 --- /dev/null +++ b/components/phttp/trace.go @@ -0,0 +1,65 @@ +package phttp + +import ( + "net/http/httptrace" + "time" +) + +type TraceTimings struct { + GotConnTime time.Time + GetConnTime time.Time + DNSStartTime time.Time + DNSDoneTime time.Time + ConnectDoneTime time.Time + ConnectStartTime time.Time + WroteRequestTime time.Time + GotFirstResponseByte time.Time +} + +func (t *TraceTimings) GetReceiveTime() time.Duration { + return time.Since(t.GotFirstResponseByte) +} + +func (t *TraceTimings) GetConnectTime() time.Duration { + return t.GotConnTime.Sub(t.GetConnTime) +} + +func (t *TraceTimings) GetSendTime() time.Duration { + return t.WroteRequestTime.Sub(t.GotConnTime) +} + +func (t *TraceTimings) GetLatency() time.Duration { + return t.GotFirstResponseByte.Sub(t.WroteRequestTime) +} + +func createHTTPTrace() (*httptrace.ClientTrace, *TraceTimings) { + timings := &TraceTimings{} + tracer := &httptrace.ClientTrace{ + GetConn: func(_ string) { + timings.GetConnTime = time.Now() + }, + GotConn: func(_ httptrace.GotConnInfo) { + timings.GotConnTime = time.Now() + }, + DNSStart: func(_ httptrace.DNSStartInfo) { + timings.DNSStartTime = time.Now() + }, + DNSDone: func(info httptrace.DNSDoneInfo) { + timings.DNSDoneTime = time.Now() + }, + ConnectStart: func(network, addr string) { + timings.ConnectStartTime = time.Now() + }, + ConnectDone: func(network, addr string, err error) { + timings.ConnectDoneTime = time.Now() + }, + WroteRequest: func(wr httptrace.WroteRequestInfo) { + timings.WroteRequestTime = time.Now() + }, + GotFirstResponseByte: func() { + timings.GotFirstResponseByte = time.Now() + }, + } + + return tracer, timings +} diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index af76ae4c8..536e65306 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -103,15 +103,27 @@ func (s *Sample) SetUserNet(code int) { s.set(keyErrno, code) } +func (s *Sample) SetConnectTime(d time.Duration) { + s.setDuration(keyConnectMicro, d) +} + +func (s *Sample) SetSendTime(d time.Duration) { + s.setDuration(keySendMicro, d) +} + func (s *Sample) SetLatency(d time.Duration) { s.setDuration(keyLatencyMicro, d) } +func (s *Sample) SetReceiveTime(d time.Duration) { + s.setDuration(keyReceiveMicro, d) +} + func (s *Sample) SetRequestBytes(b int) { s.set(keyRequestBytes, b) } -func (s *Sample) SetResponceBytes(b int) { +func (s *Sample) SetResponseBytes(b int) { s.set(keyResponseBytes, b) } diff --git a/core/aggregator/netsample/sample_test.go b/core/aggregator/netsample/sample_test.go index d8f302c8e..94cdeef53 100644 --- a/core/aggregator/netsample/sample_test.go +++ b/core/aggregator/netsample/sample_test.go @@ -68,7 +68,7 @@ func TestCustomSets(t *testing.T) { s.SetRequestBytes(reqBytes) respBytes := 8 - s.SetResponceBytes(respBytes) + s.SetResponseBytes(respBytes) expectedTimeStamp := fmt.Sprintf("%v.%3.f", s.timeStamp.Unix(), From d606c47f9c476df2e6ba04f85b94bb5a357b345d Mon Sep 17 00:00:00 2001 From: sabevzenko Date: Fri, 14 Oct 2022 10:26:05 +0300 Subject: [PATCH 77/80] fix go.mod & version up fix go.mod & version up --- cli/cli.go | 2 +- go.mod | 5 +++-- go.sum | 12 ++++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index b8b0be6f4..ff5f107ee 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -24,7 +24,7 @@ import ( "go.uber.org/zap/zapcore" ) -const Version = "0.4.1" +const Version = "0.5.0" const defaultConfigFile = "load" const stdinConfigSelector = "-" diff --git a/go.mod b/go.mod index 53dfa8ed0..ebade8e63 100644 --- a/go.mod +++ b/go.mod @@ -28,12 +28,13 @@ require ( require ( github.com/davecgh/go-spew v1.1.0 // indirect - github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-playground/locales v0.11.2 // indirect github.com/go-playground/universal-translator v0.16.0 // indirect github.com/golang/protobuf v1.4.3 // indirect github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect + github.com/magiconair/properties v1.8.6 // indirect github.com/pelletier/go-toml v1.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/cast v1.2.0 // indirect @@ -41,7 +42,7 @@ require ( github.com/spf13/pflag v1.0.0 // indirect github.com/stretchr/objx v0.1.0 // indirect go.uber.org/multierr v1.1.0 // indirect - golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect + golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25 // indirect golang.org/x/text v0.3.0 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12 // indirect diff --git a/go.sum b/go.sum index d5b85f7e5..c1e357636 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,8 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4 h1:fP04zlkPjAGpsduG7xN3rRkxjAqkJaIQnnkNYYw/pAk= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4/go.mod h1:SBHk9aNQtiw4R4bEuzHjVmZikkUKCnO1v3lPQ21HZGk= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-playground/locales v0.11.2 h1:wH6Ksuvzk0SU9M6wUeGz/EaRWnavAHCOsFre1njzgi8= @@ -73,6 +73,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= @@ -148,8 +150,10 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25 h1:nwzwVf0l2Y/lkov/+IYgMMbFyI+QypZDds9RxlSmsFQ= +golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -206,4 +210,4 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= \ No newline at end of file +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= From 4b36cf4100873db97ca07fe2f234283910d2f722 Mon Sep 17 00:00:00 2001 From: sabevzenko Date: Thu, 10 Nov 2022 12:52:03 +0300 Subject: [PATCH 78/80] grpc metadata fix grpc metadata fix --- components/grpc/core.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/components/grpc/core.go b/components/grpc/core.go index ab7bf0beb..55afab67e 100644 --- a/components/grpc/core.go +++ b/components/grpc/core.go @@ -25,6 +25,8 @@ import ( "google.golang.org/grpc/status" ) +const defaultTimeout = time.Second * 15 + type Sample struct { URL string ShootTimeSeconds float64 @@ -149,21 +151,14 @@ func (g *Gun) shoot(ammo *ammo.Ammo) { return } - meta := make(metadata.MD) - if ammo.Metadata != nil && len(ammo.Metadata) > 0 { - for key, value := range ammo.Metadata { - meta = metadata.Pairs(key, value) - } - } - - timeout := time.Second * 15 + timeout := defaultTimeout if g.conf.Timeout != 0 { timeout = time.Second * g.conf.Timeout } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - ctx = metadata.NewOutgoingContext(ctx, meta) + ctx = metadata.NewOutgoingContext(ctx, metadata.New(ammo.Metadata)) out, err := g.stub.InvokeRpc(ctx, &method, message) code = convertGrpcStatus(err) From 75f5b33191029431451fbcfd8ff07277bac2cd6b Mon Sep 17 00:00:00 2001 From: griddic Date: Wed, 30 Nov 2022 17:34:41 +0300 Subject: [PATCH 79/80] up pandora version - internal --- cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index ff5f107ee..68ee43150 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -24,7 +24,7 @@ import ( "go.uber.org/zap/zapcore" ) -const Version = "0.5.0" +const Version = "0.5.1" const defaultConfigFile = "load" const stdinConfigSelector = "-" From 0fefad9502f5dcc3ac20c382fc50612f45cd172c Mon Sep 17 00:00:00 2001 From: Anton Piskunov Date: Fri, 13 Jan 2023 09:30:33 +0000 Subject: [PATCH 80/80] Fix #130 with Cloudflare's SNI Fix #130 with Cloudflare's SNI Pull Request resolved: #158 --- Makefile | 2 +- components/phttp/client.go | 11 ++++++++--- components/phttp/connect.go | 2 +- components/phttp/http.go | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 20726e4b8..553118b5b 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ fmt: tools: @echo "$(OK_COLOR)Install tools$(NO_COLOR)" - go install golang.org/x/tools/cmd/goimports + go install golang.org/x/tools/cmd/goimports@latest go get golang.org/x/tools/cmd/cover go get github.com/modocache/gover go get github.com/mattn/goveralls diff --git a/components/phttp/client.go b/components/phttp/client.go index e54fcd8cd..a131fd32c 100644 --- a/components/phttp/client.go +++ b/components/phttp/client.go @@ -98,7 +98,7 @@ func DefaultTransportConfig() TransportConfig { } } -func NewTransport(conf TransportConfig, dial netutil.DialerFunc) *http.Transport { +func NewTransport(conf TransportConfig, dial netutil.DialerFunc, target string) *http.Transport { tr := &http.Transport{ TLSHandshakeTimeout: conf.TLSHandshakeTimeout, DisableKeepAlives: conf.DisableKeepAlives, @@ -109,16 +109,21 @@ func NewTransport(conf TransportConfig, dial netutil.DialerFunc) *http.Transport ResponseHeaderTimeout: conf.ResponseHeaderTimeout, ExpectContinueTimeout: conf.ExpectContinueTimeout, } + host, _, err := net.SplitHostPort(target) + if err != nil { + zap.L().Panic("HTTP transport configure fail", zap.Error(err)) + } tr.TLSClientConfig = &tls.Config{ InsecureSkipVerify: true, // We should not spend time for this stuff. NextProtos: []string{"http/1.1"}, // Disable HTTP/2. Use HTTP/2 transport explicitly, if needed. + ServerName: host, } tr.DialContext = dial return tr } -func NewHTTP2Transport(conf TransportConfig, dial netutil.DialerFunc) *http.Transport { - tr := NewTransport(conf, dial) +func NewHTTP2Transport(conf TransportConfig, dial netutil.DialerFunc, target string) *http.Transport { + tr := NewTransport(conf, dial, target) err := http2.ConfigureTransport(tr) if err != nil { zap.L().Panic("HTTP/2 transport configure fail", zap.Error(err)) diff --git a/components/phttp/connect.go b/components/phttp/connect.go index 110ac58a3..64f439b3e 100644 --- a/components/phttp/connect.go +++ b/components/phttp/connect.go @@ -77,7 +77,7 @@ func newConnectClient(conf ConnectGunConfig) Client { conf.Target, conf.ConnectSSL, NewDialer(conf.Client.Dialer), - )) + ), conf.Target) return newClient(transport, conf.Client.Redirect) } diff --git a/components/phttp/http.go b/components/phttp/http.go index df1451345..4924f9a31 100644 --- a/components/phttp/http.go +++ b/components/phttp/http.go @@ -29,7 +29,7 @@ type HTTP2GunConfig struct { } func NewHTTPGun(conf HTTPGunConfig, answLog *zap.Logger, targetResolved string) *HTTPGun { - transport := NewTransport(conf.Client.Transport, NewDialer(conf.Client.Dialer).DialContext) + transport := NewTransport(conf.Client.Transport, NewDialer(conf.Client.Dialer).DialContext, conf.Gun.Target) client := newClient(transport, conf.Client.Redirect) return NewClientGun(client, conf.Gun, answLog, targetResolved) } @@ -40,7 +40,7 @@ func NewHTTP2Gun(conf HTTP2GunConfig, answLog *zap.Logger, targetResolved string // Open issue on github if you really need this feature. return nil, errors.New("HTTP/2.0 over TCP is not supported. Please leave SSL option true by default.") } - transport := NewHTTP2Transport(conf.Client.Transport, NewDialer(conf.Client.Dialer).DialContext) + transport := NewHTTP2Transport(conf.Client.Transport, NewDialer(conf.Client.Dialer).DialContext, conf.Gun.Target) client := newClient(transport, conf.Client.Redirect) // Will panic and cancel shooting whet target doesn't support HTTP/2. client = &panicOnHTTP1Client{client}