You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On DescribeTable when adding a context parameter, and a pointer parameter, if the parameter is nil, the test exit with panic.
This example reproduces the issue (note: this is the simplest reproduction I found. This is why the context is not in use; but this is happening also if the context is in use).
When running the test, it fails for building the tree:
Assertion or Panic detected during tree construction
DescribeTable("table with ctx", func(ctx context.Context, num *int, s string) {
/home/nunnatsa/GIT/ginkgo-test/tests/ttt_test.go:31
Ginkgo detected a panic while constructing the spec tree.
You may be trying to make an assertion in the body of a container node
(i.e. Describe, Context, or When).
Please ensure all assertions are inside leaf nodes such as BeforeEach,
It, etc.
Here's the content of the panic that was caught:
runtime error: invalid memory address or nil pointer dereference
Learn more at: http://onsi.github.io/ginkgo/#no-assertions-in-container-nodes
Notes:
This is not happening if num is not a pointer.
This is not happening if there is no context parameter.
Additional info:
The cause is the nil parameter in the first Entry.
entry.parameters[0] is nil, so reflect.TypeOf(entry.parameters[0]) is also nil, and then reflect.TypeOf(entry.parameters[0]).Implements(contextType)) panics.
The text was updated successfully, but these errors were encountered:
On
DescribeTable
when adding a context parameter, and a pointer parameter, if the parameter is nil, the test exit with panic.This example reproduces the issue (note: this is the simplest reproduction I found. This is why the context is not in use; but this is happening also if the context is in use).
When running the test, it fails for building the tree:
Notes:
Additional info:
The cause is the
nil
parameter in the firstEntry
.The panic is from here:
ginkgo/table_dsl.go
Line 275 in fcf1fd7
entry.parameters[0]
isnil
, soreflect.TypeOf(entry.parameters[0])
is alsonil
, and thenreflect.TypeOf(entry.parameters[0]).Implements(contextType))
panics.The text was updated successfully, but these errors were encountered: