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

Disable TestValidateIncompatibleCentralizedDatasourceSchemaConfig #16627

Merged
merged 7 commits into from
Jun 19, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.inject.Injector;
import org.apache.druid.guice.GuiceInjectors;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand Down Expand Up @@ -51,6 +52,9 @@ public TestValidateIncompatibleCentralizedDatasourceSchemaConfig(ServerRunnable
this.runnable = runnable;
}

// It seems that setting the system properties is causing MainTest to fail.
// Ignoring this test until there is a better way to set the properties.
@Ignore
@Test(expected = RuntimeException.class)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this line is the problem. Looking at this test, an exception is expected to be thrown when the runnable gets the system properties in L68-69.

After an exception is thrown, it doesn't clear the properties set from L71-73 causing the incompatible system properties to be "leaked".

A couple of points regarding fixing this test:

  1. Instead of setting system-wide properties that can affect other tests broadly, you can bind the supplied properties to the Guice injector instance. For example, please see SqlModuleTest.java. This way, the properties would only be scoped to this test injector.
  2. One of the problems with expected exceptions @Test(expected = Foo.class) is that it doesn't tell us which line of code is expected to throw the exception. We should use Assert.assertThrows() with a narrow code block around lines 68-69.

public void testSimpleInjection_centralizedDatasourceSchemaEnabled()
{
Expand Down
Loading