Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #121 from lxdock/fix-travis-snap
Browse files Browse the repository at this point in the history
Tests are working again on Travis using snap
  • Loading branch information
robvdl committed Mar 10, 2018
2 parents 1d1d8e8 + 755996e commit 0f347ef
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
31 changes: 18 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
sudo: required
dist: trusty
before_install:
- sudo add-apt-repository -y ppa:ubuntu-lxc/lxd-stable
- sudo apt-get -qq update
- sudo apt-get install -y lxd
- sudo lxd init --auto
- sudo lxc network create lxdbr0 ipv6.address=none ipv4.address=10.0.3.1/24 ipv4.nat=true
- sudo lxc network attach-profile lxdbr0 default eth0
- sudo chmod 777 /var/lib/lxd/unix.socket
- ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -P ""

language: python
sudo: true
dist: trusty

python:
- "3.4"
Expand All @@ -22,13 +12,28 @@ matrix:
allow_failures:
- python: "3.7-dev"

install:
- make travis-sysdeps
- ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -P ""

env:
global:
- PATH=/snap/bin:$PATH

before_script:
- sudo addgroup lxd || true
- sudo usermod -a -G lxd $USER || true
- sudo ln -s /snap/bin/lxc /usr/bin/lxc

# We set HOME because lxc needs somewhere writable to not crash during testing.
# The "sudo -E" line is needed because the user was added to the lxd group which needs to be applied.
script:
- cp -R /home/travis/.ssh $TRAVIS_BUILD_DIR
- HOME=$TRAVIS_BUILD_DIR make travis
- sudo -E sudo -u $USER -E bash -c 'source ~/virtualenv/python$TRAVIS_PYTHON_VERSION/bin/activate; HOME=$TRAVIS_BUILD_DIR make travis'

after_success:
- codecov

branches:
only:
- master
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

install:
pip install -r requirements-dev.txt
# Temporary while we need a dev version of pylxd
pip install -e .

upgrade:
pip install -r requirements-dev.txt -U
# Temporary while we need a dev version of pylxd
pip install -e . -U

lint:
Expand All @@ -22,6 +20,22 @@ coverage:
spec:
py.test --spec -p no:sugar

travis-sysdeps:
sudo apt-get update -q
sudo apt-get remove -qy lxd lxd-client
sudo apt-get -y install snapd
sudo snap install lxd
sudo snap list
sudo snap start lxd
sudo sh -c 'echo PATH=/snap/bin:$$PATH >> /etc/environment'
while [ ! -S /var/snap/lxd/common/lxd/unix.socket ]; do \
sleep 0.5; \
done
sudo lxd --version
sudo lxd init --auto
sudo lxc network create lxdbr0 ipv6.address=none ipv4.address=10.0.3.1/24 ipv4.nat=true
sudo lxc network attach-profile lxdbr0 default eth0

travis: install lint isort coverage

docs:
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ isort>=4.2
flake8>=2.2.5

# Docs
Sphinx>=1.3
Sphinx==1.5.6
sphinx-rtd-theme>=0.1
2 changes: 1 addition & 1 deletion tests/integration/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from lxdock.conf.config import Config
from lxdock.container import Container
from lxdock.exceptions import ProjectError
from lxdock.project import logger as project_logger
from lxdock.project import Project
from lxdock.project import logger as project_logger
from lxdock.test import LXDTestCase


Expand Down

0 comments on commit 0f347ef

Please sign in to comment.