Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): making a new release #882

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
path: |
test-results-${{ matrix.splunk.version }}


test-splunk-matrix:
needs:
- meta
Expand All @@ -149,7 +150,6 @@ jobs:
"splunk_app_cim_broken",
"splunk_fiction_indextime",
"splunk_fiction_indextime_broken",
"splunk_fiction_indextime_wrong_hec_token",
"splunk_setup_fixture",
"splunk_app_req",
"splunk_app_req_broken",
Expand Down
2 changes: 0 additions & 2 deletions pytest_splunk_addon/data_models/Intrusion_Detection.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"name": "dest",
"type": "conditional",
"condition": "ids_type=\"network\"",
"validity": "case(in(upper(transport), \"HOPOPT\", \"ICMP\", \"IGMP\", \"GGP\", \"IP-IN-IP\", \"ST\", \"TCP\", \"CBT\", \"EGP\", \"IGP\", \"BBN-RCC-MON\", \"NVP-II\", \"PUP\", \"ARGUS\", \"EMCON\", \"XNET\", \"CHAOS\", \"UDP\", \"MUX\", \"DCN-MEAS\", \"HMP\", \"PRM\", \"XNS-ID\", \"TRUNK-1\", \"TRUNK-2\", \"LEAF-1\", \"LEAF-2\", \"RDP\", \"IRTP\", \"ISO-TP4\", \"NETBLT\", \"MFE-NSP\", \"MERIT-INP\", \"DCCP\", \"3CP\", \"IDPR\", \"XTP\", \"DDP\", \"IDPR-CMTP\", \"TP++\", \"IL\", \"IPV6\", \"SDRP\", \"IPV6-ROUTE\", \"IPV6-FRAG\", \"IDRP\", \"RSVP\", \"GRES\", \"DSR\", \"BNA\", \"ESP\", \"AH\", \"I-NLSP\", \"SWIPE\", \"NARP\", \"MOBILE\", \"TLSP\", \"SKIP\", \"IPV6-ICMP\", \"IPC6-NONXT\", \"IPV6-OPTS\", \"CFTP\", \"SAT-EXPAK\", \"KRYPTOLAN\", \"RVD\", \"IPPC\", \"SAT-MON\", \"VISA\", \"IPCU\", \"CPNX\", \"CPHB\", \"WSN\", \"PVP\", \"BR-SAT-MON\", \"SUN-ND\", \"WB-MON\", \"WB-EXPAK\", \"ISO-IP\", \"VMTP\", \"SECURE-VMTP\", \"VINES\", \"TTP\", \"IPTM\", \"NSFNET-IGP\", \"DGP\", \"TCF\", \"EIGRP\", \"OSPF\", \"SPRITE-RPC\", \"LARP\", \"MTP\", \"AX.25\", \"OS\", \"MICP\", \"SCC-SP\", \"ETHERIP\", \"ENCAP\", \"GMTP\", \"IFMP\", \"PNNI\", \"PIM\", \"ARIS\", \"SCPS\", \"QNX\", \"A/N\", \"IPCOMP\", \"SNP\", \"COMPAQ-PEER\", \"IPX-IN-IP\", \"VRRP\", \"PGM\", \"L2TP\", \"DDX\", \"IATP\", \"STP\", \"SRP\", \"UTI\", \"SMP\", \"SM\", \"PTP\", \"IS-IS OVER IPV4\", \"FIRE\", \"CRTP\", \"CRUDP\", \"SSCOPMCE\", \"IPLT\", \"SPS\", \"PIPE\", \"SCTP\", \"FC\", \"RSVP-E2E-IGNORE\", \"MOBILITY HEADER\", \"UDPLITE\", \"MPLS-IN-IP\", \"MANET\", \"HIP\", \"SHIM6\", \"WESP\", \"ROHC\", \"ETHERNET\"), if(match(dest,\"(?:(?:::ffff:)|(?:[0-9a-fA-F]{1,4}:){6}ffff:)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.[a-f0-9](?>:|$)){8,})^((?1)(?>:(?1)){0,6})?::(?2)?(?!(?:.*[a-f0-9](?>:|$))))|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\\.(?4)){3})\"), dest, null()), match(dest,\"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$\"), dest, true(), null())",
"comment": "The destination of the attack detected by the intrusion detection system (IDS). You can alias this from more specific fields not included in this data model, such as dest_host, dest_ip, or dest_name."
},
{
Expand Down Expand Up @@ -76,7 +75,6 @@
"name": "src",
"type": "conditional",
"condition": "ids_type=\"network\"",
"validity": "case(in(upper(transport), \"HOPOPT\", \"ICMP\", \"IGMP\", \"GGP\", \"IP-IN-IP\", \"ST\", \"TCP\", \"CBT\", \"EGP\", \"IGP\", \"BBN-RCC-MON\", \"NVP-II\", \"PUP\", \"ARGUS\", \"EMCON\", \"XNET\", \"CHAOS\", \"UDP\", \"MUX\", \"DCN-MEAS\", \"HMP\", \"PRM\", \"XNS-ID\", \"TRUNK-1\", \"TRUNK-2\", \"LEAF-1\", \"LEAF-2\", \"RDP\", \"IRTP\", \"ISO-TP4\", \"NETBLT\", \"MFE-NSP\", \"MERIT-INP\", \"DCCP\", \"3CP\", \"IDPR\", \"XTP\", \"DDP\", \"IDPR-CMTP\", \"TP++\", \"IL\", \"IPV6\", \"SDRP\", \"IPV6-ROUTE\", \"IPV6-FRAG\", \"IDRP\", \"RSVP\", \"GRES\", \"DSR\", \"BNA\", \"ESP\", \"AH\", \"I-NLSP\", \"SWIPE\", \"NARP\", \"MOBILE\", \"TLSP\", \"SKIP\", \"IPV6-ICMP\", \"IPC6-NONXT\", \"IPV6-OPTS\", \"CFTP\", \"SAT-EXPAK\", \"KRYPTOLAN\", \"RVD\", \"IPPC\", \"SAT-MON\", \"VISA\", \"IPCU\", \"CPNX\", \"CPHB\", \"WSN\", \"PVP\", \"BR-SAT-MON\", \"SUN-ND\", \"WB-MON\", \"WB-EXPAK\", \"ISO-IP\", \"VMTP\", \"SECURE-VMTP\", \"VINES\", \"TTP\", \"IPTM\", \"NSFNET-IGP\", \"DGP\", \"TCF\", \"EIGRP\", \"OSPF\", \"SPRITE-RPC\", \"LARP\", \"MTP\", \"AX.25\", \"OS\", \"MICP\", \"SCC-SP\", \"ETHERIP\", \"ENCAP\", \"GMTP\", \"IFMP\", \"PNNI\", \"PIM\", \"ARIS\", \"SCPS\", \"QNX\", \"A/N\", \"IPCOMP\", \"SNP\", \"COMPAQ-PEER\", \"IPX-IN-IP\", \"VRRP\", \"PGM\", \"L2TP\", \"DDX\", \"IATP\", \"STP\", \"SRP\", \"UTI\", \"SMP\", \"SM\", \"PTP\", \"IS-IS OVER IPV4\", \"FIRE\", \"CRTP\", \"CRUDP\", \"SSCOPMCE\", \"IPLT\", \"SPS\", \"PIPE\", \"SCTP\", \"FC\", \"RSVP-E2E-IGNORE\", \"MOBILITY HEADER\", \"UDPLITE\", \"MPLS-IN-IP\", \"MANET\", \"HIP\", \"SHIM6\", \"WESP\", \"ROHC\", \"ETHERNET\"), if(match(src,\"(?:(?:::ffff:)|(?:[0-9a-fA-F]{1,4}:){6}ffff:)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.[a-f0-9](?>:|$)){8,})^((?1)(?>:(?1)){0,6})?::(?2)?(?!(?:.*[a-f0-9](?>:|$))))|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\\.(?4)){3})\"), src, null()), match(src,\"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$\"), src, true(), null())",
"comment": "The source involved in the attack detected by the IDS. You can alias this from more specific fields not included in this data model, such as src_host, src_ip, or src_name."
},
{
Expand Down
98 changes: 92 additions & 6 deletions pytest_splunk_addon/data_models/Network_Resolution.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
{
"name": "dest",
"type": "required",
"validity": "case(in(upper(transport), \"TCP\", \"UDP\"), if(match(dest,\"(?:(?:::ffff:)|(?:[0-9a-fA-F]{1,4}:){6}ffff:)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.[a-f0-9](?>:|$)){8,})^((?1)(?>:(?1)){0,6})?::(?2)?(?!(?:.*[a-f0-9](?>:|$))))|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\\.(?4)){3})\"), dest, null()), match(dest,\"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$\"), dest, true(), null())",
"comment": "The destination of the network resolution event. You can alias this from more specific fields, such as dest_host, dest_ip, or dest_name."
},
{
Expand Down Expand Up @@ -83,12 +82,100 @@
"type": "required",
"expected_values": [
"A",
"DNAME",
"MX",
"NS",
"PTR"
"MD",
"MF",
"CNAME",
"SOA",
"MB",
"MG",
"MR",
"NULL",
"WKS",
"PTR",
"HINFO",
"MINFO",
"MX",
"TXT",
"RP",
"AFSDB",
"X25",
"ISDN",
"RT",
"NSAP",
"NSAP-PTR",
"SIG",
"KEY",
"PX",
"GPOS",
"AAAA",
"LOC",
"NXT",
"EID",
"NIMLOC",
"SRV",
"ATMA",
"NAPTR",
"KX",
"CERT",
"A6",
"DNAME",
"SINK",
"OPT",
"APL",
"DS",
"SSHFP",
"IPSECKEY",
"RRSIG",
"NSEC",
"DNSKEY",
"DHCID",
"NSEC3",
"NSEC3PARAM",
"TLSA",
"SMIMEA",
"Unassigned",
"HIP",
"NINFO",
"RKEY",
"TALINK",
"CDS",
"CDNSKEY",
"OPENPGPKEY",
"CSYNC",
"ZONEMD",
"SVCB",
"HTTPS",
"SPF",
"UINFO",
"UID",
"GID",
"UNSPEC",
"NID",
"L32",
"L64",
"LP",
"EUI48",
"EUI64",
"TKEY",
"TSIG",
"IXFR",
"AXFR",
"MAILB",
"MAILA",
"*",
"URI",
"CAA",
"AVC",
"DOA",
"AMTRELAY",
"RESINFO",
"TA",
"DLV",
"Private use",
"Reserved"
],
"comment": "The DNS resource record type. For details, see the List of DNS record types on Wikipedia."
"comment": "The DNS resource record type. For details, see the List of DNS record types on Internet Assigned Numbers Authority (IANA) web site."
},
{
"name": "reply_code",
Expand Down Expand Up @@ -151,7 +238,6 @@
{
"name": "src",
"type": "required",
"validity": "case(in(upper(transport), \"TCP\", \"UDP\"), if(match(src,\"(?:(?:::ffff:)|(?:[0-9a-fA-F]{1,4}:){6}ffff:)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.[a-f0-9](?>:|$)){8,})^((?1)(?>:(?1)){0,6})?::(?2)?(?!(?:.*[a-f0-9](?>:|$))))|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\\.(?4)){3})\"), src, null()), match(src,\"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$\"), src, true(), null())",
"comment": "The source of the network resolution event. You can alias this from more specific fields, such as src_host, src_ip, or src_name."
},
{
Expand Down
2 changes: 0 additions & 2 deletions pytest_splunk_addon/data_models/Network_Traffic.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
{
"name": "dest",
"type": "required",
"validity": "case(in(upper(transport), \"HOPOPT\", \"ICMP\", \"IGMP\", \"GGP\", \"IP-IN-IP\", \"ST\", \"TCP\", \"CBT\", \"EGP\", \"IGP\", \"BBN-RCC-MON\", \"NVP-II\", \"PUP\", \"ARGUS\", \"EMCON\", \"XNET\", \"CHAOS\", \"UDP\", \"MUX\", \"DCN-MEAS\", \"HMP\", \"PRM\", \"XNS-ID\", \"TRUNK-1\", \"TRUNK-2\", \"LEAF-1\", \"LEAF-2\", \"RDP\", \"IRTP\", \"ISO-TP4\", \"NETBLT\", \"MFE-NSP\", \"MERIT-INP\", \"DCCP\", \"3CP\", \"IDPR\", \"XTP\", \"DDP\", \"IDPR-CMTP\", \"TP++\", \"IL\", \"IPV6\", \"SDRP\", \"IPV6-ROUTE\", \"IPV6-FRAG\", \"IDRP\", \"RSVP\", \"GRES\", \"DSR\", \"BNA\", \"ESP\", \"AH\", \"I-NLSP\", \"SWIPE\", \"NARP\", \"MOBILE\", \"TLSP\", \"SKIP\", \"IPV6-ICMP\", \"IPC6-NONXT\", \"IPV6-OPTS\", \"CFTP\", \"SAT-EXPAK\", \"KRYPTOLAN\", \"RVD\", \"IPPC\", \"SAT-MON\", \"VISA\", \"IPCU\", \"CPNX\", \"CPHB\", \"WSN\", \"PVP\", \"BR-SAT-MON\", \"SUN-ND\", \"WB-MON\", \"WB-EXPAK\", \"ISO-IP\", \"VMTP\", \"SECURE-VMTP\", \"VINES\", \"TTP\", \"IPTM\", \"NSFNET-IGP\", \"DGP\", \"TCF\", \"EIGRP\", \"OSPF\", \"SPRITE-RPC\", \"LARP\", \"MTP\", \"AX.25\", \"OS\", \"MICP\", \"SCC-SP\", \"ETHERIP\", \"ENCAP\", \"GMTP\", \"IFMP\", \"PNNI\", \"PIM\", \"ARIS\", \"SCPS\", \"QNX\", \"A/N\", \"IPCOMP\", \"SNP\", \"COMPAQ-PEER\", \"IPX-IN-IP\", \"VRRP\", \"PGM\", \"L2TP\", \"DDX\", \"IATP\", \"STP\", \"SRP\", \"UTI\", \"SMP\", \"SM\", \"PTP\", \"IS-IS OVER IPV4\", \"FIRE\", \"CRTP\", \"CRUDP\", \"SSCOPMCE\", \"IPLT\", \"SPS\", \"PIPE\", \"SCTP\", \"FC\", \"RSVP-E2E-IGNORE\", \"MOBILITY HEADER\", \"UDPLITE\", \"MPLS-IN-IP\", \"MANET\", \"HIP\", \"SHIM6\", \"WESP\", \"ROHC\", \"ETHERNET\"), if(match(dest,\"(?:(?:::ffff:)|(?:[0-9a-fA-F]{1,4}:){6}ffff:)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.[a-f0-9](?>:|$)){8,})^((?1)(?>:(?1)){0,6})?::(?2)?(?!(?:.*[a-f0-9](?>:|$))))|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\\.(?4)){3})\"), dest, null()), match(dest,\"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$\"), dest, true(), null())",
"comment": "The destination of the network traffic (the remote host). You can alias this from more specific fields, such as dest_host, dest_ip, or dest_name."
},
{
Expand Down Expand Up @@ -198,7 +197,6 @@
{
"name": "src",
"type": "required",
"validity": "case(in(upper(transport), \"HOPOPT\", \"ICMP\", \"IGMP\", \"GGP\", \"IP-IN-IP\", \"ST\", \"TCP\", \"CBT\", \"EGP\", \"IGP\", \"BBN-RCC-MON\", \"NVP-II\", \"PUP\", \"ARGUS\", \"EMCON\", \"XNET\", \"CHAOS\", \"UDP\", \"MUX\", \"DCN-MEAS\", \"HMP\", \"PRM\", \"XNS-ID\", \"TRUNK-1\", \"TRUNK-2\", \"LEAF-1\", \"LEAF-2\", \"RDP\", \"IRTP\", \"ISO-TP4\", \"NETBLT\", \"MFE-NSP\", \"MERIT-INP\", \"DCCP\", \"3CP\", \"IDPR\", \"XTP\", \"DDP\", \"IDPR-CMTP\", \"TP++\", \"IL\", \"IPV6\", \"SDRP\", \"IPV6-ROUTE\", \"IPV6-FRAG\", \"IDRP\", \"RSVP\", \"GRES\", \"DSR\", \"BNA\", \"ESP\", \"AH\", \"I-NLSP\", \"SWIPE\", \"NARP\", \"MOBILE\", \"TLSP\", \"SKIP\", \"IPV6-ICMP\", \"IPC6-NONXT\", \"IPV6-OPTS\", \"CFTP\", \"SAT-EXPAK\", \"KRYPTOLAN\", \"RVD\", \"IPPC\", \"SAT-MON\", \"VISA\", \"IPCU\", \"CPNX\", \"CPHB\", \"WSN\", \"PVP\", \"BR-SAT-MON\", \"SUN-ND\", \"WB-MON\", \"WB-EXPAK\", \"ISO-IP\", \"VMTP\", \"SECURE-VMTP\", \"VINES\", \"TTP\", \"IPTM\", \"NSFNET-IGP\", \"DGP\", \"TCF\", \"EIGRP\", \"OSPF\", \"SPRITE-RPC\", \"LARP\", \"MTP\", \"AX.25\", \"OS\", \"MICP\", \"SCC-SP\", \"ETHERIP\", \"ENCAP\", \"GMTP\", \"IFMP\", \"PNNI\", \"PIM\", \"ARIS\", \"SCPS\", \"QNX\", \"A/N\", \"IPCOMP\", \"SNP\", \"COMPAQ-PEER\", \"IPX-IN-IP\", \"VRRP\", \"PGM\", \"L2TP\", \"DDX\", \"IATP\", \"STP\", \"SRP\", \"UTI\", \"SMP\", \"SM\", \"PTP\", \"IS-IS OVER IPV4\", \"FIRE\", \"CRTP\", \"CRUDP\", \"SSCOPMCE\", \"IPLT\", \"SPS\", \"PIPE\", \"SCTP\", \"FC\", \"RSVP-E2E-IGNORE\", \"MOBILITY HEADER\", \"UDPLITE\", \"MPLS-IN-IP\", \"MANET\", \"HIP\", \"SHIM6\", \"WESP\", \"ROHC\", \"ETHERNET\"), if(match(src,\"(?:(?:::ffff:)|(?:[0-9a-fA-F]{1,4}:){6}ffff:)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.[a-f0-9](?>:|$)){8,})^((?1)(?>:(?1)){0,6})?::(?2)?(?!(?:.*[a-f0-9](?>:|$))))|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\\.(?4)){3})\"), src, null()), match(src,\"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$\"), src, true(), null())",
"comment": "The source of the network traffic (the client requesting the connection). You can alias this from more specific fields, such as src_host, src_ip, or src_name.'"
},
{
Expand Down
10 changes: 6 additions & 4 deletions pytest_splunk_addon/fields_tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,19 @@ def generate_requirements_tests(self):
}

cim_fields = event.requirement_test_data.get("cim_fields", {})
other_fields = event.requirement_test_data.get("other_fields", {})
requirement_fields = {**cim_fields, **other_fields}

if cim_fields:
cim_fields = {
if requirement_fields:
requirement_fields = {
field: value
for field, value in cim_fields.items()
for field, value in requirement_fields.items()
if field not in exceptions
}
yield pytest.param(
{
"escaped_event": escaped_event,
"fields": cim_fields,
"fields": requirement_fields,
"modinput_params": modinput_params,
},
id=f"sample_name::{event.sample_name}::host::{event.metadata.get('host')}",
Expand Down
14 changes: 0 additions & 14 deletions pytest_splunk_addon/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

test_generator = None

EXC_MAP = [Exception]


def pytest_configure(config):
"""
Expand Down Expand Up @@ -122,7 +120,6 @@ def pytest_sessionstart(session):
SampleXdistGenerator.tokenized_event_source = session.config.getoption(
"tokenized_event_source"
).lower()
session.__exc_limits = EXC_MAP
if (
SampleXdistGenerator.tokenized_event_source == "store_new"
and session.config.getoption("ingest_events").lower()
Expand Down Expand Up @@ -212,14 +209,3 @@ def init_pytest_splunk_addon_logger():

init_pytest_splunk_addon_logger()
LOGGER = logging.getLogger("pytest-splunk-addon")


def pytest_exception_interact(node, call, report):
"""
Hook called when an exception is raised during a test.
If the number of occurrences for a specific exception exceeds the limit in session.__exc_limits, pytest exits
https://docs.pytest.org/en/stable/reference/reference.html#pytest.hookspec.pytest_exception_interact
"""
if call.excinfo.type in node.session.__exc_limits:
# pytest exits only for exceptions defined in EXC_MAP
pytest.exit(f"Exiting pytest due to: {call.excinfo.type}")
10 changes: 10 additions & 0 deletions pytest_splunk_addon/sample_generation/sample_stanza.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ def populate_requirement_test_data(event):
"""
requirement_test_data = {}
cim = event.get("cim")
other_mappings = event.get("other_mappings")
if other_mappings:
other_fields = {}
fields = other_mappings["field"]
if type(fields) == list:
for field in fields:
other_fields[field["@name"]] = field["@value"]
elif type(fields) == dict:
other_fields[fields["@name"]] = fields["@value"]
requirement_test_data["other_fields"] = other_fields
if cim:
requirement_test_data["cim_version"] = cim.get("@version", "latest")
requirement_test_data["datamodels"] = cim.get("models") or {}
Expand Down
5 changes: 3 additions & 2 deletions pytest_splunk_addon/splunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def is_responsive_hec(request, splunk):
f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/health/1.0',
verify=False,
)
LOGGER.debug("Status code: {}".format(response.status_code))
LOGGER.debug("Status code: %d", response.status_code)
if response.status_code in (200, 201):
LOGGER.info("Splunk HEC is responsive.")
return True
Expand Down Expand Up @@ -1040,7 +1040,8 @@ def is_valid_hec(request, splunk):
data={"event": "test_hec", "sourcetype": "hec_token_test"},
verify=False,
)
LOGGER.debug("Status code: {}".format(response.status_code))
LOGGER.debug("Status code: %d", response.status_code)

if response.status_code == 200:
LOGGER.info("Splunk HEC is valid.")
else:
Expand Down
28 changes: 28 additions & 0 deletions tests/e2e/addons/TA_req_broken/samples/sample_modinput.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,32 @@
</missing_recommended_fields>
</cim>
</event>
<event code="" name="WrongFieldValueOtherMappings" format="">
<transport type="modinput" sourcetype="test:data:1" source="test_data.1" host="so1"/>
<source>
<jira id=""/>
<comment>lab</comment>
</source>
<raw>
<![CDATA[2021-12-31 15:15:30,340+0000 action=success app=psa user=admin status=success dest=10.0.0.1 src=10.0.0.2]]></raw>
<cim>
<models>
<model>Authentication</model>
</models>
<cim_fields>
<field name="action" value="success"/>
<field name="status" value="success"/>
<field name="app" value="psa"/>
<field name="src" value="10.0.0.2"/>
<field name="user" value="admin"/>
<field name="dest" value="10.0.0.1"/>
</cim_fields>
<missing_recommended_fields>
<field>src_user</field>
</missing_recommended_fields>
</cim>
<other_mappings>
<field name="vendor_product" value="PSA"/>
</other_mappings>
</event>
</device>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ FIELDALIAS-action = result AS action
EVAL-app = "psa"
FIELDALIAS-user = tester AS user
FIELDALIAS-src = ip AS src
EVAL-status = case(action=="success", "PASS", action=="failure", "FAIL", 0==0, "OTHER")
EVAL-status = case(action=="success", "PASS", action=="failure", "FAIL", 0==0, "OTHER")
EVAL-vendor_product = "Pytest Splunk Addon"
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
<field>src_user</field>
</missing_recommended_fields>
</cim>
<other_mappings>
<field name="vendor_product" value="Pytest Splunk Addon"/>
</other_mappings>
</event>
</device>
Loading
Loading