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

acceptance: deflake TestDockerCLI/test_txn_prompt #91249

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

renatolabs
Copy link
Collaborator

That test would sometimes fail because of the semantics of expect and send when the expected string was previously written using send.

When expect is called, the buffer looked at includes content previously sent using send. This means that if one runs send "foo"; expect foo, the expect call will match instataneously even if the program's output after the send does not contain foo.

In the case of the test fixed here, we are supposed to expect for the new prompt to be printed after setting it with \set prompt1. In order to properly check whether the prompt changed, this PR changes the prompt expect call to use a regular expression that matches the new prompt only if it sits in the beginning of a line.

Prior to this commit, since the expect call would return immediately, there was a chance the send "SET DATABASE" command could run before the cockroach CLI had the chance to print the new prompt, leading to the following error:

abcdefaultdbdef \set prompt1 woo
SET database
woo  ->
.221103 18:13:35.539667600 EXPECT TEST: TIMEOUT WAITING FOR "
 -> "
non-zero exit code: 1

Epic: None
Release note: None

That test would sometimes fail because of the semantics of `expect`
and `send` when the expected string was previously written using
`send`.

When `expect` is called, the buffer looked at includes content
previously sent using `send`. This means that if one runs `send "foo";
expect foo`, the `expect` call will match instataneously even if the
program's output after the send does not contain `foo`.

In the case of the test fixed here, we are supposed to expect for the
new prompt to be printed after setting it with `\set prompt1`. In
order to properly check whether the prompt changed, this PR changes
the prompt `expect` call to use a regular expression that matches the
new prompt only if it sits in the beginning of a line.

Prior to this commit, since the `expect` call would return
immediately, there was a chance the `send "SET DATABASE"` command
could run before the cockroach CLI had the chance to print the new
prompt, leading to the following error:

```
abcdefaultdbdef \set prompt1 woo
SET database
woo  ->
.221103 18:13:35.539667600 EXPECT TEST: TIMEOUT WAITING FOR "
 -> "
non-zero exit code: 1
```

Epic: None
Release note: None
@renatolabs renatolabs requested a review from a team November 3, 2022 22:09
@renatolabs renatolabs requested a review from a team as a code owner November 3, 2022 22:09
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@renatolabs
Copy link
Collaborator Author

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

thanks!

@renatolabs
Copy link
Collaborator Author

bors r=rafiss

TFTR!

@craig craig bot merged commit 2e90394 into cockroachdb:master Nov 8, 2022
@craig
Copy link
Contributor

craig bot commented Nov 8, 2022

Build succeeded:

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

Successfully merging this pull request may close these issues.

3 participants