Browse Source

Use common tools to run tests

In order to correspond to global requirements and integrate
deeper with OpenStack CI this patch switches network-checker
from py.test and unittest2 to testrepository and oslotest.

Change-Id: Iabc71a0c58caab354cabbe90691a790c0cab46f0
Partial-bug: #1469045
Roman Prykhodchenko 3 years ago
parent
commit
5ae462d039
4 changed files with 29 additions and 27 deletions
  1. 5
    0
      .testr.conf
  2. 0
    22
      run_tests.sh
  3. 2
    4
      test-requirements.txt
  4. 22
    1
      tox.ini

+ 5
- 0
.testr.conf View File

@@ -0,0 +1,5 @@
1
+[DEFAULT]
2
+test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -s ${OS_TEST_PATH:-dhcp_checker/tests/ url_access_checker/tests/} -p "*.py" $LISTOPT $IDOPTION
3
+test_id_option=--load-list $IDFILE
4
+test_list_option=--list
5
+test_run_concurrency=echo 1

+ 0
- 22
run_tests.sh View File

@@ -1,22 +0,0 @@
1
-#!/bin/bash
2
-
3
-#    Copyright 2015 Mirantis, Inc.
4
-#
5
-#    This program is free software; you can redistribute it and/or modify
6
-#    it under the terms of the GNU General Public License as published by
7
-#    the Free Software Foundation; either version 2 of the License, or
8
-#    (at your option) any later version.
9
-#
10
-#    This program is distributed in the hope that it will be useful,
11
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
-#    GNU General Public License for more details.
14
-#
15
-#    You should have received a copy of the GNU General Public License along
16
-#    with this program; if not, write to the Free Software Foundation, Inc.,
17
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
-
19
-set -e
20
-set -x
21
-
22
-tox -v

+ 2
- 4
test-requirements.txt View File

@@ -2,10 +2,8 @@
2 2
 # of appearance. Changing the order has an impact on the overall integration
3 3
 # process, which may cause wedges in the gate later.
4 4
 hacking<0.11,>=0.10.2 # Apache-2.0
5
+os-testr>=0.4.1 # Apache-2.0
6
+oslotest>=1.10.0 # Apache-2.0
5 7
 mock>=1.2 # BSD
6 8
 unittest2 # BSD
7 9
 requests-mock>=0.7.0 # Apache-2.0
8
-
9
-# Packages beyond this line are not in Global Requirements list
10
-# and must be added there or replaced.
11
-pytest

+ 22
- 1
tox.ini View File

@@ -8,7 +8,28 @@ usedevelop = True
8 8
 setenv = VIRTUAL_ENV={envdir}
9 9
 deps = -r{toxinidir}/requirements.txt
10 10
        -r{toxinidir}/test-requirements.txt
11
-commands = py.test {toxinidir}/url_access_checker/tests
11
+commands = ostestr
12
+
13
+[testenv:vde]
14
+whitelist_externals =
15
+    bash
16
+    python
17
+setenv =
18
+    {[testenv]setenv}
19
+    NET_CHECK_IFACE_1=tap11
20
+    NET_CHECK_IFACE_2=tap12
21
+commands =
22
+    bash -c "ip tuntap add dev tap11 mode tap"
23
+    bash -c "ip tuntap add dev tap12 mode tap"
24
+    bash -c "vde_switch -p '{toxinidir}/vde_network_checker.pid' -d -tap tap11 -tap tap12"
25
+    bash -c "ifconfig tap11 up"
26
+    bash -c "ifconfig tap12 up"
27
+    {[testenv]commands}
28
+    bash -c "kill -15 $(cat '{toxinidir}/vde_network_checker.pid')"
29
+    bash -c "ifconfig tap11 down"
30
+    bash -c "ifconfig tap12 down"
31
+    bash -c "ip link delete tap11"
32
+    bash -c "ip link delete tap12"
12 33
 
13 34
 [testenv:pep8]
14 35
 commands =

Loading…
Cancel
Save