]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: convert check.sh to test.yaml
authorJason Ish <jason.ish@oisf.net>
Mon, 20 Sep 2021 17:43:49 +0000 (11:43 -0600)
committerJason Ish <jason.ish@oisf.net>
Sun, 10 Oct 2021 05:09:47 +0000 (23:09 -0600)
50 files changed:
tests/datasets-05-state/check.sh [deleted file]
tests/datasets-05-state/test.yaml
tests/detect-filestore-config-01/check.sh [deleted file]
tests/detect-filestore-config-01/test.yaml
tests/detect-filestore-config-02/check.sh [deleted file]
tests/detect-filestore-config-02/test.yaml
tests/detect-filestore-config-03/check.sh [deleted file]
tests/detect-filestore-config-03/test.yaml
tests/detect-filestore-config-04/check.sh [deleted file]
tests/detect-filestore-config-04/test.yaml
tests/dnp3-dnp3_data-alert/check.sh [deleted file]
tests/dnp3-dnp3_data-alert/test.yaml
tests/dnp3-dnp3_func-alert/check.sh [deleted file]
tests/dnp3-dnp3_func-alert/test.yaml
tests/dns-eve-v1/check.sh [deleted file]
tests/dns-eve-v1/test.yaml
tests/dns-json-log/check.sh [deleted file]
tests/dns-json-log/test.yaml
tests/dns-single-request-v1/check.sh [deleted file]
tests/dns-single-request-v1/test.yaml
tests/dns-tcp-multirequest-buffer-v1/check.sh [deleted file]
tests/dns-tcp-multirequest-buffer-v1/test.yaml
tests/dns-udp-eve-log-aaaa-only-v1/check.sh [deleted file]
tests/dns-udp-eve-log-aaaa-only-v1/test.yaml
tests/dns-udp-eve-log-answer-only-v1/check.sh [deleted file]
tests/dns-udp-eve-log-answer-only-v1/test.yaml
tests/dns-udp-eve-log-mx-only-v1/check.sh [deleted file]
tests/dns-udp-eve-log-mx-only-v1/test.yaml
tests/dns-udp-eve-log-query-only-v1/check.sh [deleted file]
tests/dns-udp-eve-log-query-only-v1/test.yaml
tests/linktype-228/check.sh [deleted file]
tests/linktype-228/test.yaml
tests/lua-output-dns/check.sh [deleted file]
tests/lua-output-dns/test.yaml
tests/lua-output-http/check.sh [deleted file]
tests/lua-output-http/test.yaml
tests/lua-output-smtp/check.sh [deleted file]
tests/lua-output-smtp/test.yaml
tests/output-eve-fileinfo/check.sh [deleted file]
tests/output-eve-fileinfo/test.yaml
tests/output-pcap-log/check.sh [deleted file]
tests/output-pcap-log/test.yaml [new file with mode: 0644]
tests/proto-mismatch-http-ssh/check.sh [deleted file]
tests/proto-mismatch-http-ssh/test.yaml
tests/tls-fingerprint-alert/check.sh [deleted file]
tests/tls-fingerprint-alert/test.yaml
tests/tls-json-output-ids/check.sh [deleted file]
tests/tls-json-output-ids/test.yaml
tests/tls-json-output-ips/check.sh [deleted file]
tests/tls-json-output-ips/test.yaml

diff --git a/tests/datasets-05-state/check.sh b/tests/datasets-05-state/check.sh
deleted file mode 100755 (executable)
index 97d6dce..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec cmp ${OUTPUT_DIR}/state.csv ${TEST_DIR}/expected/state.csv
index dddcc0047fa92e3bb7374399387c1c7954a1faae..0ccb0b9f6f399de07d41e9434af817ee343b4725 100644 (file)
@@ -9,3 +9,8 @@ command: |
       --set reference-config-file="${SRCDIR}/reference.config" -l ${OUTPUT_DIR}         \
       -c "${SRCDIR}/suricata.yaml" -r ${TEST_DIR}/input.pcap -S ${TEST_DIR}/test.rules  \
       --data-dir="${OUTPUT_DIR}"
