-
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
@TempDir not working when on a field on @QuarkusTest #13261
Comments
/cc @geoand Is this a known limitation? I couldn't find anything in the docs or previous issues. |
It's not a known limitation, but I guess it is to be expected. In this case, we can most likely add support for |
@TempDir
not working when on a field on @QuarkusTest
Running into this issue as well with a For my integration test I override this property with a different folder. I'd like to use the Having the ability to use something like |
I know this is not perfect, but here's a workaround (I tested it with @QuarkusTest
@TestProfile(Configuration.class)
class MyTest {
@TempDir
static Path sharedTempDir;
public static class Configuration implements QuarkusTestProfile {
@Override
public Map<String, String> getConfigOverrides() {
return Map.of("temp.directory", sharedTempDir.toString());
}
}
@ConfigProperty(name = "temp.directory")
String tempDirectory;
@Test
public void defaultConfiguration() {
System.out.println(tempDirectory); //Prints actual value
}
} |
Ran into the same issue today. Edit: can't use that since we use another TestProfile already :/ |
Ran into the same issue |
This should be fixed when the very important and complicated work @holly-cummins is doing lands |
Describe the bug
Temp dir not being created and set when using
@TempDir
a field on@QuarkusTest
. It works fine as a set up or test method parameter though.Expected behavior
Temp dir is created and set on field.
Actual behavior
The field annotated with
@TempDir
isnull
To Reproduce
Environment (please complete the following information):
uname -a
orver
:Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_6
java -version
:1.8.1.Final
(quickly tested with1.9.2.Final
and got the same result)mvnw --version
orgradlew --version
):Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
The text was updated successfully, but these errors were encountered: