onsi / ginkgo

A Modern Testing Framework for Go

Home Page:http://onsi.github.io/ginkgo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gingko confused about -ginkgo.timeout flag and won't run tests

talbright opened this issue · comments

Ginkgo won't run tests:

❯ ginkgo --help
Ginkgo Version 2.1.3
--------------------

❯ ginkgo -r
flag provided but not defined: -ginkgo.timeout
...
  -ginkgo.debug
    	If set, ginkgo will emit node output to files when running in parallel.
  -ginkgo.dryRun
    	If set, ginkgo will walk the test hierarchy without actually running anything.  Best paired with -v.
  -ginkgo.failFast
    	If set, ginkgo will stop running a test suite after a failure occurs.
...

❯ ginkgo run -ginkgo.timeout 30
ginkgo run failed
  flag provided but not defined: -ginkgo.timeout

Tests run fine with go test:

❯ TEST_ACC=1 go test -v -count=1 -parallel=1 -timeout=1200s ./test/acc
=== RUN   TestAcceptance
Running Suite: acc
==================
Random Seed: 1647178678
Will run 1 of 1 specs

acceptance test directory: /var/folders/xw/21wr_gb13bq2vx4p9t45d9180000gp/T/gexec_artifacts4209162405/g1283325953
•
Ran 1 of 1 Specs in 4.468 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestAcceptance (4.47s)

hey there - it looks like you are using the V2 CLI but your test suite is written with Ginkgo V1. You need to use the major version of the CLI that matches the version of the library imported by your suite.

Oh geeze...thanks!

I really believe there ought to be an easy way to make this error a lot clearer (along with a clear way to install v1 instead of the default v2 now) as it is likely to confuse a lot of folks coming from v1.

BTW that oh geeze was too myself not realizing the mismatch...not a complaint 😉

The error was fairly confusing though.

Regardless, thanks for the help!

ummm... I have now removed v2 and the binary ginkgo but it seems like that now running go get github.com/onsi/ginkgo gives me back the pkg folder etc. but I cannot get the binary back - any suggestions?

Thanks!

the v1 cli lives github.com/onsi/ginkgo/ginkgo

i can imagine the v2 cli identifying that you are running it against a v1 repo and emitting a more useful warning. that could be something i add in the next v2 release.

Thanks for the super-quick reply!

and, LoL, being the idiot I am, I hadn't realized that "onsi" was an actual person 😆
Ginkgo is absolutely awesome, and I just love ❤️ ginkgo -watch!
Thanks for developing it!

Ok - maybe I'm missing something here:

