resurrecting a minimal test infra - starting with linux node and application
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 15 Oct 2015 14:33:14 +0000 (16:33 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 15 Oct 2015 14:33:14 +0000 (16:33 +0200)
Makefile
test/infra-setup.md [new file with mode: 0644]
test/resources/linux/application.py
test/resources/linux/node.py

index bafeed9..aa5cb1d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,9 @@
 SRCDIR      = $(CURDIR)/src
 TESTDIR     = $(CURDIR)/test
 TESTLIB     = $(TESTDIR)/lib
-BUILDDIR    = $(CURDIR)/build
+BUILDDIR    = $(CURDIR)/build/lib
 DISTDIR     = $(CURDIR)/dist
 
-SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; \
-             print "lib.%s-%s" % (distutils.util.get_platform(), \
-             sys.version[0:3])')
-PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \
-    print (1 if v[0] <= 2 and v[1] <= 5 else 0)')
-
-ifeq ($(PYTHON25),0)
-BUILDDIR := $(BUILDDIR)/$(SUBBUILDDIR)
-else
-BUILDDIR := $(BUILDDIR)/lib
-endif
-
 PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH)
 COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \
           coverage)
@@ -33,9 +21,19 @@ test: all
               PYTHONPATH="$(PYPATH)" $$i -v || retval=$$?; \
               done; exit $$retval
 
+ifeq ($(file),)
+test-one:
+       echo Run $(make) $@ file=test/some/path
+else
 test-one: all
        echo $(file) $(case)
        PYTHONPATH="$(PYPATH)" $(file) $(case)
+endif
+
+test-app:
+       $(MAKE) test-one file=test/resources/linux/application.py case=$(case)
+test-node:
+       $(MAKE) test-one file=test/resources/linux/node.py case=$(case)
 
 coverage: all
        rm -f .coverage
@@ -48,7 +46,7 @@ coverage: all
        rm -f .coverage
 
 clean:
-       rm -f `find -name \*.pyc` .coverage *.pcap
+       rm -f $$(find . -name '*.pyc') .coverage *.pcap
        rm -rf "$(BUILDDIR)"
 
 distclean: clean
diff --git a/test/infra-setup.md b/test/infra-setup.md
new file mode 100644 (file)
index 0000000..3b5a6dd
--- /dev/null
@@ -0,0 +1,36 @@
+# Test infra setup
+
+As a first attempt to resurrect even if partially some automated tests for nepi, I have
+
+* focused on the unit tests about
+
+* created 2 VMs (in stupeflip)
+* named `fedora` (f22) and `ubuntu` (vivid)
+
+# fedora
+
+    create-vm.sh -f f22 fedora
+    lce fedora
+    adduser inria_nepi
+    yum -y install wget rsync
+        chmod 4755 /bin/ping
+        cat > /etc/sudoers.d/inria_nepi << EOF
+    inria_nepi ALL=(ALL) NOPASSWD: ALL
+    EOF
+    
+# ubuntu
+
+Essentially identical, except
+
+* based on vivid (this is 1 week before wily..)
+* `adduser -m inria_nepi` otherwise no homedir is created
+* no need to mess with `ping`
+* `wget` was already there; did install `rsync` although I have no immediate need for it
+
+# results
+
+with all this in place, and with official release 3.2.8 I am getting, referring to `make` targets
+
+* `test-node` : 19 tests passed in 194s
+* `test-app` : 15 tests passed in 170s
+  
\ No newline at end of file
index 4bda4f9..f98c1c6 100755 (executable)
@@ -31,13 +31,13 @@ import unittest
 
 class LinuxApplicationTestCase(unittest.TestCase):
     def setUp(self):
-        self.fedora_host = "nepi2.pl.sophia.inria.fr"
+        self.fedora_host = "fedora.pl.sophia.inria.fr"
         self.fedora_user = "inria_nepi"
 
-        self.ubuntu_host = "roseval.pl.sophia.inria.fr"
+        self.ubuntu_host = "ubuntu.pl.sophia.inria.fr"
         self.ubuntu_user = "inria_nepi"
         
-        self.target = "nepi5.pl.sophia.inria.fr"
+        self.target = "nepi.pl.sophia.inria.fr"
 
     @skipIfNotAlive
     def t_stdout(self, host, user):
@@ -238,8 +238,8 @@ main (void)
         ec.set(node, "cleanExperiment", True)
         ec.set(node, "cleanProcesses", True)
 
-        sources = "http://yans.pl.sophia.inria.fr/code/nef/archive/tip.tar.gz;" \
-                "http://yans.pl.sophia.inria.fr/code/nef/raw-file/8ace577d4079/src/nef/images/menu/connect.png"
+        sources = "http://mirror.onelab.eu/third-party/nepi-tip.tgz;" \
+                "http://mirror.onelab.eu/third-party/nepi-connect.png"
 
         app = ec.register_resource("linux::Application")
         ec.set(app, "sources", sources)
@@ -261,12 +261,12 @@ main (void)
         self.assertTrue(exitcode.strip() == "0")
         
         out = ec.trace(app, "deploy_stdout")
-        self.assertTrue(out.find("tip.tar.gz") > -1)
-        self.assertTrue(out.find("connect.png") > -1)
+        self.assertTrue(out.find("nepi-tip.tgz") > -1)
+        self.assertTrue(out.find("nepi-connect.png") > -1)
 
         stdout = ec.trace(app, "stdout")
-        self.assertTrue(stdout.find("tip.tar.gz") > -1)
-        self.assertTrue(stdout.find("connect.png") > -1)
+        self.assertTrue(stdout.find("nepi-tip.tgz") > -1)
+        self.assertTrue(stdout.find("nepi-connect.png") > -1)
 
         ec.shutdown()
 
index 11b66bb..02a2733 100755 (executable)
@@ -31,13 +31,13 @@ import unittest
 
 class LinuxNodeTestCase(unittest.TestCase):
     def setUp(self):
-        self.fedora_host = "nepi2.pl.sophia.inria.fr"
+        self.fedora_host = "fedora.pl.sophia.inria.fr"
         self.fedora_user = "inria_nepi"
 
-        self.ubuntu_host = "roseval.pl.sophia.inria.fr"
+        self.ubuntu_host = "ubuntu.pl.sophia.inria.fr"
         self.ubuntu_user = "inria_nepi"
         
-        self.target = "nepi5.pl.sophia.inria.fr"
+        self.target = "nepi.pl.sophia.inria.fr"
 
     @skipIfNotAlive
     def t_execute(self, host, user):