Skip to content

Commit

Permalink
GH-55: use testutil.RunSuite instead of ginkgo.RunSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
skipor committed Jan 2, 2018
1 parent 37f3bb6 commit 391e705
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 53 deletions.
6 changes: 1 addition & 5 deletions acceptance_tests/acceptance_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ import (
"github.com/onsi/gomega/gexec"
"go.uber.org/zap"

"github.com/onsi/gomega/format"
"github.com/yandex/pandora/lib/tag"
"github.com/yandex/pandora/lib/testutil"
)

var pandoraBin string

func TestAcceptanceTests(t *testing.T) {
RegisterFailHandler(Fail)
format.UseStringerRepresentation = true

testutil.ReplaceGlobalLogger()
testutil.SetupSuite()
var args []string
if tag.Race {
zap.L().Debug("Building with race detector")
Expand Down
4 changes: 2 additions & 2 deletions components/phttp/ammo/simple/jsonline/jsonline_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
"github.com/spf13/afero"

"github.com/yandex/pandora/components/phttp/ammo/simple"
"github.com/yandex/pandora/lib/testutil"
)

func TestJsonline(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Jsonline Suite")
testutil.RunSuite(t, "Jsonline Suite")
}

const testFile = "./ammo.jsonline"
Expand Down
6 changes: 2 additions & 4 deletions components/phttp/ammo/simple/raw/raw_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package raw
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/yandex/pandora/lib/testutil"
)

func TestRaw(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Raw Suite")
testutil.RunSuite(t, "Raw Suite")
}
6 changes: 2 additions & 4 deletions components/phttp/ammo/simple/uri/uri_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package uri
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/yandex/pandora/lib/testutil"
)

func TestUri(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Uri Suite")
testutil.RunSuite(t, "Uri Suite")
}
7 changes: 1 addition & 6 deletions components/phttp/phttp_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ package phttp
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/yandex/pandora/lib/testutil"
)

func TestPhttp(t *testing.T) {
RegisterFailHandler(Fail)
testutil.ReplaceGlobalLogger()
RunSpecs(t, "HTTP Suite")
testutil.RunSuite(t, "HTTP Suite")
}
7 changes: 1 addition & 6 deletions core/aggregate/netsample/netsample_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ package netsample
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/yandex/pandora/lib/testutil"
)

func TestNetsample(t *testing.T) {
RegisterFailHandler(Fail)
testutil.ReplaceGlobalLogger()
RunSpecs(t, "Netsample Suite")
testutil.RunSuite(t, "Netsample Suite")
}
6 changes: 0 additions & 6 deletions core/aggregate/netsample/phout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package netsample

import (
"context"
"fmt"
"strings"
"testing"
"time"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -69,10 +67,6 @@ const (
testSampleNoIdPhout = "1484660999.002 tag1|tag2 333333 0 0 0 0 0 0 0 13 999"
)

func TestOUt(t *testing.T) {
fmt.Println(newTestSample().String())
}

func newTestSample() *Sample {
s := &Sample{}
s.timeStamp = time.Unix(1484660999, 002*1000000)
Expand Down
7 changes: 2 additions & 5 deletions core/engine/engine_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package engine

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"testing"

"github.com/yandex/pandora/lib/monitoring"
"github.com/yandex/pandora/lib/testutil"
)

func TestEngine(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Engine Suite")
testutil.RunSuite(t, "Engine Suite")
}

func newTestMetrics() Metrics {
Expand Down
7 changes: 1 addition & 6 deletions core/plugin/plugin_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ package plugin
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/yandex/pandora/lib/testutil"
)

func TestPlugin(t *testing.T) {
RegisterFailHandler(Fail)
testutil.ReplaceGlobalLogger()
RunSpecs(t, "Plugin Suite")
testutil.RunSuite(t, "Plugin Suite")
}
8 changes: 3 additions & 5 deletions core/provider/provider_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package provider

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"testing"

"github.com/yandex/pandora/lib/testutil"
)

func TestProvider(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Provider Suite")
testutil.RunSuite(t, "Provider Suite")
}
4 changes: 2 additions & 2 deletions core/schedule/schedule_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (

"github.com/yandex/pandora/core"
"github.com/yandex/pandora/core/coretest"
"github.com/yandex/pandora/lib/testutil"
)

func TestSchedule(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Schedule Suite")
testutil.RunSuite(t, "Schedule Suite")
}

var _ = Describe("unlimited", func() {
Expand Down
8 changes: 6 additions & 2 deletions lib/testutil/ginkgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ import (
"go.uber.org/zap/zapcore"
)

func RunSuite(t *testing.T, description string) {
format.UseStringerRepresentation = true
func SetupSuite() {
format.UseStringerRepresentation = true // Otherwise error stacks have binary format.
ReplaceGlobalLogger()
RegisterFailHandler(Fail)
}

func RunSuite(t *testing.T, description string) {
SetupSuite()
RunSpecs(t, description)
}

Expand Down

0 comments on commit 391e705

Please sign in to comment.