Status: Won't Fix
Fix Version/s: None
Sprint:TSSW Sprint - Jan 31 - Feb 14
Team:Telescope and Site
I would like each SAL unit test to run with its own LSST_DDS_PARTITION_PREFIX. In Python one can simply modify the environment before each test and it appears that C++ also supports this (Petr Kubanek?). But Java apparently cannot modify environment variables.
So: please add an optional argument to the SAL object constructor that allows specifying the partition prefix. If omitted the environment variable should be used, and that is how we'd run in production.
- relates to
DM-33273 Explore System Rules to set LSST_DDS_PARTITION_PREFIX for each Java unit test
That same posting suggests Powermockito, which Wouter van Reeven is already using. In any case, if there is a reasonable way to set env vars per test, then it would be better to update the tests than modify the SAL API. That way the test runs the same SAL code branches as production code.
I am willing to give the System Rules library a try. I created
DM-33273 for that and linked it to this issue.
https://stackoverflow.com/questions/8168884/how-to-test-code-dependent-on-environment-variables-using-junit System Rules library shall allow env modifications: https://github.com/stefanbirkner/system-rules