Skip to content

testserver: fix URL file polling code#181

Merged
RaduBerinde merged 1 commit intomasterfrom
radu/fix-poll
May 19, 2025
Merged

testserver: fix URL file polling code#181
RaduBerinde merged 1 commit intomasterfrom
radu/fix-poll

Conversation

@RaduBerinde
Copy link
Copy Markdown
Member

The asynchronous code that polls for the URL file leads to very opaque failures. This change reworks this code to waiting synchronously, so that we know the server is started before we return. In cases of failure, we now get more useful errors.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

} else if !os.IsNotExist(err) {
return fmt.Errorf("unexpected error while reading listening URL file: %w", err)
}
if err != nil && !os.IsNotExist(err) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: left conjunct is a tautology, it can be dropped.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's not, when data is empty. I'll refactor a bit so it's less subtle.

TFTR!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Right, 🤦 .

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Cleaned it up a little.

The asynchronous code that polls for the URL file leads to very opaque
failures. This change reworks this code to waiting synchronously, so
that we know the server is started before we return. In cases of
failure, we now get more useful errors.
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