-
Notifications
You must be signed in to change notification settings - Fork 166
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
Cleanup test profile and make it converge with prod profile #786
Conversation
@@ -73,7 +73,7 @@ quarkus.otel.sdk.disabled=false | |||
# quarkus.otel.traces.sampler.arg=1.0d | |||
|
|||
polaris.realm-context.type=default | |||
polaris.realm-context.realms=realm1,realm2,realm3 | |||
polaris.realm-context.realms=POLARIS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change imho makes sense as POLARIS
is definitely a better default value than the rather lame realm1,realm2,realm3
. Tests that need to use a different realm name should override this property. Tests that generate random realm names need to change the realm resolver to test
: polaris.realm-context.type=test
.
@@ -119,29 +119,5 @@ polaris.authentication.token-broker.max-token-generation=PT1H | |||
# polaris.storage.gcp.lifespan=PT1H | |||
|
|||
%test.quarkus.log.file.enable=false | |||
%test.quarkus.log.category."org.apache.polaris".level=INFO | |||
%test.quarkus.log.category."org.apache.iceberg.rest".level=INFO | |||
%test.quarkus.log.category."org.apache.iceberg.rest.RESTSessionCatalog".level=ERROR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing these loggers for now, let's see if users complain about logs being too verbose.
42ecda1
to
11792d5
Compare
%test.polaris.storage.gcp.lifespan=PT1H | ||
|
||
# Profile for integration tests | ||
%it.quarkus.http.limits.max-body-size=1000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, when running integration tests, the configuration needs to be built into the application jar. But at least, the changes are confined in a specific profile that will be used only for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change LGTM, but it also highlights my concerns with checking body size restrictions as part of our "normative" suite of integration tests (commented under #630). It is very specific to the server env. FWIW, even HTTP proxies may have their own (different) limits.
@@ -96,6 +96,12 @@ | |||
/** | |||
* Import the full core Iceberg catalog tests by hitting the REST service via the RESTCatalog | |||
* client. | |||
* | |||
* @implSpec @implSpec This test expects the server to be configured with the following features | |||
* enabled: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: disabled?
@@ -93,6 +93,18 @@ | |||
import org.junit.jupiter.api.TestInfo; | |||
import org.junit.jupiter.api.extension.ExtendWith; | |||
|
|||
/** | |||
* @implSpec This test expects the server to be configured with the following features enabled: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about putting these notes in a README under integration-test
and mention the README in javadoc?
%it.polaris.features.defaults."ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING"=true | ||
%it.polaris.features.defaults."INITIALIZE_DEFAULT_CATALOG_FILEIO_FOR_it"=true | ||
%it.polaris.features.defaults."SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION"=true | ||
%it.polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES"=["FILE","S3","GCS","AZURE"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to keep these settings in a java test profile? IIRC, application.properties
is embedded in the final distribution jar, so it would be nice to avoid having test stuff there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can split in many files, if that's better, but the it
file must stay under src/main/resources
according to this doc:
While adding test-specific configuration properties using src/test/resources/application.properties (note there’s test, not main) is possible for unit tests, it’s not possible for integration tests.
And indeed I tested, it works only if the file is in main
not when it's in intTest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean using QuarkusTestProfile
to define these properties... Does it not work with integration tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you can't use QuarkusTestProfile
with @QuarkusIntegrationTest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm not a fan of splitting the files, I think having all the profiles in application.properties
is actually simpler, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough! TIL about test profiles not working in integration tests 🤔
import org.apache.polaris.service.it.test.PolarisRestCatalogIntegrationTest; | ||
|
||
@QuarkusTest | ||
public class QuarkusRestCatalogIntegrationTest extends PolarisRestCatalogIntegrationTest {} | ||
@TestProfile(QuarkusRestCatalogIntegrationTest.Profile.class) | ||
public class QuarkusRestCatalogIntegrationTest extends PolarisRestCatalogIntegrationTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm a bit confused wrt #778 ... Was it not moved to QuarkusRestCatalogIT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests were duplicated. The only one that was removed from test
is QuarkusSparkIT
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why duplicate them? why not just rely on the intTest
suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it can be useful to also run those *IntegrationTest
when running ./gradlew test
– they usually run faster, because there is no need to build the artifact first.
In Maven, it's common to have the following idiom:
@QuarkusTest
public class FooTest {
// tests go here
}
@QuarkusIntegrationTest
public class FooIT extends FooTest {}
(this doesn't work in Gradle though)
But if you prefer, I can remove the tests in test
and only keep the ones in intTest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep. I suppose it makes sense to test
with in-memory store and intTest
with EclipseLink + H2
build.gradle.kts
Outdated
@@ -91,6 +91,8 @@ tasks.named<RatTask>("rat").configure { | |||
excludes.add("logs/**") | |||
excludes.add("service/common/src/**/banner.txt") | |||
excludes.add("quarkus/service/logs") | |||
excludes.add("quarkus/server/logs") | |||
excludes.add("quarkus/admin/logs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about disabling log files in test tasks? Do people file test log files useful? As for me, I'd personally prefer STDOUT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's about testing the "real thing". If the real thing produces log files, then let it be. At least you can inspect the log files manually to check e.g. if a change you made produced some expected output in the log files.
Do you think it's not worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine deferring it til later. I guess my concern was mostly with log files ending up under the main source tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting for ITs: the approach from #785 runs the Quarkus application with the current directory being underneath the build/
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will improve a bit with #835.
9d73113
to
290b8d9
Compare
290b8d9
to
6a6caa2
Compare
# Note: this file MUST be placed in the src/main/resources directory, not src/intTest/resources! | ||
|
||
quarkus.http.limits.max-body-size=1000000 | ||
quarkus.http.port=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, it seems that with integration tests, it's this property that needs to be set to zero, and not quarkus.http.test-port
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting: The plugins from #785 do this automatically.
quarkus.http.limits.max-body-size=1000000 | ||
quarkus.http.port=0 | ||
|
||
quarkus.log.file.path=./build/logs/polaris.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property does not seem to take effect :-( will investigate later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #835.
|
||
# Need to allow a java security manager after Java 21, for Subject.getSubject to work | ||
# "getSubject is supported only if a security manager is allowed". | ||
quarkus.test.arg-line=-Djava.security.manager=allow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snazy FYI there was a typo in this option, it's arg-line
and not argLine
. This PR fixes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I saw a log WARN about that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird though that it worked 🤷
integration-tests/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather the code self-describe than try to keep a file like this up to date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good point. This will quickly go out of sync.
@@ -93,6 +93,18 @@ | |||
import org.junit.jupiter.api.TestInfo; | |||
import org.junit.jupiter.api.extension.ExtendWith; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously with dropwizard we could set overrides that were test-specific; is that not possible now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it still is.
|
||
polaris.persistence.type=in-memory | ||
|
||
polaris.features.defaults."ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING"=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, you set them here. Can we set these from within tests instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. if a test relies on a certain feature flag being set let's just set it in that test rather than subtlety rely on the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is only for @QuarkusIntegrationTest
annotated tests (these are in the intTest
folder). These are "real" black box tests that run the actual final jar in a separate JVM process. Because of that, some tweaks are not possible for these tests, but at least, it is possible to provide a file like this that will be passed to the JVM process.
For @QuarkusTest
annotated test (in the test
folder), it is possible to define options that are global to all tests, and also possible to define options that are valid for just some tests, using QuarkusTestProfile
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. if a test relies on a certain feature flag being set let's just set it in that test rather than subtlety rely on the default.
That's precisely the intent of this PR :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I misunderstood, I was specifically looking at the comments like:
This test expects the server...
And thinking that the test shouldn't need that comment and should just always set those exact values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment belongs to another conversation? I'm confused now, what is it that you want me to remove? The javadocs, the README, everything?
@@ -87,9 +87,9 @@ public static class Profile implements QuarkusTestProfile { | |||
@Override | |||
public Map<String, String> getConfigOverrides() { | |||
return Map.of( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, these need to map to entries in the Quarkus config file rather than the actual Polaris features?
Is there a way we can make that mapping programmatic rather than manual?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this method allows test profiles to override properties define somewhere else. Unfortunately the mapping is not programmatic. I agree that this is not ideal, but that's how it is today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But can we have it be programmatic? Is there a way to look up key:value pairs from the Quarkus config file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they do not form a set like an enum or something like that. The amount of available configuration options depends on the extensions being used.
a786be3
to
d823e67
Compare
Rebased in order to adapt to the recently-introduced |
d823e67
to
3491e5f
Compare
Is it OK to merge it today? 🙏 |
This PR cleans up the test profile and makes it converge with the prod profile, which is better as by default, tests are testing the real-life application. If tests need to customize the configuration, this is now done on a per-test basis with `QuarkusTestProfile`.
3491e5f
to
82095ce
Compare
@dimas-b @eric-maynard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
|
||
polaris.realm-context.type=default | ||
polaris.realm-context.realms=realm1,realm2,realm3 | ||
polaris.realm-context.realms=POLARIS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Was old default upper case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh no: the default for prod was default-realm
:
Line 79 in aa240e9
defaultRealm: default-realm |
But the default for tests was POLARIS
(in uppercase):
polaris/dropwizard/service/src/test/resources/polaris-server-integrationtest.yml
Line 104 in aa240e9
defaultRealm: POLARIS |
I thought POLARIS
was more appropriate as a default than default-realm
, but happy to change that back to default-realm
if someone thinks otherwise.
There has been some confusion around regression tests lately (see #865) and I think this PR would help. So I'm going to merge it now. If there are leftovers, please speak up and I will fix in another PR. Thanks! |
This PR cleans up the test profile and makes it converge with the prod profile, which is better as by default, tests are testing the real-life application.
If tests need to customize the configuration, this is now done on a per-test basis.