我有一个脚本,它使用GET时间并在后面进行比较。
测试在我的本地机器上通过,打印的时间与我的机器时间相同,例如: 09:37:57是在我的机器显示上午9点时打印的。
但是,当我在码头容器中运行测试时,测试失败了,打印的时间是01:37:57。
我是否应该在docker中设置一些东西,使其使用与我的服务器/应用程序时区相同的时区?
如何解决这样的问题,由于码头集装箱的格式不同,比较测试失败。
Get Current Audio Upload Time
${time}= Get Current Date
${current-time}= Convert Date ${time} result_format=%H:%M:%S
Log To Console time when uploading audio is ${current-time}
Set Global Variable ${current-time}使用上面的时间来比较在网页上显示的时间。
Verify Audio Time
${time-elem} Get Table Cell Element .ant-table-content > table "Time" "Dual-Channel-Audio-${RandomNumber}"
${UI-time} Get Text ${time-elem}
Log To Console time displayed at UI is ${UI-time}
${time-substract-result}= Subtract Time From Time ${UI-time} ${current-time}
Log To Console subtract time is ${time-substract-result}
Run Keyword And Continue On Failure Should Be True ${time-substract-result} <= 300 time displayed at UI is more than 5 seconds than expected time发布于 2022-06-02 03:02:52
我刚刚尝试在Dockerfile中设置它,并解决了问题。
ENV TZ 'Asia/Singapore'https://stackoverflow.com/questions/72469928
复制相似问题