1
0
mirror of https://github.com/rancher/os.git synced 2025-09-03 15:54:24 +00:00

test custom kernel and docker build and boot

This commit is contained in:
Ivan Mikushin
2015-09-09 18:53:04 +05:00
parent 0c196f557b
commit 168d340b76
7 changed files with 66 additions and 12 deletions

View File

@@ -9,4 +9,4 @@ fi
docker build -t ros-build-base -f Dockerfile.build-base .
docker build -t ros-build -f Dockerfile.build .
./scripts/docker-run.sh make -f Makefile.docker build-all integration-tests
./scripts/docker-run.sh --name ros-ci make -f Makefile.docker build-all integration-tests

View File

@@ -24,6 +24,9 @@ while [ "$#" -gt 0 ]; do
rm $NAME
DOCKER_ARGS="${DOCKER_ARGS} --rm"
;;
-t)
DOCKER_ARGS="${DOCKER_ARGS} -t"
;;
*)
break
;;

View File

@@ -0,0 +1,6 @@
IMAGE_NAME=rancher/os
VERSION=v0.4.0-test
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.8.2-rc1-ros/docker-1.8.2-rc1
KERNEL_URL=https://github.com/imikushin/os-kernel/releases/download/4.2/linux-4.2.0-rancher-x86.tar.gz
DFS_IMAGE=rancher/docker:1.8.1

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -ex
cd $(dirname $0)/../../../..
cp ./tests/integration/assets/test_02/build.conf ./
make -f Makefile.docker minimal
exec ./scripts/run

View File

@@ -10,19 +10,9 @@ def qemu(request):
return u.run_qemu(request)
def rancheros_version():
with open('./build.conf') as f:
for v in it.ifilter(u.non_empty,
it.imap(u.parse_value('VERSION'),
it.ifilter(u.non_empty,
it.imap(u.strip_comment('#'), u.iter_lines(f))))):
return v
raise RuntimeError("Could not parse RancherOS version")
@pytest.mark.timeout(30)
def test_system_boot(qemu):
version = rancheros_version()
version = u.rancheros_version('./build.conf')
print('parsed version: ' + version)
def has_ros_started_substr(s):

View File

@@ -0,0 +1,35 @@
from __future__ import print_function
import itertools as it
import pytest
import subprocess
import rancherostest.util as u
@pytest.fixture(scope="module")
def build_and_run(request):
print('\nBuilding and running RancherOS with custom kernel')
p = subprocess.Popen(['./scripts/docker-run.sh', '--rm',
'./tests/integration/assets/test_02/test-custom-kernel.sh'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
def fin():
print('\nTerminating docker-run test-custom-kernel')
p.terminate()
request.addfinalizer(fin)
return p
@pytest.mark.timeout(30)
def test_system_boot(build_and_run):
version = u.rancheros_version('./tests/integration/assets/test_02/build.conf')
print('parsed version: ' + version)
def has_ros_started_substr(s):
return str.find(s, 'RancherOS {v} started'.format(v=version)) > -1
for _ in it.ifilter(has_ros_started_substr,
it.imap(u.with_effect(print), u.iter_lines(build_and_run.stdout))):
assert True
return
assert False

View File

@@ -33,6 +33,16 @@ def with_effect(p):
return effect
def rancheros_version(build_conf):
with open(build_conf) as f:
for v in it.ifilter(non_empty,
it.imap(parse_value('VERSION'),
it.ifilter(non_empty,
it.imap(strip_comment('#'), iter_lines(f))))):
return v
raise RuntimeError("Could not parse RancherOS version")
def run_qemu(request, run_args=[]):
subprocess.check_call('rm -f ./state/empty-hd.img', shell=True)
print('\nrm ./state/*')