+
+checks:
+  - file-compare:
+      filename: state.csv
+      expected: expected/state.csv
diff --git a/tests/detect-filestore-config-01/check.sh b/tests/detect-filestore-config-01/check.sh
deleted file mode 100755 (executable)
index a174e47..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-if  grep -q "Warning: Rule requires file-store but the output file-store is not enabled." $OUTPUT_DIR/rules_analysis.txt; then
-    echo "Pattern found in rules_analysis.txt"
-    exit 1
-fi
index bf6ff6c0e997a468fadab8339d31adcd61b5fba4..8e70e771f1026a8cdbfc1a47434dde8281adaa0b 100644 (file)
@@ -7,3 +7,8 @@ command: |
   ${SRCDIR}/src/suricata --set classification-file="${SRCDIR}/classification.config"    \
       --set reference-config-file="${SRCDIR}/reference.config" -l ${OUTPUT_DIR}         \
       -c "${TEST_DIR}/suricata.yaml" -S ${TEST_DIR}/test.rules --engine-analysis
+
+checks:
+  - shell:
+      args: |
+        grep -v -q "Warning: Rule requires file-store but the output file-store is not enabled." rules_analysis.txt
diff --git a/tests/detect-filestore-config-02/check.sh b/tests/detect-filestore-config-02/check.sh
deleted file mode 100755 (executable)
index d72cab9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-if ! grep -q "Warning: Rule requires file-store but the output file-store is not enabled." $OUTPUT_DIR/rules_analysis.txt; then
-    echo "Pattern not found"
-    exit 1
-fi
-exit 0
index b5a54d96da95483f3aa3b6040ad0eea8e70cff9c..7b3774b14987db6059f0e80ed3cda45e650320e4 100644 (file)
@@ -7,3 +7,8 @@ command: |
   ${SRCDIR}/src/suricata --set classification-file="${SRCDIR}/classification.config"    \
       --set reference-config-file="${SRCDIR}/reference.config" -l ${OUTPUT_DIR}         \
       -c "${TEST_DIR}/suricata.yaml" -S ${TEST_DIR}/test.rules --engine-analysis
+
+checks:
+  - shell:
+      args: |
+        grep -q "Warning: Rule requires file-store but the output file-store is not enabled." rules_analysis.txt
diff --git a/tests/detect-filestore-config-03/check.sh b/tests/detect-filestore-config-03/check.sh
deleted file mode 100755 (executable)
index 6feafbc..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-if grep  '\[ERRCODE: SC_WARN_ALERT_CONFIG(324)\] - One or more rule(s) depends on the file-store output log which is not enabled. Enable the output "file-store"' $OUTPUT_DIR/stdout; then
-    echo "pattern found in stdout"
-    exit 1
-fi
index f7fa7c9c40961b878e12b0090d48e62205573876..f991f0efdb7a741632d824dd5cbaf877c1096905 100644 (file)
@@ -2,3 +2,8 @@ requires:
   min-version: 5.0.1
   features:
     - HAVE_NSS
+
+checks:
+  - shell:
+      args: |
+        grep -v '\[ERRCODE: SC_WARN_ALERT_CONFIG(324)\] - One or more rule(s) depends on the file-store output log which is not enabled. Enable the output "file-store"' stdout
diff --git a/tests/detect-filestore-config-04/check.sh b/tests/detect-filestore-config-04/check.sh
deleted file mode 100755 (executable)
index 375298b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-if ! grep  -q 'One or more rule(s) depends on the file-store output log which is not enabled. Enable the output "file-store"' $OUTPUT_DIR/stdout; then
-    echo "pattern not found"
-    exit 1
-fi
-exit 0
index 81735aaebab30abf2be31769cbf4de0f26e87298..e65028856b9fc5f9e33dc83bf479d306c519881e 100644 (file)
@@ -2,3 +2,7 @@ requires:
   min-version: 6.0
   features:
     - HAVE_NSS
+
+checks:
+  - shell:
+      args: grep -q 'One or more rule(s) depends on the file-store output log which is not enabled. Enable the output "file-store"' stdout
diff --git a/tests/dnp3-dnp3_data-alert/check.sh b/tests/dnp3-dnp3_data-alert/check.sh
deleted file mode 100755 (executable)
index ee2d032..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-# Should have 4 DNP3 data match alerts.
-n=$(grep "DNP3 Data match" eve.json | wc -l | xargs)
-assert_eq 4 "$n" "bad event count"
-
-exit 0
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..1b009bd20763e06df5809b4df2863a4cce37ef4e 100644 (file)
@@ -1,3 +1,10 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 4
+      match:
+        event_type: alert
+        alert.signature_id: 4
diff --git a/tests/dnp3-dnp3_func-alert/check.sh b/tests/dnp3-dnp3_func-alert/check.sh
deleted file mode 100755 (executable)
index 8d16638..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-# Should have one alert sid 1.
-n=$(jq_count eve.json 'select(.alert.signature_id == 1)')
-assert_eq 1 "$n" "sig id 1"
-
-# Should have one alert sid 2.
-n=$(jq_count eve.json 'select(.alert.signature_id == 2)')
-assert_eq 1 "$n" "sig id 1"
-
-exit 0
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..6d038fb314074a6d04ae454875fa6fc3b6122f25 100644 (file)
@@ -1,3 +1,13 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 1
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 2
diff --git a/tests/dns-eve-v1/check.sh b/tests/dns-eve-v1/check.sh
deleted file mode 100755 (executable)
index 1d8a0ec..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-# 4 queries.
-n=$(jq_count eve.json 'select(.dns.type == "query")')
-assert_eq 4 "$n" "queries"
-
-# 5 answers.
-n=$(jq_count eve.json 'select(.dns.type == "answer")')
-assert_eq 5 "$n" "answers"
index 9ee272d758187f4df3a35be633b4a58e5ffa655e..655b17fdb97f6bab5b19b594d4ab2914ec60d868 100644 (file)
@@ -2,3 +2,13 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7
+
+checks:
+  - filter:
+      count: 4
+      match:
+        dns.type: query
+  - filter:
+      count: 5
+      match:
+        dns.type: answer
diff --git a/tests/dns-json-log/check.sh b/tests/dns-json-log/check.sh
deleted file mode 100755 (executable)
index d833374..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-# Expect 9 dns records.
-n=$(cat dns.json | jq -c 'select(.event_type == "dns")' | wc -l | xargs)
-if test $n -ne 9; then
-    echo "failed: expected 9 dns events, got $n"
-    exit 1
-fi
-
-# 4 are queries.
-n=$(cat dns.json | jq -c 'select(.event_type == "dns") | select(.dns.type == "query")' | wc -l | xargs)
-if test $n -ne 4; then
-    echo "failed: expected 4 dns queries, got $n"
-    exit 1
-fi
-
-# 4 are queries.
-n=$(cat dns.json | jq -c 'select(.event_type == "dns") | select(.dns.type == "answer")' | wc -l | xargs)
-if test $n -ne 5; then
-    echo "failed: expected 5 dns answers, got $n"
-    exit 1
-fi
index 2824cf6f6a9d96ca9349d6c5d0c1519b477bb853..c3a0d030dbebda45d8a376ae714920b029cb7bc6 100644 (file)
@@ -2,3 +2,22 @@ requires:
   lt-version: 6
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 9
+      filename: dns.json
+      match:
+        event_type: dns
+  - filter:
+      count: 4
+      filename: dns.json
+      match:
+        event_type: dns
+        dns.type: query
+  - filter:
+      count: 5
+      filename: dns.json
+      match:
+        event_type: dns
+        dns.type: answer
diff --git a/tests/dns-single-request-v1/check.sh b/tests/dns-single-request-v1/check.sh
deleted file mode 100755 (executable)
index f2d46c6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-# One query for suricon.net.
-n=$(jq_count eve.json 'select(.dns.type == "query") | select(.dns.rrname == "suricon.net")')
-assert_eq 1 "$n" "request"
-
-# One answer with rdata of 181.224.138.142.
-n=$(jq_count eve.json 'select(.dns.type == "answer") | select(.dns.rdata == "181.224.138.142")')
-assert_eq 1 "$n" "response"
-
index 9ee272d758187f4df3a35be633b4a58e5ffa655e..b4b2c5d1ad77ecb85225b4529dd70a8abd71343a 100644 (file)
@@ -2,3 +2,15 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7
+
+checks:
+  - filter:
+      count: 1
+      match:
+        dns.type: query
+        dns.rrname: suricon.net
+  - filter:
+      count: 1
+      match:
+        dns.type: answer
+        dns.rdata: "181.224.138.142"
diff --git a/tests/dns-tcp-multirequest-buffer-v1/check.sh b/tests/dns-tcp-multirequest-buffer-v1/check.sh
deleted file mode 100755 (executable)
index 7605125..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-
-count=$(cat eve.json | jq -c 'select(.dns.type=="query")' | wc -l | xargs)
-if [ "${count}" -ne 20 ]; then
-    echo "error: expected 20 queries, got ${count}"
-    exit 1
-fi
-
-count=$(cat eve.json | jq -c 'select(.dns.type=="answer")' | wc -l | xargs)
-if [ "${count}" -ne 40 ]; then
-    echo "error: expected 40 answers, got ${count}"
-    exit 1
-fi
-
-exit 0
index 8dafa433a18b29692205f76ee1c723bec685b12b..015e39ffe0eee97de826fe8fec0b203daee14650 100644 (file)
@@ -2,3 +2,13 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7    
+
+checks:
+  - filter:
+      count: 20
+      match:
+        dns.type: query
+  - filter:
+      count: 40
+      match:
+        dns.type: answer
diff --git a/tests/dns-udp-eve-log-aaaa-only-v1/check.sh b/tests/dns-udp-eve-log-aaaa-only-v1/check.sh
deleted file mode 100755 (executable)
index 43b477d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-n=$(jq_count eve.json 'select(.dns.rrtype == "AAAA")')
-assert_eq 2 $n "expected 2 aaaa records"
-
-n=$(jq_count eve.json 'select(.dns.rrtype != "AAAA")')
-assert_eq 0 $n "expected 0 non-aaaa records"
-
-exit 0
-
index 9ee272d758187f4df3a35be633b4a58e5ffa655e..cc69e0fc9a4d88af45b266e6b870f7f335fdd12d 100644 (file)
@@ -2,3 +2,14 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7
+
+checks:
+  # There should only be AAAA DNS records.
+  - filter:
+      count: 2
+      match:
+        dns.rrtype: AAAA
+  - filter:
+      count: 2
+      match:
+        event_type: dns
diff --git a/tests/dns-udp-eve-log-answer-only-v1/check.sh b/tests/dns-udp-eve-log-answer-only-v1/check.sh
deleted file mode 100755 (executable)
index 8faa28e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-# Should be no answers.
-n=$(jq_count eve.json 'select(.event_type == "dns") | select(.dns.type != "answer")')
-assert_eq 0 $n "only answers expected"
-
-exit 0
-
index 9ee272d758187f4df3a35be633b4a58e5ffa655e..117d87e211af14477217f8678bbb76f532548174 100644 (file)
@@ -2,3 +2,13 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7
+
+checks:
+  - filter:
+      count: 18
+      match:
+        event_type: dns
+  - filter:
+      count: 18
+      match:
+        dns.type: answer
diff --git a/tests/dns-udp-eve-log-mx-only-v1/check.sh b/tests/dns-udp-eve-log-mx-only-v1/check.sh
deleted file mode 100755 (executable)
index 133517d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-n=$(jq_count eve.json 'select(.dns.rrtype != "MX")')
-assert_eq 0 $n "only expected mx records"
-
-exit 0
-
index 9ee272d758187f4df3a35be633b4a58e5ffa655e..9af7359a6494ee9a91fe5224dd2ccc58a96b598b 100644 (file)
@@ -2,3 +2,13 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7
+
+checks:
+  - filter:
+      count: 6
+      match:
+        dns.rrtype: MX 
+  - filter:
+      count: 6
+      match:
+        event_type: dns
diff --git a/tests/dns-udp-eve-log-query-only-v1/check.sh b/tests/dns-udp-eve-log-query-only-v1/check.sh
deleted file mode 100755 (executable)
index 284af21..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-# Should be no answers.
-n=$(jq_count eve.json 'select(.event_type == "dns") | select(.dns.type != "query")')
-assert_eq 0 $n "only queries expected"
-
-exit 0
-
index 9ee272d758187f4df3a35be633b4a58e5ffa655e..8f28eae740c43e4fe00bded587f5865bceb336c6 100644 (file)
@@ -2,3 +2,16 @@ requires:
   features:
     - HAVE_LIBJANSSON
   lt-version: 7
