Skip to content

How can I embed tests into my binary with ginkgo/v2 to have a command that runs them in parallel #1529

@tnozicka

Description

@tnozicka

Hi @onsi,

thank you for building such a great framework! 🙇

For a long time, since I bumped into ginkgo in Kubernetes, this is my choice for e2e tests in Golang, often also targeting Kubernetes clusters. In the days of ginkgo/v1, OpenShift (a distribution of Kubernetes) and some other projects started shipping embedded tests suites in their binaries, so these tests can be run from a container image. With that, you can run a container in a Kubernetes cluster (or locally) and assess whether say the conformance tests pass or something is broken. Obviously, at that place you can't run ginkgo CLI with a path to the source code (which is not there) and you kind of also want to wrap the CLI into something that defines suites / presets some focus strings and such.

I haven't figured out how to reuse the ginkgo/v2 facilities to build something similar without rewriting or hacking ginkgo. Effectively, all the parallel abstractions are hidden in internal/parallel_support which can't be vendored, so it's very hard to rebuild running tests in parallel.

What I've seen done (or done myself) was:
a) instead of vendoring, copy and rename the internal package and duplicate the command execution logic 😞
https://github.com/scylladb/scylla-operator/blob/67c1ce99a003ec530da47f5d711f7888825b41aa/pkg/cmd/tests/tests_run.go#L233-L432
b) OpenShift has build a custom parallel queue
https://github.com/openshift/origin/blob/0060ccdd4d01b70980ee8b8108829e16b8714fa7/pkg/test/ginkgo/cmd_runsuite.go#L368-L369

Is there a chance some of these abstraction could be exposed so people don't have to suffer through rebuilding this?

Or am I missing how this could be done with the existing code base?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions