]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
Add test to .gitlab-ci.yml
authorLukáš Ježek <lukas.jezek@nic.cz>
Fri, 28 Feb 2020 10:50:26 +0000 (11:50 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Wed, 27 May 2020 08:12:40 +0000 (10:12 +0200)
.gitlab-ci.yml
tests/packaging/test_packaging.py

index 2dc91d270e41fa59f73b842e8fe955277204b7e4..4e2ddfb6df48c2e748720f06e962ee0e1d7044c9 100644 (file)
@@ -441,6 +441,14 @@ resperf:iter.udp-asan:
   <<: *resperf
   variables:
     RESPERF_TEST: resperf.iter.udp
+
+packaging:
+  stage: extended
+  tags:
+    - dind
+  script:
+    - pytest -r fEsxX tests/packaging
+
 # }}}
 
 # deploy {{{
index 32d4e7a4abc883a856debf2aa090f44731f5f4ed..2aaaf7260c19b9bf62bca0842d2623f26485257c 100644 (file)
@@ -35,7 +35,12 @@ class ContainerHandler():
         self.container.kill()
 
     def exec_cmd(self, cmd, workdir):
-        rcode, out = self.container.exec_run('/bin/sh -c \'' + cmd + '\'', workdir=workdir)
+        # workaround: When exec_run is called in GitLab CI/CD workdir argument doesn't work.
+        inter_cmd=''
+        if workdir is not None:
+            inter_cmd = 'cd {}; '.format(workdir)
+
+        rcode, out = self.container.exec_run('/bin/sh -c \'' + inter_cmd + cmd + '\'')
         if rcode != 0:
             raise DockerCmdError(rcode, out)
 
@@ -366,9 +371,9 @@ def test_collect(module, buildenv, tmp_path):
         # run test
         if os.path.isfile(os.path.join(module_dir, 'test.config')):
             ch.exec_cmd('/root/kresd/install_packaging/sbin/kresd -n -c ' + os.path.join('..',
-                        module, 'test.config'), '/root/kresd/install_packaging')
+                        module, 'test.config'), '/root/kresd/install_packaging/')
         elif os.path.isfile(os.path.join(module_dir, 'test.sh')):
-            ch.exec_cmd('/bin/sh -c ' + os.path.join('..', module, 'test.sh'),
+            ch.exec_cmd(os.path.join('..', module, 'test.sh'),
                         '/root/kresd/install_packaging/')
         else:
             ch.stop()