-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Unable to run native tests in non prod mode #21650
Comments
Yes, that's a known limitation. The reason is that otherwise we would have to build the native executable twice. |
It should atleast be an option to run (build) the native executable for integration tests. IMHO using the prod executable for (fast) tests executions without new compilation should be an opt-in feature. Because normally the prod executable should no be used for tests, it could have credentials to access production data. |
That's questionable; ideally you wouldn't put secrets in your executable. You would use environment variables or a Regardless, I agree (runtime) prod settings shouldn't be applied by default during integration tests, be it only because it's inconvenient. #24581 discusses a possible solution, so I'll close this issue in favor of #24581. Feel free to ping me if you feel we should reopen. |
Of cause we don't put credentials into the binary, but the URLs and configuration in the prod executable are pointing to production systems and credentials are discovered from the environment. For example, the application is configured to use the prod S3 bucket and uses the default aws credentials provider, which discovers credentials. Now if a developer runs this application locally the credentials of the developer are used, and if he has sufficient permissions, the application writes into the prod S3 bucket during integration tests. This is only an example and we have some other systems where this is a problem. Often it is not possible to configure all settings via environment variables, because they must be known at build time. |
Describe the bug
If I execute
./gradlew testNative
to run the native tests. Quarkus always builds using theprod
profile instead of the test profile. Even ifquarkus.profile=test
andquarkus.test.native-image-profile=test
the native executable is created with the prod profile. At test execution time thetest
profiles then only overrides some of the configuration set by the prod profile, which results in an invalid configuration. This is potenially dangerous, because the production configuration is configured to access production databases which can result in dataloss during test execution (e.g. if local developer aws account has write access to database and the native test clear the database after each test case, this could delete all data in the production database)Expected behavior
native tests do not use the prod profile at all (not at compile time and runtime). It should be opt-in that the native tests use an existing runner artifact which was build with some (unkown) profile before. The
./gradlew testNative
command should use thetest
profile by default for compilation (quarkus.profile=test
) and at runtime (quarkus.test.native-image-profile=test
).Actual behavior
Native tests are executed using the prod profile by default, which is against the principle of least surprise, because there is a
test
profile which is normally used for tests../gradlew testNative
uses existing runner artifacts from any previous build, which may has access to production data and should not be executed on the developer machine and used for testing.How to Reproduce?
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.4.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Additional information
No response
The text was updated successfully, but these errors were encountered: