Skip to content

Commit

Permalink
Mention release candidate and deprecate GinkgoParallelNode in favor o…
Browse files Browse the repository at this point in the history
…f GinkgoParallelProcess
  • Loading branch information
onsi committed Oct 11, 2021
1 parent d8e9d10 commit b55f80d
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Jump to the [docs](https://onsi.github.io/ginkgo/) | [中文文档](https://ke-c

If you have a question, comment, bug report, feature request, etc. please open a GitHub issue, or visit the [Ginkgo Slack channel](https://app.slack.com/client/T029RQSE6/CQQ50BBNW).

# Ginkgo 2.0 beta is available!
# Ginkgo 2.0 Release Candidate is available!

An effort is underway to develop and deliver Ginkgo 2.0. The work is happening in the [ver2](https://github.com/onsi/ginkgo/tree/ver2) branch and a changelog and migration guide is being maintained on that branch [here](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md). Issue [#711](https://github.com/onsi/ginkgo/issues/711) is the central place for discussion.

As described in the [changelog](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md) and [proposal](https://docs.google.com/document/d/1h28ZknXRsTLPNNiOjdHIO-F2toCzq4xoZDXbfYaBdoQ/edit#), Ginkgo 2.0 will clean up the Ginkgo codebase, deprecate and remove some v1 functionality, and add several new much-requested features. To help users get ready for the migration, Ginkgo v1 has started emitting deprecation warnings for features that will no longer be supported with links to documentation for how to migrate away from these features. If you have concerns or comments please chime in on [#711](https://github.com/onsi/ginkgo/issues/711).

Please start exploring and using the V2 release! To get started follow the [Using the Beta](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta) directions in the migration guide.
Please start exploring and using the V2 release! To get started follow the [Using the Release Candidate](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta) directions in the migration guide.

## TLDR
Ginkgo builds on Go's `testing` package, allowing expressive [Behavior-Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) ("BDD") style tests.
Expand Down
1 change: 1 addition & 0 deletions ginkgo/bootstrap_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func BuildBootstrapCommand() *Command {
},
Command: func(args []string, additionalArgs []string) {
generateBootstrap(agouti, noDot, internal, customBootstrapFile)
emitRCAdvertisement()
},
}
}
Expand Down
1 change: 1 addition & 0 deletions ginkgo/generate_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func BuildGenerateCommand() *Command {
},
Command: func(args []string, additionalArgs []string) {
generateSpec(args, agouti, noDot, internal, customTestFile)
emitRCAdvertisement()
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions ginkgo/help_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ func BuildHelpCommand() *Command {
func printHelp(args []string, additionalArgs []string) {
if len(args) == 0 {
usage()
emitRCAdvertisement()
} else {
command, found := commandMatching(args[0])
if !found {
complainAndQuit(fmt.Sprintf("Unknown command: %s", args[0]))
}

usageForCommand(command, true)
emitRCAdvertisement()
}
}
29 changes: 29 additions & 0 deletions ginkgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/formatter"
"github.com/onsi/ginkgo/ginkgo/testsuite"
)

Expand Down Expand Up @@ -243,6 +245,7 @@ func usageForCommand(command *Command, longForm bool) {

func complainAndQuit(complaint string) {
fmt.Fprintf(os.Stderr, "%s\nFor usage instructions:\n\tginkgo help\n", complaint)
emitRCAdvertisement()
os.Exit(1)
}

Expand Down Expand Up @@ -306,3 +309,29 @@ func pluralizedWord(singular, plural string, count int) string {
}
return plural
}

func emitRCAdvertisement() {
ackRC := os.Getenv("ACK_GINKGO_RC")
if ackRC != "" {
return
}
home, err := os.UserHomeDir()
if err == nil {
_, err := os.Stat(filepath.Join(home, ".ack-ginkgo-rc"))
if err == nil {
return
}
}

out := formatter.F("\n{{light-yellow}}Ginkgo 2.0 is coming soon!{{/}}\n")
out += formatter.F("{{light-yellow}}=========================={{/}}\n")
out += formatter.F("{{bold}}{{green}}Ginkgo 2.0{{/}} is under active development and will introduce several new features, improvements, and a small handful of breaking changes.\n")
out += formatter.F("A release candidate for 2.0 is now available and 2.0 should GA in Fall 2021. {{bold}}Please give the RC a try and send us feedback!{{/}}\n")
out += formatter.F(" - To learn more, view the migration guide at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md{{/}}\n")
out += formatter.F(" - For instructions on using the Release Candidate visit {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta{{/}}\n")
out += formatter.F(" - To comment, chime in at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}\n\n")
out += formatter.F("To {{bold}}{{coral}}silence this notice{{/}}, set the environment variable: {{bold}}ACK_GINKGO_RC=true{{/}}\n")
out += formatter.F("Alternatively you can: {{bold}}touch $HOME/.ack-ginkgo-rc{{/}}")

fmt.Println(out)
}
1 change: 1 addition & 0 deletions ginkgo/run_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func (r *SpecRunner) RunSpecs(args []string, additionalArgs []string) {
}
} else {
fmt.Printf("Test Suite Failed\n")
emitRCAdvertisement()
os.Exit(1)
}
}
Expand Down
1 change: 1 addition & 0 deletions ginkgo/version_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ func BuildVersionCommand() *Command {

func printVersion([]string, []string) {
fmt.Printf("Ginkgo Version %s\n", config.VERSION)
emitRCAdvertisement()
}
10 changes: 8 additions & 2 deletions ginkgo_dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ func GinkgoRandomSeed() int64 {
return config.GinkgoConfig.RandomSeed
}

//GinkgoParallelNode returns the parallel node number for the current ginkgo process
//The node number is 1-indexed
//GinkgoParallelNode is deprecated, use GinkgoParallelProcess instead
func GinkgoParallelNode() int {
deprecationTracker.TrackDeprecation(types.Deprecations.ParallelNode(), codelocation.New(1))
return GinkgoParallelProcess()
}

//GinkgoParallelProcess returns the parallel process number for the current ginkgo process
//The process number is 1-indexed
func GinkgoParallelProcess() int {
return config.GinkgoConfig.ParallelNode
}

Expand Down
1 change: 1 addition & 0 deletions internal/writer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var _ = Describe("Writer", func() {
It("should stream directly to the outbuffer by default", func() {
writer.Write([]byte("foo"))
Ω(out).Should(gbytes.Say("foo"))
Fail("boom")
})

It("should not emit the header when asked to DumpOutWitHeader", func() {
Expand Down
16 changes: 13 additions & 3 deletions types/deprecation_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ func (d deprecations) Measure() Deprecation {
}
}

func (d deprecations) ParallelNode() Deprecation {
return Deprecation{
Message: "GinkgoParallelNode is deprecated and will be removed in Ginkgo V2. Please use GinkgoParallelProcess instead.",
DocLink: "renamed-ginkgoparallelnode",
Version: "1.16.5",
}
}

func (d deprecations) Convert() Deprecation {
return Deprecation{
Message: "The convert command is deprecated in Ginkgo V2",
Expand Down Expand Up @@ -101,9 +109,11 @@ func (d *DeprecationTracker) DidTrackDeprecations() bool {
func (d *DeprecationTracker) DeprecationsReport() string {
out := formatter.F("{{light-yellow}}You're using deprecated Ginkgo functionality:{{/}}\n")
out += formatter.F("{{light-yellow}}============================================={{/}}\n")
out += formatter.F("Ginkgo 2.0 is under active development and will introduce (a small number of) breaking changes.\n")
out += formatter.F("To learn more, view the migration guide at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md{{/}}\n")
out += formatter.F("To comment, chime in at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}\n\n")
out += formatter.F("{{bold}}{{green}}Ginkgo 2.0{{/}} is under active development and will introduce several new features, improvements, and a small handful of breaking changes.\n")
out += formatter.F("A release candidate for 2.0 is now available and 2.0 should GA in Fall 2021. {{bold}}Please give the RC a try and send us feedback!{{/}}\n")
out += formatter.F(" - To learn more, view the migration guide at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md{{/}}\n")
out += formatter.F(" - For instructions on using the Release Candidate visit {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta{{/}}\n")
out += formatter.F(" - To comment, chime in at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}\n\n")

for deprecation, locations := range d.deprecations {
out += formatter.Fi(1, "{{yellow}}"+deprecation.Message+"{{/}}\n")
Expand Down

0 comments on commit b55f80d

Please sign in to comment.