+
+checks:
+  # Check to verify that all DNS records are query only, 
+  # and no responses.
+  - filter:
+      count: 3
+      match:
+        event_type: dns
+  - filter:
+      count: 3
+      match:
+        event_type: dns
+        dns.type: query
diff --git a/tests/linktype-228/check.sh b/tests/linktype-228/check.sh
deleted file mode 100755 (executable)
index a11309d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-
-tcp=$(cat eve.json | \
-         jq -c 'select(.event_type == "stats") | .stats.decoder.tcp')
-test "${tcp}" = "7"
index ad1c54aeeab1b49c73f6cc91a5ce8ec3c8146d3e..6d6de4dd8ba5bd58117213454fdb092bf1f4c773 100644 (file)
@@ -3,3 +3,10 @@ requires:
   min-version: 4.1.0
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        event_type: stats
+        stats.decoder.tcp: 7
diff --git a/tests/lua-output-dns/check.sh b/tests/lua-output-dns/check.sh
deleted file mode 100755 (executable)
index e615993..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#! /bin/sh
-
-set -e
-
-if ! grep -q "Query TX 0d4f \[\*\*\] block.dropbox.com \[\*\*\] A \[\*\*\] 10.16.1.11:49697 -> 10.16.1.1:53" lua-dns.log; then
-    echo "failed to find query for block.dropbox.com"
-    exit 1
-fi
-
-if ! cat lua-dns.log | \
-       grep "Response" | \
-       grep "client-cf.dropbox.com" | \
-       grep "52.85.112.21" > /dev/null;
-then
-    echo "failed to find response for client-cf.dropbox.com"
-    exit 1
-fi
-
-if ! cat lua-dns.log | \
-       grep "Response TX 62b2" | \
-       grep "NXDOMAIN" > /dev/null;
-then
-    echo "failed to find NXDOMAIN error"
-    exit 1
-fi
-
-if ! cat lua-dns.log | grep "SOA" > /dev/null; then
-    echo "failed find SOA response record"
-    exit 1
-fi
-
-exit 0
index 4bb475d4355b8db3324174f5283c854e964ab530..9db269e6e4234038b97fe27c03008f751377d292 100644 (file)
@@ -1,3 +1,16 @@
 requires:
   features:
     - HAVE_LUA
