[SERVER-28180] Add testing-only command to set environment variable in mongod Created: 02/Mar/17 Updated: 21/Mar/17 Resolved: 21/Mar/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Testing Infrastructure |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Max Hirschhorn | Assignee: | Max Hirschhorn |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Sprint: | TIG 2017-03-27 | ||||
| Participants: | |||||
| Description |
|
https://github.com/wolfcw/libfaketime is a library that can be dynamically configured through a FAKETIME environment variable. Changing the value of the environment variable causes the function overrides to change how much clock skew is applied. We should expose a command when running with --setParameter=enableTestCommands=1 that calls setenv(). |
| Comments |
| Comment by Max Hirschhorn [ 21/Mar/17 ] |
|
I'm abandoning this approach as setenv() is marked "MT-Unsafe const:env", so we'd need to LD_PRELOAD our own getenv() and setenv() if we wanted to make it thread-safe. However, since getenv() returns a bare pointer and callers implicitly assume the environment is constant, we'd need to keep all values returned by it in memory to avoid invalid accesses and memory leaks. It doesn't seem worth the effort. I've been successful in using the faketimerc file-based configuration for libfaketime that using the FAKETIME environment variable that I'm going to go ahead and close this ticket as "Won't fix". |