From: peusterm Date: Sat, 16 Apr 2016 14:48:12 +0000 (+0200) Subject: Improved test to be skipped when executed within a container. X-Git-Tag: v3.1~145^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=3055e70eb50125372d5f7b8892b185f8e6e7349b;p=osm%2Fvim-emu.git Improved test to be skipped when executed within a container. --- diff --git a/src/emuvim/test/test_resourcemodel_api.py b/src/emuvim/test/test_resourcemodel_api.py index 22d3c6f..a11bc8b 100644 --- a/src/emuvim/test/test_resourcemodel_api.py +++ b/src/emuvim/test/test_resourcemodel_api.py @@ -1,4 +1,5 @@ import time +import os from emuvim.test.base import SimpleTestTopology from emuvim.dcemulator.resourcemodel import BaseResourceModel, ResourceFlavor from emuvim.dcemulator.resourcemodel.upb.simple import UpbSimpleCloudDcRM @@ -218,6 +219,10 @@ class testUpbSimpleCloudDcRM(SimpleTestTopology): Start a real container and check if limitations are really passed down to Dockernet. :return: """ + # ATTENTION: This test should only be executed if emu runs not inside a Docker container, + # because it manipulates cgroups. + if os.environ.get("SON_EMU_IN_DOCKER") is not None: + return # create network self.createNet(nswitches=0, ndatacenter=1, nhosts=2, ndockers=0) # setup links @@ -244,7 +249,7 @@ class testUpbSimpleCloudDcRM(SimpleTestTopology): # check if there is a real limitation set for containers cgroup # deactivated for now, seems not to work in docker-in-docker setup used in CI - #self.assertEqual(float(tc1.cpu_quota)/tc1.cpu_period, 0.005) + self.assertEqual(float(tc1.cpu_quota)/tc1.cpu_period, 0.005) # check if free was called during stopCompute self.dc[0].stopCompute("tc1") diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile index d71a53d..2c1bda6 100644 --- a/utils/docker/Dockerfile +++ b/utils/docker/Dockerfile @@ -1,5 +1,7 @@ FROM cgeoffroy/dockernet +ENV SON_EMU_IN_DOCKER 1 + # ensure that we have the latest dockernet code base! WORKDIR / RUN rm -rf dockernet