+
+checks:
+  - shell:
+      args: grep -q "Query TX 0d4f \[\*\*\] block.dropbox.com \[\*\*\] A \[\*\*\] 10.16.1.11:49697 -> 10.16.1.1:53" lua-dns.log
+  - shell:
+      args: cat lua-dns.log | grep Response | grep client-cf.dropbox.com | wc -l
+      expect: 2
+  - shell:
+      args: cat lua-dns.log | grep "Response TX 62b2" | grep NXDOMAIN | wc -l
+      expect: 1
+  - shell:
+      args: grep SOA lua-dns.log | wc -l
+      expect: 1
diff --git a/tests/lua-output-http/check.sh b/tests/lua-output-http/check.sh
deleted file mode 100755 (executable)
index a3f3c13..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-
-exec cmp http_lua.log ${TEST_DIR}/expected/http_lua.log
index 4bb475d4355b8db3324174f5283c854e964ab530..c4e436605ba42867dfdd75522d3fba56e8209289 100644 (file)
@@ -1,3 +1,8 @@
 requires:
   features:
     - HAVE_LUA
+
+checks:
+  - file-compare:
+      filename: http_lua.log
+      expected: expected/http_lua.log
diff --git a/tests/lua-output-smtp/check.sh b/tests/lua-output-smtp/check.sh
deleted file mode 100755 (executable)
index 7a3040d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /bin/sh
-
-exec grep -q 'FROM <gurpartap@patriots.in> TO {<raj_deol2002in@yahoo.co.in>}' \
-     smtp_lua.log
index 4bb475d4355b8db3324174f5283c854e964ab530..ed9158c7a08ff723c64780004485c79e3a44fb07 100644 (file)
@@ -1,3 +1,7 @@
 requires:
   features:
     - HAVE_LUA
