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

Remove yaml-tests dependency on fdb-record-layer-core test code #3252

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ScottDugas
Copy link
Collaborator

This changes the main code for yaml-tests to not depend on the test configuration of fdb-record-layer-core, allowing it to be more easily used in other projects.

yaml-tests had the following test dependencies:

  1. TestHelpers.assertThrows - Replaced with junit's Assertions.assertThrows. We should probably do this across the code base, but I did not as part of this PR.
  2. TestHelpers.DangerousRunnable - this was fairly easy to remove as it was only used by QueryCommand.runWithDebugger. I think this is unnecessary as we set the debugger globally.
  3. DebuggerWithSymbolTables - I believe this is only used to debug the behavior of the planner, which doesn't seem like something people should be testing outside, so moving this to the test code seemed reasonable. In order to accomplish this, I added a new extension: YamlTestWithDebuggingExtension that extends YamlTestExtension but initializes the debugger in the beforeAll. In order to use this, I moved @YamlTest the test code. This seems like a good idea anyways, as that adds the MixedMode category.

With the above changes I removed YamlTest.Runner, and changed YamlRunner to be an acceptable parameter to the tests.

By removing this dependency we make it easier for others to use
the yaml testing framework.
If someone wants to use YamlTestExtension, they'll have to add it
with @ExtendWith
This re-enables the debugger in our tests, but allows yaml-tests
to be used elsewhere without bringing in a dependency on the debugger.
@ScottDugas ScottDugas added testing improvement Change that improves our testing build improvement Improvement to the build system labels Mar 17, 2025
ScottDugas added a commit to ScottDugas/fdb-record-layer that referenced this pull request Mar 17, 2025
When publishing to JUnit xml style files there is no hierarchy, so
some tools will just show the class name and description, making it
hard to tell what tests were run, or failed. If YamlTestExtension
is used in an environment where that is the case this can be used
to have the output include the method name. For example:
- showcasingTests(Embedded)
- showcasingTests(MultiServer (Embedded then !current_version))
...

Instead of
- YamlIntegrationTests
  - showcasingTests(Runner)
    - Embedded
    - MultiServer (Embedded then !current_version)

I thought about making this configurable via system property, but
I think having it configured by a constructor parameter aligns more
with PRs FoundationDB#3252 and FoundationDB#3251
@normen662 normen662 self-requested a review March 18, 2025 06:33
@@ -179,13 +174,13 @@ private void executeInternal(@Nonnull final YamlConnection connection, boolean c
// can result in the explain plan being put into the plan cache, so running without the debugger
// can pollute cache and thus interfere with the explain's results
Integer finalMaxRows = maxRows;
runWithDebugger(() -> executor.execute(connection, null, queryConfig, checkCache, finalMaxRows));
executor.execute(connection, null, queryConfig, checkCache, finalMaxRows);
Copy link
Contributor

Choose a reason for hiding this comment

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

This disables all sanity checks within the planner. See Debugger.isSane()

} else if (QueryConfig.QUERY_CONFIG_EXPLAIN.equals(queryConfig.getConfigName()) || QueryConfig.QUERY_CONFIG_EXPLAIN_CONTAINS.equals(queryConfig.getConfigName())) {
Assert.that(!queryIsRunning, "Explain test should not be intermingled with query result tests");
// ignore debugger configuration, always set the debugger for explain, so we can always get consistent
// results
Integer finalMaxRows1 = maxRows;
runWithDebugger(() -> executor.execute(connection, null, queryConfig, checkCache, finalMaxRows1));
executor.execute(connection, null, queryConfig, checkCache, finalMaxRows1);
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build improvement Improvement to the build system testing improvement Change that improves our testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants