Browse Source

Create and enable funcional testing

The funcional testing will include, per case, input files
and output files, plus a simple bash script which makes
sure the output stays as it should, and otherwise shows
a diff and fails the case.

Change-Id: I4c5f1143188f49c6a1448ca8918ab8b30710b865
Miguel Angel Ajo 6 months ago
parent
commit
222bb2a984

+ 11
- 1
.zuul.yaml View File

@@ -16,4 +16,14 @@
16 16
    templates:
17 17
      - openstack-python-jobs
18 18
      - openstack-python35-jobs
19
-     - openstack-python36-jobs
19
+     - openstack-python36-jobs
20
+   check:
21
+     jobs:
22
+       - openstack-tox-functional
23
+       - openstack-tox-functional-py35
24
+       - openstack-tox-functional-py36
25
+   gate:
26
+     jobs:
27
+       - openstack-tox-functional
28
+       - openstack-tox-functional-py35
29
+       - openstack-tox-functional-py36

+ 10
- 0
oslogmerger/tests/functional/data/01-simple/in/l3-agent.log View File

@@ -0,0 +1,10 @@
1
+2015-10-29 10:51:23.829 3667 INFO neutron.openstack.common.service [req-7a01c151-b6ff-4dd9-9fd2-9710a83bab57 None] Caught SIGTERM, exiting
2
+2015-10-29 10:51:28.862 27650 INFO neutron.common.config [-] Logging enabled!
3
+2015-10-29 10:51:28.865 27650 INFO neutron.common.config [-] /usr/bin/neutron-l3-agent version 2014.2.3-19.el7ost
4
+2015-10-29 10:51:28.916 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connecting to AMQP server on 10.12.27.29:5672
5
+2015-10-29 10:51:29.018 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connected to AMQP server on 10.12.27.29:5672
6
+2015-10-29 10:51:29.046 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connecting to AMQP server on 10.12.27.29:5672
7
+2015-10-29 10:51:29.159 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connected to AMQP server on 10.12.27.29:5672
8
+2015-10-29 10:51:29.601 27650 INFO oslo.messaging._drivers.impl_rabbit [-] Connecting to AMQP server on 10.12.27.29:5672
9
+2015-10-29 10:51:29.692 27650 INFO oslo.messaging._drivers.impl_rabbit [-] Connected to AMQP server on 10.12.27.29:5672
10
+2015-10-29 10:51:29.754 27650 INFO neutron.agent.l3_agent [-] L3 agent started

+ 5
- 0
oslogmerger/tests/functional/data/01-simple/in/metadata-agent.log View File

@@ -0,0 +1,5 @@
1
+2015-10-20 09:23:45.717 5411 INFO neutron.common.config [-] Logging enabled!
2
+2015-10-20 09:23:45.719 5411 INFO neutron.common.config [-] /usr/bin/neutron-metadata-agent version 2014.2.3-19.el7ost
3
+2015-10-20 09:23:45.801 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Starting 4 workers
4
+2015-10-20 09:23:45.808 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Started child 5498
5
+2015-10-20 09:23:45.822 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Started child 5499

+ 15
- 0
oslogmerger/tests/functional/data/01-simple/out/alias.log View File

@@ -0,0 +1,15 @@
1
+2015-10-20 09:23:45.717 [META] 5411 INFO neutron.common.config [-] Logging enabled!
2
+2015-10-20 09:23:45.719 [META] 5411 INFO neutron.common.config [-] /usr/bin/neutron-metadata-agent version 2014.2.3-19.el7ost
3
+2015-10-20 09:23:45.801 [META] 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Starting 4 workers
4
+2015-10-20 09:23:45.808 [META] 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Started child 5498
5
+2015-10-20 09:23:45.822 [META] 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Started child 5499
6
+2015-10-29 10:51:23.829 [L3] 3667 INFO neutron.openstack.common.service [req-7a01c151-b6ff-4dd9-9fd2-9710a83bab57 None] Caught SIGTERM, exiting
7
+2015-10-29 10:51:28.862 [L3] 27650 INFO neutron.common.config [-] Logging enabled!
8
+2015-10-29 10:51:28.865 [L3] 27650 INFO neutron.common.config [-] /usr/bin/neutron-l3-agent version 2014.2.3-19.el7ost
9
+2015-10-29 10:51:28.916 [L3] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connecting to AMQP server on 10.12.27.29:5672
10
+2015-10-29 10:51:29.018 [L3] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connected to AMQP server on 10.12.27.29:5672
11
+2015-10-29 10:51:29.046 [L3] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connecting to AMQP server on 10.12.27.29:5672
12
+2015-10-29 10:51:29.159 [L3] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connected to AMQP server on 10.12.27.29:5672
13
+2015-10-29 10:51:29.601 [L3] 27650 INFO oslo.messaging._drivers.impl_rabbit [-] Connecting to AMQP server on 10.12.27.29:5672
14
+2015-10-29 10:51:29.692 [L3] 27650 INFO oslo.messaging._drivers.impl_rabbit [-] Connected to AMQP server on 10.12.27.29:5672
15
+2015-10-29 10:51:29.754 [L3] 27650 INFO neutron.agent.l3_agent [-] L3 agent started

+ 15
- 0
oslogmerger/tests/functional/data/01-simple/out/no-alias.log View File

@@ -0,0 +1,15 @@
1
+2015-10-20 09:23:45.717 [oslogmerger/tests/functional/data/01-simple/in/metadata-agent.log] 5411 INFO neutron.common.config [-] Logging enabled!
2
+2015-10-20 09:23:45.719 [oslogmerger/tests/functional/data/01-simple/in/metadata-agent.log] 5411 INFO neutron.common.config [-] /usr/bin/neutron-metadata-agent version 2014.2.3-19.el7ost
3
+2015-10-20 09:23:45.801 [oslogmerger/tests/functional/data/01-simple/in/metadata-agent.log] 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Starting 4 workers
4
+2015-10-20 09:23:45.808 [oslogmerger/tests/functional/data/01-simple/in/metadata-agent.log] 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Started child 5498
5
+2015-10-20 09:23:45.822 [oslogmerger/tests/functional/data/01-simple/in/metadata-agent.log] 5411 INFO neutron.openstack.common.service [req-7522c96c-2b7c-4f99-9d14-fde98e04da25 None] Started child 5499
6
+2015-10-29 10:51:23.829 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 3667 INFO neutron.openstack.common.service [req-7a01c151-b6ff-4dd9-9fd2-9710a83bab57 None] Caught SIGTERM, exiting
7
+2015-10-29 10:51:28.862 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO neutron.common.config [-] Logging enabled!
8
+2015-10-29 10:51:28.865 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO neutron.common.config [-] /usr/bin/neutron-l3-agent version 2014.2.3-19.el7ost
9
+2015-10-29 10:51:28.916 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connecting to AMQP server on 10.12.27.29:5672
10
+2015-10-29 10:51:29.018 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connected to AMQP server on 10.12.27.29:5672
11
+2015-10-29 10:51:29.046 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connecting to AMQP server on 10.12.27.29:5672
12
+2015-10-29 10:51:29.159 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO oslo.messaging._drivers.impl_rabbit [req-6afee29e-f17a-4168-8f7b-fcaea6609e4e ] Connected to AMQP server on 10.12.27.29:5672
13
+2015-10-29 10:51:29.601 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO oslo.messaging._drivers.impl_rabbit [-] Connecting to AMQP server on 10.12.27.29:5672
14
+2015-10-29 10:51:29.692 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO oslo.messaging._drivers.impl_rabbit [-] Connected to AMQP server on 10.12.27.29:5672
15
+2015-10-29 10:51:29.754 [oslogmerger/tests/functional/data/01-simple/in/l3-agent.log] 27650 INFO neutron.agent.l3_agent [-] L3 agent started

+ 39
- 0
oslogmerger/tests/functional/functional.sh View File

@@ -0,0 +1,39 @@
1
+#!/bin/sh
2
+
3
+DATA=oslogmerger/tests/functional/data
4
+
5
+fail_func() {
6
+   echo FAILED test case $1 with output file $2
7
+   rm -rf $3
8
+   exit 1
9
+}
10
+
11
+run_test() {
12
+
13
+   TEST=$1
14
+   OUT_FILE=$2
15
+   IN=$DATA/$TEST/in
16
+   OUT=$DATA/$TEST/out
17
+   TMP=$(mktemp -d)
18
+
19
+   shift 2
20
+
21
+   # replace TDATA with the "in" directory for the test
22
+   PARAMS=$(echo $* | sed --expression=s%TDATA%${IN}%g)
23
+
24
+   # run os-log-merger capturing the output, then compare to what we expected
25
+   os-log-merger $PARAMS >$TMP/out.log
26
+
27
+   diff -u $OUT/$OUT_FILE $TMP/out.log || fail_func $TEST $OUT_FILE $TMP
28
+
29
+   echo PASSED test case $TEST / $OUT_FILE
30
+   rm -rf $TMP
31
+
32
+}
33
+
34
+run_test 01-simple no-alias.log TDATA/metadata-agent.log TDATA/l3-agent.log
35
+run_test 01-simple alias.log  TDATA/metadata-agent.log:META TDATA/l3-agent.log:L3
36
+
37
+
38
+
39
+

+ 32
- 0
tox.ini View File

@@ -37,6 +37,38 @@ whitelist_externals =
37 37
 [testenv:venv]
38 38
 commands = {posargs}
39 39
 
40
+[testenv:functional]
41
+basepython = python2.7
42
+commands=
43
+  sh ./oslogmerger/tests/functional/functional.sh
44
+whitelist_externals =
45
+  sh
46
+  bash
47
+
48
+[testenv:functional-py35]
49
+basepython = python3.5
50
+commands=
51
+  sh ./oslogmerger/tests/functional/functional.sh
52
+whitelist_externals =
53
+  sh
54
+  bash
55
+
56
+[testenv:functional-py36]
57
+basepython = python3.6
58
+commands=
59
+  sh ./oslogmerger/tests/functional/functional.sh
60
+whitelist_externals =
61
+  sh
62
+  bash
63
+
64
+[testenv:functional-py37]
65
+basepython = python3.7
66
+commands=
67
+  sh ./oslogmerger/tests/functional/functional.sh
68
+whitelist_externals =
69
+  sh
70
+  bash
71
+
40 72
 [flake8]
41 73
 # E125 continuation line does not distinguish itself from next logical line
42 74
 # E126 continuation line over-indented for hanging indent

Loading…
Cancel
Save