flapdoodle-oss / de.flapdoodle.embed.mongo

...will provide a platform neutral way for running mongodb in unittests.
Apache License 2.0
910 stars 160 forks source link

User environment variable "EMBEDDED_MONGO_ARTIFACTS" ignored on Windows #461

Open blafoo opened 1 year ago

blafoo commented 1 year ago

Assume a Windows system with restricted permissions to the developer... The developer can only set "user environment variables" but not "system environmenent variables". In this case EMBEDDED_MONGO_ARTIFACTS is 'null' in de.flapdoodle.embed.mongo.transitions.ExtractFileSet.persistentBaseDir() and user.home is used instead.

The same behaviour applies to the vmarg -DEMBEDDED_MONGO_ARTIFACTS=... in the Eclipse test configuration or in the eclipse.ini whereas -Dde.flapdoodle.embed.io.tmpdir=... properly works.

michaelmosmann commented 1 year ago

@blafoo hm.. AFAIK there is no special call to get user env variables on windows.. so System.getenv() should provide system and user env variables. But maybe your user env variable is not visible to the current session, maybe logoout/login could help.

btw: i am not sure if vmarg is the way to go .. i could add a property for that.

blafoo commented 1 year ago

@michaelmosmann May be the cause is that a new process is started which runs in a different user context?! A property like de.flapdoodle.embed.io.artdir should solve the problem and beyond it would unify the way how to configure the application.

michaelmosmann commented 1 year ago

@blafoo maybe it is very useful to support both:)

blafoo commented 1 year ago

@michaelmosmann That's a good idea. Existings users wouldn't have to change anything and "new" users are supported in an additional way.