Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UTC timezone #569

Merged
merged 1 commit into from Jan 7, 2017
Merged

Use UTC timezone #569

merged 1 commit into from Jan 7, 2017

Conversation

@charlesvdv
Copy link
Contributor

charlesvdv commented Dec 30, 2016

Fix the issue #303 and follow up of #439 PR.

I'm not sure about the spot to put the sls.common tests.


This change is Reviewable

@highfive
Copy link

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.

@charlesvdv charlesvdv force-pushed the charlesvdv:utc branch from 4cdfad7 to da38056 Dec 30, 2016
@charlesvdv
Copy link
Contributor Author

charlesvdv commented Dec 30, 2016

Looks like timezone is not supported for macOS : saltstack/salt#31345

Copy link
Member

aneeshusa left a comment

Looks pretty good! Another change - in .travis.yml, each builder that invokes the test suite should get language: python and python: 3.5.

@@ -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.

@aneeshusa

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.

@aneeshusa

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.

@aneeshusa

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.

@aneeshusa

aneeshusa Dec 31, 2016

Member

Also, prefer to use block indent:

ret = subprocess.run(
    ['date'],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE
)
@charlesvdv charlesvdv force-pushed the charlesvdv:utc branch 2 times, most recently from 73a8df0 to 4d60976 Jan 1, 2017
Copy link
Member

aneeshusa left a comment

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.

@aneeshusa

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.

@charlesvdv

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.

Copy link
Member

aneeshusa left a comment

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.

@aneeshusa

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.

@charlesvdv

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.

@aneeshusa

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.

@aneeshusa
Copy link
Member

aneeshusa commented Jan 2, 2017

If you go for the bonus points, in the .travis/dispatch.sh script please also print the Python3 version unconditionally before running the test suite instead of just for the test node.

@charlesvdv charlesvdv force-pushed the charlesvdv:utc branch 2 times, most recently from 83f74e2 to c2f2054 Jan 3, 2017
@aneeshusa
Copy link
Member

aneeshusa commented Jan 6, 2017

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.

@aneeshusa
Copy link
Member

aneeshusa commented Jan 6, 2017

Also, please rebase on top of the latest master to pull in #573.

@charlesvdv charlesvdv force-pushed the charlesvdv:utc branch from c2f2054 to dcc4cb2 Jan 6, 2017
@charlesvdv charlesvdv force-pushed the charlesvdv:utc branch from dcc4cb2 to 751f12e Jan 6, 2017
@aneeshusa
Copy link
Member

aneeshusa commented Jan 7, 2017

Thanks for the patch @charlesvdv! @bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jan 7, 2017

📌 Commit 751f12e has been approved by aneeshusa

@bors-servo
Copy link
Contributor

bors-servo commented Jan 7, 2017

Test exempted - status

@bors-servo bors-servo merged commit 751f12e into servo:master Jan 7, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test exempted
Details
bors-servo added a commit that referenced this pull request Jan 7, 2017
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 -->
@jdm jdm mentioned this pull request Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.