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

test: update wait for statement for postgres #11309

Merged
merged 2 commits into from
Jun 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/inputs/postgresql/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ func launchTestContainer(t *testing.T) *testutil.Container {
"POSTGRES_HOST_AUTH_METHOD": "trust",
},
WaitingFor: wait.ForAll(
wait.ForLog("database system is ready to accept connections"),
// the database comes up twice, once right away, then again a second
// time after the docker entrypoint starts configuraiton
wait.ForLog("database system is ready to accept connections").WithOccurrence(2),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment here explaining why its expected for this message to occur twice? (same as you wrote in the PR description)

Do you know if there is a chance for the log message "database system is ready to accept connections" to occur less then twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

My preference is for it to show up once, however, there doesn't appear to be a configuration setting to let us do it that way that I noticed.

wait.ForListeningPort(nat.Port(servicePort)),
),
}
Expand Down