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

Non-expected behaviour when using specific env in tests and not forking #78

Open
albertpastrana opened this issue Nov 9, 2020 · 2 comments

Comments

@albertpastrana
Copy link

Hey, first of all, thanks for your project, we are using extensively and it's super useful to us.

We have lately faced a strange problem when trying to specify a specific environment file for the tests. It looks like those environment variables will only be picked if you set the fork in tests to true.

As it's a bit difficult to explain, I've created a sample project that illustrates the problem we are having https://github.com/albertpastrana/sbtenv-fork-test

Hope that helps

@Philippus
Copy link
Owner

@slavaschmidt do you have any ideas around this? Is this a limitation or is this something we can fix?

@slavaschmidt
Copy link
Contributor

@Philippus, I believe in general forking should not be needed.

The test case can be fixed by defining the environment as following:

envFileName in ThisBuild := "test.env"
envVars in Test := (envFromFile in Test).value

I think there is a combination of following factors in play in this case:

With this reasoning I see possible solutions:

  • forking (as demonstrated by the test case)
  • loading the configuration only once (as demonstrated by overriding the env file name in ThisBuild at the beginning of this comment)
  • I believe another option could be to add some possibility to suppress the loading of the default environment

Maybe it makes sense to debug how the native library related part behaves and modify it if possible to allow multiple applications in single / current process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants