]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test: configuration include arrays 1388/head
authorJason Ish <jason.ish@oisf.net>
Thu, 7 Sep 2023 18:09:41 +0000 (12:09 -0600)
committerVictor Julien <victor@inliniac.net>
Fri, 15 Sep 2023 15:08:59 +0000 (17:08 +0200)
Test for configuration include arrays being loaded at the correct
location.

Bug: #6300

tests/config-includes-array/README.md [new file with mode: 0644]
tests/config-includes-array/af-packet.yaml [new file with mode: 0644]
tests/config-includes-array/suricata.yaml [new file with mode: 0644]
tests/config-includes-array/test.yaml [new file with mode: 0644]

diff --git a/tests/config-includes-array/README.md b/tests/config-includes-array/README.md
new file mode 100644 (file)
index 0000000..76be123
--- /dev/null
@@ -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 (file)
index 0000000..0c47d83
--- /dev/null
@@ -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 (file)
index 0000000..2570042
--- /dev/null
@@ -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 (file)
index 0000000..cd291fd
--- /dev/null
@@ -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