ginkgo
ginkgo copied to clipboard
feature proposal: WhenTable
I very much would like DescribeTable
to behave like a container, e.g.
DescribeTable("a k8s heartbeat request arrives",
func(endStream bool) {
It("is ignored when processing downstream headers", func() {
status := filter.DecodeHeaders(reqH, endStream)
Ω(status).Should(Equal(api.Continue))
})
It("is ignored when processing downstream data", func() {
buffer := mockenvoy.NewBufferInstance(GinkgoT())
status := filter.DecodeData(buffer, endStream)
Ω(status).Should(Equal(api.Continue))
})
},
Entry("stream is still live", false),
Entry("stream has ended", true),
)
But that won't work for obvious reasons. I proposed we add WhenTable
:
WhenTable("a k8s heartbeat request arrives",
func(endStream bool) {
It("is ignored when processing downstream headers", func() {
status := filter.DecodeHeaders(reqH, endStream)
Ω(status).Should(Equal(api.Continue))
})
It("is ignored when processing downstream data", func() {
buffer := mockenvoy.NewBufferInstance(GinkgoT())
status := filter.DecodeData(buffer, endStream)
Ω(status).Should(Equal(api.Continue))
})
},
Entry("stream is still live", false),
Entry("stream has ended", true),
)
Hi @maguro. Have you thought about dynamically generating specs? It’s something that you could do right now without waiting for a feature to be implemented.
https://onsi.github.io/ginkgo/#dynamically-generating-specs
hey @maguro this sounds like a great idea. i took a look and it was actually relatively easy to implement. I've added DescribeTableSubtree
- please take a look at the latest commit on master and the docs here and let me know what you think. I'd love it if you could give it a try and make sure it works for you before I cut a release.