summaryrefslogtreecommitdiffstats
path: root/tests/docker-centos-7/run.sh
blob: 23e52f0c76da7ef9e093b17954ab40c551abf07e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /bin/sh

set -e
set -x

# Test the commands in a scenario a user might.
test_commands() {
    # Cleanup.
    rm -rf /var/lib/suricata

    suricata-update
    test -e /var/lib/suricata/rules/suricata.rules

    suricata-update update-sources
    test -e /var/lib/suricata/update/cache/index.yaml

    suricata-update enable-source oisf/trafficid
    test -e /var/lib/suricata/update/sources/et-open.yaml
    test -e /var/lib/suricata/update/sources/oisf-trafficid.yaml
    suricata-update

    suricata-update disable-source oisf/trafficid
    test ! -e /var/lib/suricata/update/sources/oisf-trafficid.yaml
    test -e /var/lib/suricata/update/sources/oisf-trafficid.yaml.disabled

    suricata-update remove-source oisf/trafficid
    test ! -e /var/lib/suricata/update/sources/oisf-trafficid.yaml.disabled
}

# Python 2 unit tests.
PYTHONPATH=. ${PYTEST2}

# Python 3 unit tests.
PYTHONPATH=. ${PYTEST3}

# Install with Python 2.
${PIP2} install .
test -e /usr/bin/suricata-update

test_commands

# Uninstall Python 2 version.
${PIP2} uninstall --yes suricata-update
test ! -e /usr/bin/suricata-update

# Install and run with Python 3.
${PIP3} install .
test -e /usr/bin/suricata-update
grep python3 -s /usr/bin/suricata-update

test_commands

${PIP3} uninstall --yes suricata-update
test ! -e /usr/local/bin/suricata-update