Have tests that need to run on server with specific date time test - how to accomplish


#1

I have a series of tests that need to take place on a server set to a specific date - such that I can test that values displayed are what they are supposed to be for that specific date range.

Furthermore I have a set of tests that test functionality that works around working day hours - requiring that I set the date time manually on the serving machine to test that the features are working properly.

Any ideas on how I can set the date/time in the CI environment? Ive nearly convinced myself its impossible.


#2

I haven’t tried this in a circle container, but have you tried running this bash command?
`

date +%T -s “12:34:56”

`


#3

Yea you cant change the date within the circle container- the “hypervisor” wont allow that.

Ill just have to run this particular test on a local container.


#4

In case others find this in the future: it is possible to define system time with the machine executor. It is not possible using the Docker executor.


#5

I suspect a better solution to this is to refactor the tests so that the information normally obtained from system time is injected as a string. Tests that monkey around with the system time won’t parallelise.


#6

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.