Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature proposal: WhenTable #1324

Open
maguro opened this issue Dec 23, 2023 · 2 comments
Open

feature proposal: WhenTable #1324

maguro opened this issue Dec 23, 2023 · 2 comments

Comments

@maguro
Copy link

maguro commented Dec 23, 2023

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),
)
@blgm
Copy link
Collaborator

blgm commented Dec 24, 2023

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

@onsi
Copy link
Owner

onsi commented Dec 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants