Logo

A powerful, easily deployable network traffic analysis tool suite for network security monitoring

Quick Start

Documentation

Components

Supported Protocols

Configuring

Arkime

Dashboards

Hedgehog Linux

Contribution Guide

malcolm-test: Malcolm System Tests

malcolm-test is a Python package for performing system tests against a Malcolm system. It serves to run an instance of Malcolm inside a virtual machine and verify the results of system tests executed against it. Please see the following repositories for installation and usage instructions and additional details:

Malcolm Unit Tests

In addition to the system tests run against a live instance by malcolm-test, Malcolm contains a suite of unit tests under shared/tests/. These tests exercise Malcolm’s own Python helper modules, parsers, and service logic directly: they do not require a running Malcolm instance, containers, a container runtime, or network access to any Malcolm service.

Why These Tests Live in This Repository

The unit tests are kept here rather than in idaholab/Malcolm-Test because of what they test and when they need to run:

As a rule of thumb: if a test needs a running Malcolm, it belongs in malcolm-test; if it can be answered by importing a module and calling it, it belongs in shared/tests/.

Running the Unit Tests

Run these from the root of your Malcolm working copy.

Install the test requirements:

python3 -m pip install -r ./shared/tests/requirements.txt

Generate the gRPC/protobuf bindings used by the filescan tests:

make -C filescan/python-filescan

Then run the suite:

pytest -q shared/tests/

Expected output resembles the following:

====================================== test session starts =======================================
platform linux -- Python 3.14.7, pytest-9.1.1, pluggy-1.6.0
rootdir: /home/user/Malcolm/shared/tests
configfile: pyproject.toml
plugins: anyio-4.14.2
collected 1177 items

shared/tests/test_api_event_provenance.py ......                                           [  0%]
shared/tests/test_api_nested_mapping_fields.py .............                               [  1%]
...
shared/tests/test_watch_common_read_events.py ........                                     [ 98%]
shared/tests/test_watch_moved_paths.py ............                                        [100%]

===================================== 1177 passed in 19.49s =====================================

Notes on the Setup Steps

Skipped Tests

Some tests skip themselves when an optional dependency or a specific environmental condition is absent. Skips are not failures, but it is worth knowing why a test skipped rather than assuming it passed. Use -rs to print the reason for each skip:

pytest -rs shared/tests/
SKIPPED [23] shared/tests/test_logstash_zeek_community_id.py:196: requires ruby
SKIPPED [1] shared/tests/test_prune_files.py:63: filesystem is at 1%; need at least 2% to stay clear of the threshold boundary

Known conditional skips:

If you are adding a test that needs something not guaranteed to be present, prefer pytest.mark.skipif with an explicit reason string over letting the test fail, and keep the reason specific enough that a reader of the CI log can tell whether the skip is benign.

Relationship to malcolm-test

The two suites are complementary and are both run during automated testing:

  Malcolm unit tests malcolm-test system tests
Location shared/tests/ in this repository idaholab/Malcolm-Test
Scope Individual modules and functions A running Malcolm instance end to end
Requires a running Malcolm No Yes
Requires a VM / container runtime No Yes (virter + libvirt)
Requires test artifacts No Yes (Malcolm-Test-Artifacts)
Typical runtime Seconds Minutes to hours

malcolm-test also runs this unit test suite as one of its VM provisioning steps, so a unit test failure will fail provisioning before the system tests are reached. That gives the fast-feedback benefit of unit tests inside the same pipeline that performs the slower integration run.