└─( ll $GOPATH/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo
total 192
-r--r--r--  1 massenz  staff   4.8K Mar 22 16:41 bootstrap_command.go
-r--r--r--  1 massenz  staff   1.6K Mar 22 16:41 build_command.go
dr-xr-xr-x  8 massenz  staff   256B Mar 22 16:41 convert
-r--r--r--  1 massenz  staff   1.2K Mar 22 16:41 convert_command.go
-r--r--r--  1 massenz  staff   6.5K Mar 22 16:41 generate_command.go
-r--r--r--  1 massenz  staff   688B Mar 22 16:41 help_command.go
dr-xr-xr-x  5 massenz  staff   160B Mar 22 16:41 interrupthandler
-r--r--r--  1 massenz  staff   9.2K Mar 22 16:41 main.go
dr-xr-xr-x  5 massenz  staff   160B Mar 22 16:41 nodot
-r--r--r--  1 massenz  staff   1.9K Mar 22 16:41 nodot_command.go
-r--r--r--  1 massenz  staff   3.5K Mar 22 16:41 notifications.go
dr-xr-xr-x  8 massenz  staff   256B Mar 22 16:41 outline
-r--r--r--  1 massenz  staff   2.1K Mar 22 16:41 outline_command.go
-r--r--r--  1 massenz  staff   8.7K Mar 22 16:41 run_command.go
-r--r--r--  1 massenz  staff   7.6K Mar 22 16:41 run_watch_and_build_command_flags.go
-r--r--r--  1 massenz  staff   5.3K Mar 22 16:41 suite_runner.go
dr-xr-xr-x  8 massenz  staff   256B Mar 22 16:41 testrunner
dr-xr-xr-x  8 massenz  staff   256B Mar 22 16:41 testsuite
-r--r--r--  1 massenz  staff   3.8K Mar 22 16:41 unfocus_command.go
-r--r--r--  1 massenz  staff   454B Mar 22 16:41 version_command.go
dr-xr-xr-x  8 massenz  staff   256B Mar 22 16:41 watch
-r--r--r--  1 massenz  staff   5.4K Mar 22 16:41 watch_command.go

I can see main.go but if I (blindly) just try and build it, I get a bunch of errors:

└─( go build -o $GOPATH/bin/ginkgo  $GOPATH/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go
# command-line-arguments
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:172:19: undefined: BuildRunCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:173:30: undefined: BuildWatchCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:174:30: undefined: BuildBuildCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:175:30: undefined: BuildBootstrapCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:176:30: undefined: BuildGenerateCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:177:30: undefined: BuildNodotCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:178:30: undefined: BuildConvertCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:179:30: undefined: BuildUnfocusCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:180:30: undefined: BuildVersionCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:181:30: undefined: BuildHelpCommand
../../../.local/go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/main.go:181:30: too many errors

Did I misunderstand and you meant somewhere else?
(it's not in this repo, or in the source code tarball at v 1.16.5)

thanks for the kind words y'all. and sorry installing things is giving you trouble.

I just ran:

~ » mkdir foo
~ » cd foo
~/foo » go mod init example.com/foo
go: creating new go.mod: module example.com/foo
~/foo » go get github.com/onsi/ginkgo@v1.16.5
go get: added github.com/fsnotify/fsnotify v1.4.9
go get: added github.com/nxadm/tail v1.4.8
go get: added github.com/onsi/ginkgo v1.16.5
go get: added golang.org/x/sys v0.0.0-20210112080510-489259a85091
go get: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
~/foo » go install github.com/onsi/ginkgo/ginkgo
../go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/bootstrap_command.go:15:2: missing go.sum entry for module providing package github.com/go-task/slim-sprig (imported by github.com/onsi/ginkgo/ginkgo); to add:
	go get github.com/onsi/ginkgo/ginkgo@v1.16.5
../go/pkg/mod/github.com/onsi/ginkgo@v1.16.5/ginkgo/outline/outline.go:10:2: missing go.sum entry for module providing package golang.org/x/tools/go/ast/inspector (imported by github.com/onsi/ginkgo/ginkgo/outline); to add:
	go get github.com/onsi/ginkgo/ginkgo/outline@v1.16.5
~/foo » go get github.com/onsi/ginkgo/ginkgo@v1.16.5
go get: installing executables with 'go get' in module mode is deprecated.
	To adjust and download dependencies of the current module, use 'go get -d'.
	To install using requirements of the current module, use 'go install'.
	To install ignoring the current module, use 'go install' with a version,
	like 'go install example.com/cmd@latest'.
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.
~/foo » go install github.com/onsi/ginkgo/ginkgo
~/foo » ginkgo version
Ginkgo Version 1.16.5

Ginkgo 2.0 is coming soon!
==========================
Ginkgo 2.0 is under active development and will introduce several new features, improvements, and a small handful of breaking changes.
A release candidate for 2.0 is now available and 2.0 should GA in Fall 2021.  Please give the RC a try and send us feedback!
  - To learn more, view the migration guide at https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md
  - For instructions on using the Release Candidate visit https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta
  - To comment, chime in at https://github.com/onsi/ginkgo/issues/711

To silence this notice, set the environment variable: ACK_GINKGO_RC=true
Alternatively you can: touch $HOME/.ack-ginkgo-rc

and got things to install. I'm not using $GOPATH (it's been years since I last did...) but I imagine things should work just fine

Thanks!
This worked, these were the missing magic incantations:

└─( go get github.com/onsi/ginkgo/ginkgo@v1.16.5

└─( go install github.com/onsi/ginkgo/ginkgo

(the "double" ginkgo)