+
+checks:
+  - shell:
+      args: grep -q 'FROM <gurpartap@patriots.in> TO {<raj_deol2002in@yahoo.co.in>}' smtp_lua.log
diff --git a/tests/output-eve-fileinfo/check.sh b/tests/output-eve-fileinfo/check.sh
deleted file mode 100755 (executable)
index 4152bdd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /bin/sh
-
-. ${TOPDIR}/util/functions.sh
-
-filename=$(cat eve.json | jq -c .fileinfo.filename)
-assert_eq '"eicar.com"' "$filename" "bad filename"
-
-exit 0
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..177703e839ef23091f89662bc16acc7c1ddb2a6f 100644 (file)
@@ -1,3 +1,9 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        fileinfo.filename: eicar.com
diff --git a/tests/output-pcap-log/check.sh b/tests/output-pcap-log/check.sh
deleted file mode 100755 (executable)
index ac1e9ef..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-
-exec cmp ${TEST_DIR}/expected/log.pcap.1444144603 log.pcap.1444144603
diff --git a/tests/output-pcap-log/test.yaml b/tests/output-pcap-log/test.yaml
new file mode 100644 (file)
index 0000000..f4a6b02
--- /dev/null
@@ -0,0 +1,4 @@
+checks:
+  - file-compare:
+      filename: log.pcap.1444144603
+      expected: expected/log.pcap.1444144603
diff --git a/tests/proto-mismatch-http-ssh/check.sh b/tests/proto-mismatch-http-ssh/check.sh
deleted file mode 100755 (executable)
index 1a078d7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /bin/sh
-
-failed=no
-
-# We should get a "SURICATA Applayer Mismatch protocol both
-# directions" alert.
-n=$(cat eve.json | \
-       jq -c 'select(.alert.signature_id == 2260000)' | \
-       wc -l | xargs)
-if [ "$n" != 1 ]; then
-    echo "expected 1 event with SID 2260000"
-    failed=yes
-fi
-
-# We should have a flow event with app_proto = http and app_proto_tc = ssh.
-n=$(cat eve.json | \
-       jq -c 'select(.event_type == "flow") | select(.app_proto == "http") | select(.app_proto_tc == "ssh")' | \
-       wc -l | xargs)
-if [ "$n" != 1 ]; then
-    echo "expected 1 event with app_proto http and app_proto_tc ssh"
-    failed=yes
-fi
-
-if [ "${failed}" = "yes" ]; then
-    exit 1
-fi
-
-exit 0
-
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..7ded94e24551faafc5eb13bead2a51178253bed0 100644 (file)
@@ -1,3 +1,15 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 2260000
+  - filter:
+      count: 1
+      match:
+        event_type: flow
+        app_proto: http
+        app_proto_tc: ssh
diff --git a/tests/tls-fingerprint-alert/check.sh b/tests/tls-fingerprint-alert/check.sh
deleted file mode 100755 (executable)
index f43b9a2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /usr/bin/env bash
-
-# Check for a single alert.
-n=$(cat eve.json | jq -c 'select(.event_type == "alert")' | wc -l | xargs)
-if test "${n}" -ne 1; then
-    echo "expected 1 event, found ${n}"
-    exit 1
-fi
-
-exit 0
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..d8119d83edc28f57349add973b1405a5b9b53b34 100644 (file)
@@ -1,3 +1,9 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        event_type: alert
diff --git a/tests/tls-json-output-ids/check.sh b/tests/tls-json-output-ids/check.sh
deleted file mode 100755 (executable)
index b7342ce..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /usr/bin/env bash
-
-# Check for 1 tls event.
-n=$(cat eve.json | jq -c 'select(.event_type == "tls")' | wc -l | xargs)
-if test "${n}" -ne 1; then
-    echo "expected 1 event, got $n"
-    exit 1
-fi
-
-exit 0
-
-    
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..7092e6a5c6cb27a8ee2f902dcf038ce51aff0477 100644 (file)
@@ -1,3 +1,9 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        event_type: tls
diff --git a/tests/tls-json-output-ips/check.sh b/tests/tls-json-output-ips/check.sh
deleted file mode 100755 (executable)
index b7342ce..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /usr/bin/env bash
-
-# Check for 1 tls event.
-n=$(cat eve.json | jq -c 'select(.event_type == "tls")' | wc -l | xargs)
-if test "${n}" -ne 1; then
-    echo "expected 1 event, got $n"
-    exit 1
-fi
-
-exit 0
-
-    
index 56ea9b0d57173b93569d9c72c9b1372ce9234d13..7092e6a5c6cb27a8ee2f902dcf038ce51aff0477 100644 (file)
@@ -1,3 +1,9 @@
 requires:
   features:
     - HAVE_LIBJANSSON
+
+checks:
+  - filter:
+      count: 1
+      match:
+        event_type: tls