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

Add config to silence ActiveRecord output in tests #27

Merged

Conversation

eeklund
Copy link
Contributor

@eeklund eeklund commented Oct 3, 2024

Several tests have messages from ActiveRecord that inject into the RSpec test output. This removes those notifications to ensure clear test result output without the multi-line noise. Some of the messaging comes from #26 (parallel PR), others from #7.

When the test suite begins, the value of
ActiveRecord::Migration.verbose is captured and then set to false. After the suite is done running the initial value is reinstated.

Examples of messages silenced:

-- create_view("multi_newline_and_semicolon", {:sql_definition=>"      select\n        3 as fancy_c\n      from\n        dual\n"})
   -> 0.0015s
   -> 0 rows
-- create_view("multiline_internal_indented", {:sql_definition=>"      SELECT\n          1 AS fancy_a,\n          CASE\n              WHEN 1=1 THEN 'Y'\n              ELSE 'N'\n          END AS fancy_b\n      FROM\n          dual\n"})
   -> 0.0011s
   -> 0 rows
-- create_view("multiline_left_justified", {:sql_definition=>"      select\n      1 as a\n      from\n      dual\n"})
   -> 0.0010s
   -> 0 rows
.   -> index 'THINGS_ID' on 'THINGS' has been recreated
   -> index 'THINGS_NAME' on 'THINGS' has been recreated
.   -> index 'THINGS_ID' on 'THINGS' has been recreated
   -> index 'THINGS_NAME' on 'THINGS' is no longer valid and has been dropped.

Co-authored-by: Davin Lagerroos dlagerro@umn.edu
Co-authored-by: Eric Eklund eeklund@umn.edu

Several tests have messages from ActiveRecord that inject into the RSpec
test output. This removes those notifications to ensure clear test
result output without the multi-line noise. Some of the messaging comes
from cdinger#26 (parallel PR), others from cdinger#7.

When the test suite begins, the value of
`ActiveRecord::Migration.verbose` is captured and then set to `false`.
After the suite is done running the initial value is reinstated.

Examples of messages silenced:
```
-- create_view("multi_newline_and_semicolon", {:sql_definition=>"      select\n        3 as fancy_c\n      from\n        dual\n"})
   -> 0.0015s
   -> 0 rows
-- create_view("multiline_internal_indented", {:sql_definition=>"      SELECT\n          1 AS fancy_a,\n          CASE\n              WHEN 1=1 THEN 'Y'\n              ELSE 'N'\n          END AS fancy_b\n      FROM\n          dual\n"})
   -> 0.0011s
   -> 0 rows
-- create_view("multiline_left_justified", {:sql_definition=>"      select\n      1 as a\n      from\n      dual\n"})
   -> 0.0010s
   -> 0 rows
.   -> index 'THINGS_ID' on 'THINGS' has been recreated
   -> index 'THINGS_NAME' on 'THINGS' has been recreated
.   -> index 'THINGS_ID' on 'THINGS' has been recreated
   -> index 'THINGS_NAME' on 'THINGS' is no longer valid and has been dropped.
```

Co-authored-by: Davin Lagerroos <dlagerro@umn.edu>
Co-authored-by: Eric Eklund <eeklund@umn.edu>
@cdinger
Copy link
Owner

cdinger commented Oct 6, 2024

Thank you! This extra output has always bugged me. You've brought back the beautiful green dots 😄

@cdinger cdinger merged commit dbd2ea8 into cdinger:main Oct 6, 2024
1 check failed
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.

2 participants