Skip to content

Commit

Permalink
continue update test syntax for ginkgo v2
Browse files Browse the repository at this point in the history
 - remove ginkgo v1 reference
 - remove deprecated ginkgo table import
 - replace GinkgoParallelNode with GinkgoParallelProcess
 - bump ginkgo v2 to latest v2.9
 - fix an error "flag redefined ginkgo.seed". See more in onsi/ginkgo#875 (comment)

Signed-off-by: Rui Yang <ruiya@vmware.com>
Signed-off-by: Konstantin Troshin <k.troshin@fme.de>
  • Loading branch information
Rui Yang authored and Konstantin Troshin committed Jul 28, 2023
1 parent ef4474a commit 1da2eab
Show file tree
Hide file tree
Showing 39 changed files with 66 additions and 90 deletions.
1 change: 0 additions & 1 deletion atc/api/accessor/accessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package accessor_test

import (
"github.com/concourse/concourse/atc/atcfakes"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

Expand Down
1 change: 0 additions & 1 deletion atc/creds/conjur/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/concourse/concourse/atc/creds/conjur"
"github.com/jessevdk/go-flags"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
1 change: 0 additions & 1 deletion atc/creds/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/concourse/concourse/atc/creds"
"github.com/concourse/concourse/atc/creds/kubernetes"
"github.com/concourse/concourse/vars"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion atc/creds/load_var_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/concourse/concourse/atc/creds"
"github.com/concourse/concourse/vars"

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

Expand Down
1 change: 0 additions & 1 deletion atc/creds/secretsmanager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/concourse/concourse/atc/creds/secretsmanager"
"github.com/jessevdk/go-flags"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
1 change: 0 additions & 1 deletion atc/creds/ssm/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/concourse/concourse/atc/creds/ssm"
flags "github.com/jessevdk/go-flags"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
1 change: 0 additions & 1 deletion atc/creds/vault/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/jessevdk/go-flags"
"github.com/square/certstrap/pkix"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
1 change: 0 additions & 1 deletion atc/db/build_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"code.cloudfoundry.org/lager/lagerctx"
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/db"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/types"
Expand Down
5 changes: 2 additions & 3 deletions atc/db/notifications_bus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,7 @@ var _ = Describe("NotificationBus", func() {
Expect(err).NotTo(HaveOccurred())

close(done)
}, 5)

})
})

Context("when the notification channel fills up while unlistening", func() {
Expand All @@ -400,7 +399,7 @@ var _ = Describe("NotificationBus", func() {
Expect(err).NotTo(HaveOccurred())

close(done)
}, 5)
})
})
})
})
1 change: 0 additions & 1 deletion atc/db/worker_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/db"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
5 changes: 3 additions & 2 deletions atc/db/worker_resource_caches_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package db_test

import (
"time"

"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/db"
"github.com/concourse/concourse/atc/db/dbtest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"time"
)

var _ = Describe("WorkerResourceCaches", func() {
Expand Down
1 change: 0 additions & 1 deletion atc/db/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/concourse/concourse/atc"
. "github.com/concourse/concourse/atc/db"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/types"
Expand Down
1 change: 0 additions & 1 deletion atc/event/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package event_test
import (
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/event"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
2 changes: 1 addition & 1 deletion atc/integration/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var _ = BeforeEach(func() {
cmd.Server.ClientSecret = "client-secret"
cmd.Logger.LogLevel = "debug"
cmd.Logger.SetWriterSink(GinkgoWriter)
cmd.BindPort = 9090 + uint16(GinkgoParallelNode())
cmd.BindPort = 9090 + uint16(GinkgoParallelProcess())
cmd.DebugBindPort = 0

signingKey, err := rsa.GenerateKey(rand.Reader, 1024)
Expand Down
2 changes: 1 addition & 1 deletion atc/integration/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:

BeforeEach(func() {
var err error
tmp, err = ioutil.TempDir("", fmt.Sprintf("tmp-%d", GinkgoParallelNode()))
tmp, err = ioutil.TempDir("", fmt.Sprintf("tmp-%d", GinkgoParallelProcess()))
Expect(err).ToNot(HaveOccurred())
})

Expand Down
1 change: 0 additions & 1 deletion atc/metric/emitter/newrelic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/concourse/concourse/atc/metric"
"github.com/concourse/concourse/atc/metric/emitter"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/ghttp"
Expand Down
2 changes: 1 addition & 1 deletion atc/postgresrunner/ginkgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func GinkgoRunner(runner *Runner) none {

func InitializeRunnerForGinkgo(runner *Runner, dbProcess *ifrit.Process) {
*runner = Runner{
Port: 5433 + GinkgoParallelNode(),
Port: 5433 + GinkgoParallelProcess(),
}
*dbProcess = ifrit.Invoke(*runner)
runner.InitializeTestDBTemplate()
Expand Down
2 changes: 1 addition & 1 deletion atc/scheduler/algorithm/algorithm_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package algorithm_test

import (
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
)

var _ = DescribeTable("Input resolving",
Expand Down
2 changes: 1 addition & 1 deletion atc/scheduler/algorithm/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/json"

"github.com/concourse/concourse/atc"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
)

// NOTE: The purpose of these tests are to test the migration of build inputs
Expand Down
2 changes: 1 addition & 1 deletion atc/scheduler/algorithm/regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package algorithm_test

import (
"github.com/concourse/concourse/atc/db"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
)

var _ = DescribeTable("Regression tests",
Expand Down
2 changes: 1 addition & 1 deletion atc/scheduler/job_scheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/concourse/concourse/atc/db/dbfakes"
"github.com/concourse/concourse/atc/scheduler"
"github.com/concourse/concourse/atc/scheduler/schedulerfakes"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/concourse/concourse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ var _ = Describe("Web Command", func() {
"--tsa-host-key", hostKeyFile,
"--postgres-user", "postgres",
"--postgres-database", "testdb",
"--postgres-port", strconv.Itoa(5433+GinkgoParallelNode()),
"--postgres-port", strconv.Itoa(5433+GinkgoParallelProcess()),
"--main-team-local-user", "test",
"--add-local-user", "test:test",
"--debug-bind-port", strconv.Itoa(8000+GinkgoParallelNode()),
"--bind-port", strconv.Itoa(8080+GinkgoParallelNode()),
"--tsa-bind-port", strconv.Itoa(2222+GinkgoParallelNode()),
"--debug-bind-port", strconv.Itoa(8000+GinkgoParallelProcess()),
"--bind-port", strconv.Itoa(8080+GinkgoParallelProcess()),
"--tsa-bind-port", strconv.Itoa(2222+GinkgoParallelProcess()),
"--client-id", "client-id",
"--client-secret", "client-secret",
"--tsa-client-id", "tsa-client-id",
Expand Down
2 changes: 1 addition & 1 deletion fly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Fly is built using [Go](http://golang.org/). Building and testing fly is most ea
3. You can also now run tests by installing and running [ginkgo](http://onsi.github.io/ginkgo/):

```bash
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/ginkgo/v2/ginkgo
ginkgo -r
```

Expand Down
1 change: 0 additions & 1 deletion fly/integration/error_handling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net/http"
"os/exec"

. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
Expand Down
2 changes: 1 addition & 1 deletion fly/scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ not_installed() {

if not_installed ginkgo; then
echo "# ginkgo is not installed! run the following command:"
echo " go install github.com/onsi/ginkgo/ginkgo"
echo " go install github.com/onsi/ginkgo/v2/ginkgo"
exit 1
fi

Expand Down
21 changes: 12 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ require (
github.com/miekg/dns v1.1.50
github.com/mitchellh/mapstructure v1.5.0
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.6.1
github.com/onsi/gomega v1.24.2
github.com/onsi/ginkgo/v2 v2.9.0
github.com/onsi/gomega v1.27.1
github.com/opencontainers/runc v1.1.4
github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78
github.com/patrickmn/go-cache v2.1.0+incompatible
Expand Down Expand Up @@ -87,7 +86,7 @@ require (
golang.org/x/crypto v0.5.0
golang.org/x/oauth2 v0.3.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.4.0
golang.org/x/sys v0.5.0
golang.org/x/time v0.3.0
google.golang.org/grpc v1.51.0
gopkg.in/square/go-jose.v2 v2.6.0
Expand Down Expand Up @@ -189,11 +188,11 @@ require (
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/tools v0.5.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.99.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down Expand Up @@ -227,16 +226,20 @@ require (
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
go.step.sm/crypto v0.16.2 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/exp v0.0.0-20221004215720-b9f4876ce741 // indirect
)

replace github.com/onsi/ginkgo => github.com/phil9909/ginkgo v1.16.6-0.20220211153547-67da0e38b07d
Loading

0 comments on commit 1da2eab

Please sign in to comment.