Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse UTC timezone #569
Use UTC timezone #569
Conversation
highfive
commented
Dec 30, 2016
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @aneeshusa (or someone else) soon. |
|
Looks like timezone is not supported for macOS : saltstack/salt#31345 |
|
Looks pretty good! Another change - in |
| @@ -72,4 +72,5 @@ else | |||
| if [[ "${SALT_NODE_ID}" == "servo-master1" ]]; then | |||
| ./test.py sls.buildbot.master sls.homu sls.nginx | |||
| fi | |||
| ./test.py sls.common | |||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 31, 2016
Member
We should only run this on the non-macOS machines for now, so we can check the ${SALT_NODE_ID} isn't a macOS node; easiest way is probably using the =~ bash operator.
| @@ -45,6 +45,9 @@ servo: | |||
| - shell: /bin/bash | |||
| - home: {{ common.servo_home }} | |||
| UTC: | |||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 31, 2016
Member
Use Jinja to render this state conditionally, only on non-macOS, using an {% if ... %} block.
|
|
||
| def run(): | ||
| command = 'date' | ||
| ret = subprocess.run(command, |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 31, 2016
Member
Inline the command and pass as an array so we control word-splitting, etc.
subprocess.run(['date'], ...)
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 31, 2016
Member
Also, prefer to use block indent:
ret = subprocess.run(
['date'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
73a8df0
to
4d60976
|
One last nit, everything else LGTM, so go ahead and squash while addressing this last comment. |
|
|
||
| # Salt doesn't support timezone.system on OSX | ||
| # See https://github.com/saltstack/salt/issues/31345 | ||
| if [[ "${TRAVIS_OS_NAME}" != "osx" ]]; then |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jan 1, 2017
Member
In the future the list of tests to run will be auto-generated from the Salt top file, so I'd prefer to check ${SALT_NODE_ID} instead of ${TRAVIS_OS_NAME}. You can use e.g.
if [[ ! "${SALT_NODE_ID}" =~ servo-mac* ]]; then
...
fi
This comment has been minimized.
This comment has been minimized.
charlesvdv
Jan 2, 2017
Author
Contributor
Sorry about that. I thought it would be less error-prone (because the servo-mac* could change at some point) but if it needs to be travis independant I totally get that.
|
Thought of an optional enhancement for bonus points, or else you can squash the current commits which LGTM. |
| stdout = ret.stdout.decode('utf-8') | ||
|
|
||
| if ret.returncode == 0 and 'UTC' in stdout: | ||
| return Success('Date is in UTC') |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jan 2, 2017
Member
I was reading an article about testing yesterday which reminded me of expected-failure tests, which is IMO a nicer way to handle the macOS situtation. Roughly, instead of just returning Success here, use sys.platform to check if we're on macOS, and if so, return Failure in that case with an appropriate message; and vice-versa for the Failure. This inverts the expectations and lets us run the sls.common test unconditionally.
Note that in the .travis.yml file, I believe python isn't supported on macOS, so don't update those entries to add the python3.5 spec. However, we may need to install Python 3.5 manually with brew on the OS X builders; make a separate commit and see if it's necessary before adding that.
It may be a little tricky to add so I'll make it optional, for bonus points :)
This comment has been minimized.
This comment has been minimized.
charlesvdv
Jan 2, 2017
Author
Contributor
Should I put the brew python install inside a saltscript or inside the .travis/install...sh ?
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jan 2, 2017
Member
Let's not add the brew install unless the test suite fails to run on macOS on Travis (i.e. check first), but if we need it I'd probably put it in the dispatch script before we print the Python version.
|
If you go for the bonus points, in the |
83f74e2
to
c2f2054
|
I believe installing Python 3.5 on the Mac builders actually takes a bit of time, so let's skip the xfail stuff for now. Everything else looked good, so discard the last commit and squash the first five, and we'll get this landed. |
|
Also, please rebase on top of the latest master to pull in #573. |
|
Thanks for the patch @charlesvdv! @bors-servo r+ |
|
|
|
|
Use UTC timezone Fix the issue #303 and follow up of #439 PR. I'm not sure about the spot to put the ```sls.common``` tests. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/569) <!-- Reviewable:end -->
charlesvdv commentedDec 30, 2016
•
edited by larsbergstrom
Fix the issue #303 and follow up of #439 PR.
I'm not sure about the spot to put the
sls.commontests.This change is