Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.

Use Docker for testing on Travis, start on 16.04 support - #649

Merged
bors-servo merged 7 commits into
servo:masterfrom
aneeshusa:use-docker-for-testing-on-travis
May 5, 2017
Merged

bors-servo merged 7 commits into
servo:masterfrom
aneeshusa:use-docker-for-testing-on-travis

Conversation

@aneeshusa

@aneeshusa aneeshusa commented Apr 27, 2017 •

Copy link
Copy Markdown
Contributor

Use pinned Docker images to test our states on multiple OSes.
Currently, only servo-linux1 is tested, on Ubuntu 14.04 and 16.04.
Also note that some states are not tested since they don't make
sense in a Docker container, mainly the service states;
these still need to be updated for systemd.

This starts updating the Salt states for Ubuntu 16.04 compatibility,
and thus helps with #462.

Also, make the tests run on Python 3.4, which is the default Python 3 on 14.04.
See commit messages for some other miscellaneous changes.


This change is Reviewable

This can potentially cause security issues.
Ubuntu 16.04 Docker images don't come with sudo.
@aneeshusa

Copy link
Copy Markdown
Contributor Author

r? @metajack

@metajack metajack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

Comment thread .travis.yml
- SALT_DOCKER_IMAGE=ubuntu@sha256:f3a61450ae43896c4332bda5e78b453f4a93179045f20c8181043b26b5e79028
os: linux
sudo: required
dist: trusty

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no longer Trusty but Xenial, no? Or are we still doing xenial testing within docker on trusty travis machines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis doesn't have Xenial machines, so we're using Xenial Docker containers on their Trusty VMs.

Comment thread .travis/install_salt.sh
"${TEMPORARY_CONFIG_DIR}/minion" /etc/salt/minion
}

SUDO=""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating this code, maybe we need a common.bash that these files include.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about doing that, but I don't think it's worth it (yet) since it's only a few lines of duplication.
Having another file also breaks the curl install.sh | bash workflow, which is nice to setup another machine.

Comment thread test.py Outdated
python_scripts = filter(is_python_script, os.scandir(test_dir))
tests = sorted([entry.name for entry in python_scripts])

# TODO(aneeshusa): switch back to scandirr

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably add a ntoe that this is needed because scandir is from python 3.5. Otherwise this knowledge of what the TODO item is will be lost.

Comment thread buildbot/master/init.sls
- twisted == 16.6.0 # NOTE: keep in sync with buildbot-slave sls
- require:
- pkg: pip
{% if grains.get('virtual_subtype', '') != 'Docker' %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we get systemd running inside docker? Not having service.running seems not great, and certainly pollutes the states.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The service.running states underneath call various commands that seem to want to do IPC to a running instance of the int system (Upstart or Systemd). In the container, there is no init process running (just the dispatch.sh inside bash), so the states fail to run. There are purportedly ways to make it all work, but I haven't found a clear guide yet, and I'd like to add at least a basic smoke test now with the option to add service.running support later.

I agree this isn't ideal, so I'm open to other ways to handle this.

Ubuntu Trusty's Python 3 package supplies 3.4,
so this makes it possibly to run the tests on Trusty machines
without manually installing Python 3.5.

To allow running inside Docker,
create our own virtualenv for Python test dependencies (e.g. `jinja2`).
Don't use the virtualenvs supplied by Travis.
Make sure to install some extra Python bits
that aren't installed by default for Docker.

Rewrite testing code to avoid APIs introduced in Python 3.5.
Use block indent and early return in tests.
More work is needed to support the cross build states.
`service.running` requires talking to init,
which is not running inside Docker.

`timezone.system` on systemd distros uses timedatectl
which also wants to talk to a running systemd,
so skip that on Docker as well.
Use pinned Docker images for 14.04 and 16.04.
Re-exec the dispatch script inside a running container
to simulate running the tests on other OSes.

This is not perfect since various states do
not function properly in containers
(mainly service-related states),
but is still better than nothing
and tests package installation, etc.
@metajack

metajack commented May 5, 2017

Copy link
Copy Markdown
Contributor

@bors-servo r+

Please file a bug about fixing the systemd issue. I'd like to make sure we eventually remove all those ifdefs :)

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit e7698df has been approved by metajack

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit e7698df with merge 85d4b83...

bors-servo pushed a commit that referenced this pull request May 5, 2017
…tajack

Use Docker for testing on Travis, start on 16.04 support

Use pinned Docker images to test our states on multiple OSes.
Currently, only `servo-linux1` is tested, on Ubuntu 14.04 and 16.04.
Also note that some states are not tested since they don't make
sense in a Docker container, mainly the `service` states;
these still need to be updated for systemd.

This starts updating the Salt states for Ubuntu 16.04 compatibility,
and thus helps with #462.

Also, make the tests run on Python 3.4, which is the default Python 3 on 14.04.
See commit messages for some other miscellaneous changes.

<!-- 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/649)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - status-travis
Approved by: metajack
Pushing 85d4b83 to master...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants