Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/sanity: support sanity testing in another Ginkgo suite
This was not possible before: - Ginkgo only supports one set of Before/AfterSuite calls, which might be in use already in the existing suite (for example, the Kubernetes e2e framework). - When nesting the sanity test inside a Ginkgo spec there is no testing.T pointer that could be passed to the Test method. Now all global variables are replaced with a test context that gets passed into the specs explicitly. For this to work, specs must be set up with SanityDescribe instead of the previous Describe call. The Test and Config API are unchanged, but there is one slight change of behavior: previously it was possible to define two tests with different configs in the same test binary and then running each test would execute the sanity tests for that config. That no longer works because running one test changes the global Ginkgo suite and running the second test would then also run the specs from the first one. This usage could be supported by having one test function which takes multiple configs, then runs one suite that contains tests for all of them. Probably it is easier to just use a Ginkgo suite, because there multiple different configs can be handled already normally via different Describe specs: calling the new GinkgoTest API will add all sanity test cases for one configuration to the spec in which the API is called.
- Loading branch information