Change date of VM for testing

How my app runs is very dependent on the date (certain events are only triggered on certain days, for example on the 21st of each month). In order to test it’s working properly, I would need to be able to change the date in the environment doing the testing. Is this possible?

I don’t believe this can be done in a containerized environment. I would instead simulate the date in your code, maybe by passing command-line arguments, or have a specific test for the 21st of the month that inserts that day into your program.

1 Like

You could also potentially run Docker in your build environment and change the dates that way, but I think mocking the data like @FelicianoTech suggested is a better (and much faster) approach.