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

Use UNITTEST_LOG_LEVEL in objectstore tests #7029

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Oct 4, 2023

For historical reasons core and sync tests use the UNITTEST_LOG_LEVEL environment variable to determine the test log level, while object store tests used a build time setting. This brings them into alignment on using the env variable, and applies it via setting the default log level on startup in a single place.

The default behavior and log level used on CI should be unchanged.

@tgoyne tgoyne self-assigned this Oct 4, 2023
@cla-bot cla-bot bot added the cla: yes label Oct 4, 2023
@coveralls-official
Copy link

coveralls-official bot commented Oct 4, 2023

Pull Request Test Coverage Report for Build github_pull_request_278228

  • 46 of 54 (85.19%) changed or added relevant lines in 5 files are covered.
  • 51 unchanged lines in 12 files lost coverage.
  • Overall coverage increased (+0.007%) to 91.582%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/util/logger.cpp 28 30 93.33%
test/test_all.cpp 1 7 14.29%
Files with Coverage Reduction New Missed Lines %
test/object-store/util/test_file.cpp 1 90.07%
src/realm/object-store/sync/sync_manager.cpp 2 86.9%
src/realm/sync/noinst/server/server_history.cpp 2 67.69%
src/realm/table_view.cpp 2 93.91%
src/realm/query_expression.cpp 3 87.03%
src/realm/sync/noinst/client_impl_base.cpp 3 85.57%
src/realm/util/future.hpp 3 95.81%
test/fuzz_group.cpp 3 48.68%
src/realm/util/assert.hpp 4 87.5%
src/realm/sync/network/network.hpp 7 85.41%
Totals Coverage Status
Change from base Build 1730: 0.007%
Covered Lines: 230351
Relevant Lines: 251523

💛 - Coveralls

For historical reasons core and sync tests use the UNITTEST_LOG_LEVEL
environment variable to determine the test log level, while object store tests
used a build time setting. This brings them into alignment on using the env
variable, and applies it via setting the default log level on startup in a
single place.
Copy link
Contributor

@michael-wb michael-wb left a comment

Choose a reason for hiding this comment

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

Looks good - definitely cleans up the setting of the log level for the tests

Comment on lines +164 to +166
if (auto custom_level = Logger::level_from_string(str)) {
log_level = *custom_level;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What about writing the value of UNITTEST_LOG_LEVEL to stderr here, like we did in the makefile, or print an error (with the UNITTEST_LOG_LEVEL) if the value is invalid. Regardless, don't return exit the test on an invalid value.

@tgoyne
Copy link
Member Author

tgoyne commented Oct 5, 2023

Turns out this is setting the log level for a bit too many things and by default failing checks aren't getting reported. Will need to poke at it a bit more.

@michael-wb
Copy link
Contributor

Turns out this is setting the log level for a bit too many things and by default failing checks aren't getting reported. Will need to poke at it a bit more.

Yeah - IIRC, I think the default logger level was (or at least used to be) "info" and the NullLogger will (obviously) prevent the logger->error() calls from being printed in the tests.
Of note, evergreen was compiling everything with the "debug" log level, not just the object store tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants