further restructureing of tests
diff --git a/README.md b/README.md
index 6d54ca5..7016a22 100755
--- a/README.md
+++ b/README.md
@@ -89,7 +89,7 @@
### Run Unit Tests
* `cd ~/son-emu`
-* `sudo py.test -v src/emuvim` (equivalent to `python setup.py test -v --addopts 'src/emuvim'` but with direct access to the commandline arguments)
+* `sudo py.test -v src/emuvim/test/unittests`
### CLI
* [Full CLI command documentation](https://github.com/sonata-nfv/son-emu/wiki/CLI-Command-Overview)
diff --git a/src/emuvim/test/unittests/test_resourcemodel.py b/src/emuvim/test/unittests/test_resourcemodel.py
index a1d273c..165893d 100644
--- a/src/emuvim/test/unittests/test_resourcemodel.py
+++ b/src/emuvim/test/unittests/test_resourcemodel.py
@@ -1,5 +1,6 @@
import time
import os
+import unittest
from emuvim.test.base import SimpleTestTopology
from emuvim.dcemulator.resourcemodel import BaseResourceModel, ResourceFlavor, NotEnoughResourcesAvailable, ResourceModelRegistrar
from emuvim.dcemulator.resourcemodel.upb.simple import UpbSimpleCloudDcRM, UpbOverprovisioningCloudDcRM, UpbDummyRM
@@ -211,15 +212,13 @@
rm.free(c1)
self.assertTrue(rm.dc_alloc_cu == 0)
+ @unittest.skipIf(os.environ.get("SON_EMU_IN_DOCKER") is not None,
+ "skipping test when running inside Docker container")
def testInRealTopo(self):
"""
Start a real container and check if limitations are really passed down to Conteinernet.
: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
diff --git a/src/emuvim/test/integrationtests/test_sonata_dummy_gatekeeper.py b/src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py
similarity index 81%
rename from src/emuvim/test/integrationtests/test_sonata_dummy_gatekeeper.py
rename to src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py
index 33a1d57..428a51f 100644
--- a/src/emuvim/test/integrationtests/test_sonata_dummy_gatekeeper.py
+++ b/src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py
@@ -6,11 +6,12 @@
from emuvim.test.base import SimpleTestTopology
from emuvim.api.sonata import SonataDummyGatekeeperEndpoint
-
+PACKAGE_PATH = "misc/sonata-demo-docker.son"
class testSonataDummyGatekeeper(SimpleTestTopology):
- @unittest.skip("disabled test since ubuntu:trusty not used in current example package")
+ @unittest.skipIf(os.environ.get("SON_EMU_IN_DOCKER") is None,
+ "skipping dummy GK test in local environment")
def testAPI(self):
# create network
self.createNet(nswitches=0, ndatacenter=2, nhosts=2, ndockers=0)
@@ -28,22 +29,12 @@
self.startNet()
time.sleep(1)
- # download example from GitHub
- print "downloading latest son-demo.son from GitHub"
- subprocess.call(
- ["wget",
- "http://github.com/sonata-nfv/son-schema/blob/master/package-descriptor/examples/sonata-demo.son?raw=true",
- "-O",
- "son-demo.son"]
- )
-
print "starting tests"
# board package
- files = {"package": open("son-demo.son", "rb")}
+ files = {"package": open(PACKAGE_PATH, "rb")}
r = requests.post("http://127.0.0.1:5000/packages", files=files)
self.assertEqual(r.status_code, 200)
self.assertTrue(r.json().get("service_uuid") is not None)
- os.remove("son-demo.son")
# instantiate service
service_uuid = r.json().get("service_uuid")
diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile
index 7270ab5..ef6c8fb 100644
--- a/utils/docker/Dockerfile
+++ b/utils/docker/Dockerfile
@@ -15,3 +15,5 @@
&& echo 'Done'
ENTRYPOINT ["/son-emu/utils/docker/entrypoint.sh"]
+
+EXPORT
\ No newline at end of file