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

Issue 344 tests #385

Merged
merged 9 commits into from
Jan 3, 2022
Merged

Issue 344 tests #385

merged 9 commits into from
Jan 3, 2022

Conversation

zozlak
Copy link
Contributor

@zozlak zozlak commented Dec 21, 2021

The issue 244 concerned queries taking longer than 1 second (queries
where the`select()` timeout is reached). Test description and pg_sleep()
timining adjusted to test such a scenario.
The query interrupt test extended with a check probing if the request
has been cancelled on the database server. The test is based on the PID
of the connection so it should be reliable.
Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

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

Thanks. The tests are failing now.

#244 was about short queries that still waited for one second. What is the new test testing?

@@ -1,9 +1,9 @@
context("checkInterrupts")

test_that("check_interrupts = TRUE works with queries < 1 second (#244)", {
test_that("check_interrupts = TRUE works with queries > 1 second (#244)", {
Copy link
Member

Choose a reason for hiding this comment

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

The original test is good. Can you please create a new test?

Should the test condition be expect_lt(time[["elapsed"]], 0.9) then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we claim this is a test for #244, it should definitely test a query longer than 1 second because the #244 was caused by a fact that the structure taken by the select() requires different reinitialization under linux and windows, after the select() timeout is reached (and we hardcode the timeout to 1 second).

Of course I can also add another test with query shorter than 1 second, just then we shouldn't claim it tests #244.

Copy link
Member

@krlmlr krlmlr Dec 28, 2021

Choose a reason for hiding this comment

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

Maybe the reference to #244 is wrong, I'd need to take a closer look. Either way, can you please keep the original test?

Copy link
Member

Choose a reason for hiding this comment

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

The new test is failing, btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, restored the old removing the reference to #244 and added the > 1 second one with the reference to #244 and fixed check condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, the test CI failed on the "update snapshots" step - I have no idea what does it mean.
When I run tests locally all pass but (test-checkInterrupts.R:50:3): check_interrupts = TRUE interrupts immediately (#336) (which means the query isn't cancelled on the server side when the interrupt breaks dbGetQuery()).

@krlmlr krlmlr merged commit 5eced0c into r-dbi:main Jan 3, 2022
@krlmlr
Copy link
Member

krlmlr commented Jan 3, 2022

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants