From c31735b86974451ca73772bf8880ff6dd56c5854 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Thu, 7 Sep 2023 12:09:41 -0600 Subject: [PATCH] test: configuration include arrays Test for configuration include arrays being loaded at the correct location. Bug: #6300 --- tests/config-includes-array/README.md | 6 ++++++ tests/config-includes-array/af-packet.yaml | 8 ++++++++ tests/config-includes-array/suricata.yaml | 14 +++++++++++++ tests/config-includes-array/test.yaml | 24 ++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 tests/config-includes-array/README.md create mode 100644 tests/config-includes-array/af-packet.yaml create mode 100644 tests/config-includes-array/suricata.yaml create mode 100644 tests/config-includes-array/test.yaml diff --git a/tests/config-includes-array/README.md b/tests/config-includes-array/README.md new file mode 100644 index 000000000..76be123db --- /dev/null +++ b/tests/config-includes-array/README.md @@ -0,0 +1,6 @@ +# Configure Include Array Test + +Test that files included as part of array are included into the +corrent location. + +Issue: https://redmine.openinfosecfoundation.org/issues/6300 diff --git a/tests/config-includes-array/af-packet.yaml b/tests/config-includes-array/af-packet.yaml new file mode 100644 index 000000000..0c47d8323 --- /dev/null +++ b/tests/config-includes-array/af-packet.yaml @@ -0,0 +1,8 @@ +%YAML 1.1 +--- + +af-packet: + - interface: enp10s0 + cluster-id: 99 + cluster-type: cluster_flow + defrag: yes diff --git a/tests/config-includes-array/suricata.yaml b/tests/config-includes-array/suricata.yaml new file mode 100644 index 000000000..257004254 --- /dev/null +++ b/tests/config-includes-array/suricata.yaml @@ -0,0 +1,14 @@ +%YAML 1.1 +--- + +classification-file: /etc/suricata/classification.config +reference-config-file: /etc/suricata/reference.config + +# These will be included into the root of the configuration tree. +include: + - ./af-packet.yaml + +foobar: + include: + # This should be included under foobar. + - ./af-packet.yaml diff --git a/tests/config-includes-array/test.yaml b/tests/config-includes-array/test.yaml new file mode 100644 index 000000000..cd291fd08 --- /dev/null +++ b/tests/config-includes-array/test.yaml @@ -0,0 +1,24 @@ +requires: + min-version: 7 + +pcap: false + +args: + - --dump-config + +checks: + - shell: + args: grep '^af-packet.0 = interface' stdout | wc -l + expect: 1 + + - shell: + args: grep '^af-packet.0.interface = enp10s0' stdout | wc -l + expect: 1 + + - shell: + args: grep 'foobar.af-packet.0 = interface' stdout | wc -l + expect: 1 + + - shell: + args: grep 'foobar.af-packet.0.interface = enp10s0' stdout | wc -l + expect: 1 -- 2.47.2