[go: nahoru, domu]

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

revamp triggers end-to-end functional test #2178

Merged
merged 11 commits into from
Apr 27, 2020
Merged

revamp triggers end-to-end functional test #2178

merged 11 commits into from
Apr 27, 2020

Conversation

bkendall
Copy link
Contributor

Description

Rewriting the triggers-end-to-end tests to be in Typescript in the new form that has been working really well in other tests.

@googlebot googlebot added the cla: yes Manual indication that this has passed CLA. label Apr 25, 2020
@bkendall bkendall requested a review from samtstern April 27, 2020 15:27
@bkendall bkendall changed the title Bk end to end revamp triggers end-to-end functional test Apr 27, 2020
@bkendall bkendall marked this pull request as ready for review April 27, 2020 15:27
Copy link
Contributor
@samtstern samtstern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass seems totally fine to me! Esp if it still passes CI, which it looks like it does.

if (logDoneFn) {
started = new Promise((resolve) => {
this.process?.stdout.on("data", (data: unknown) => {
if (logDoneFn(data)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this hang forever? Shouldn't we still resolve on close?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of code tricked me the first time. If we have this function, we make this resolving promise. If we don't, we do one on 'close' below.

Basically, logDoneFn looks for a string in the data that comes through and says "started" when that happens (logDoneFn is user-supplied). If that fn isn't provided, it just waits until the process closes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but what if logDoneFn(data) never returns true? Then the function will never hit resolve()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. After a quick discussion, we're going to reject if logDoneFn never succeeds :)

scripts/triggers-end-to-end-tests/cli.ts Outdated Show resolved Hide resolved
scripts/triggers-end-to-end-tests/framework.ts Outdated Show resolved Hide resolved
scripts/triggers-end-to-end-tests/run.sh Outdated Show resolved Hide resolved
scripts/triggers-end-to-end-tests/tests.ts Show resolved Hide resolved
@bkendall bkendall requested a review from samtstern April 27, 2020 16:52
Copy link
Contributor
@samtstern samtstern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with one comment about logDoneFn

@bkendall bkendall merged commit fd199e3 into master Apr 27, 2020
@bkendall bkendall deleted the bk-end-to-end branch April 27, 2020 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants