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
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Use UTC timezone

  • Loading branch information
charlesvdv committed Jan 6, 2017
commit 751f12e2226971ed343eb429c8b67a7c3ef5e505
@@ -14,6 +14,8 @@ matrix:
os: linux
sudo: required
dist: trusty
language: python
python: 3.5
- env:
- SALT_NODE_ID=servo-mac1
- SALT_FROM_SCRATCH=true
@@ -25,6 +27,8 @@ matrix:
os: linux
sudo: required
dist: trusty
language: python
python: 3.5
- env:
- SALT_NODE_ID=servo-master1
- SALT_FROM_SCRATCH=true
@@ -40,6 +44,8 @@ matrix:
os: linux
sudo: required
dist: trusty
language: python
python: 3.5
- env:
- SALT_NODE_ID=servo-mac1
- SALT_FROM_SCRATCH=false
@@ -51,6 +57,8 @@ matrix:
os: linux
sudo: required
dist: trusty
language: python
python: 3.5
- env:
- SALT_NODE_ID=servo-master1
- SALT_FROM_SCRATCH=false
@@ -72,4 +72,10 @@ else
if [[ "${SALT_NODE_ID}" == "servo-master1" ]]; then
./test.py sls.buildbot.master sls.homu sls.nginx
fi

# Salt doesn't support timezone.system on OSX
# See https://github.com/saltstack/salt/issues/31345
if [[ ! "${SALT_NODE_ID}" =~ servo-mac* ]]; then
./test.py sls.common
fi
fi
@@ -45,6 +45,11 @@ servo:
- shell: /bin/bash
- home: {{ common.servo_home }}
{% if grains['os'] != 'MacOS' %}
UTC:
timezone.system
{% endif %}
{% for hostname, ip in common.hosts.items() %}
host-{{ hostname }}:
host.present:
No changes.
@@ -0,0 +1,18 @@
import subprocess

from tests.util import Failure, Success


def run():
ret = subprocess.run(
['date'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)

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.

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

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

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

else:
return Failure('Date is not in UTC: ', stdout)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.