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

Fail within ginko testing not os.Exit(1) #316

Closed
cdrage opened this issue Apr 5, 2018 · 4 comments
Closed

Fail within ginko testing not os.Exit(1) #316

cdrage opened this issue Apr 5, 2018 · 4 comments
Labels
area/testing Issues or PRs related to testing, Quality Assurance or Quality Engineering priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).

Comments

@cdrage
Copy link
Member

cdrage commented Apr 5, 2018

We should be failing using: https://onsi.github.io/ginkgo/#marking-specs-as-failed within our end-to-end tests rather than using: https://github.com/redhat-developer/ocdev/blob/master/tests/e2e/e2e_test.go#L41

I suggest that we modify https://github.com/redhat-developer/ocdev/blob/master/tests/e2e/e2e_test.go#L28 to return err and if it errors, use Fail("Failure reason") with the stderr output from the ocdev command.

@cdrage
Copy link
Member Author

cdrage commented Apr 5, 2018

ping @ashetty1

@kadel kadel added kind/task priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). area/testing Issues or PRs related to testing, Quality Assurance or Quality Engineering labels Apr 5, 2018
@cdrage
Copy link
Member Author

cdrage commented Apr 5, 2018

Just had a discussion with @ashetty1 on bluejeans, So after looking at this issue: onsi/gomega#115

I think we should consider using / trying out this code:

command := exec.Command(pathToLs, "")
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())

commandReal := exec.Command("ls")
sessionReal, err := gexec.Start(commandReal, GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())

session.Wait() // waits for the session to exit
Eventually(sessionReal).Should(gexec.Exit(0)) // equivalent to `session.Wait()` but allows you to assert on exit code

Ω(session.Out.Contents()).Should(Equal(sessionReal.Out.Contents()))

and see if it helps. Seems to fit our use-case exactly and makes things a bit more simpler instead of using runCmd()

@kadel
Copy link
Member

kadel commented Apr 5, 2018

When this issue gets fixed, please remove the verbose flag that was added in #308.

@cdrage
Copy link
Member Author

cdrage commented Apr 11, 2018

Closing this as #320 was merged and then #322 (to remove the verbose output).

Closing this issue!

@cdrage cdrage closed this as completed Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Issues or PRs related to testing, Quality Assurance or Quality Engineering priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects
None yet
Development

No branches or pull requests

2 participants