Files
acaua/crates/acaua-core/tests/smoke.rs
T
Lucas RayanandClaude Sonnet 5 8a80504c45
Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and clippy (push) Successful in 4m32s
CI / Dependency audit (push) Successful in 11s
CI / Tests (Linux) (push) Successful in 9m15s
Release / ci (push) Successful in 9m18s
Release / Build image (arm64) (push) Failing after 7m7s
Release / Build image (amd64) (push) Failing after 13m53s
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
refactor: distribute Acaua as a Docker image instead of a desktop app
Acaua is a collective SOC daemon consuming only Zeek log files, not a
single-user tool needing local hardware like its siblings. Drop the
Tauri desktop shell, installers and self-update entirely; the server
and its web dashboard ship as a container, updated by pulling a new
image tag.

Link against the official prebuilt libduckdb instead of compiling it
from source via the bundled feature, cutting image build time from
15+ minutes to about 3. Fix a real bug found along the way: as PID 1
in a container, the daemon ignored SIGTERM and was always killed
after the stop timeout; it now shuts down gracefully.

Also corrects the Pillar 1 beaconing score: the period estimate had a
harmonic alias (a perfectly periodic 4h series resolved to 600s), and
the old score formula flagged pure random traffic as suspicious
(p95 = 0.839 on Poisson noise). The new formula was validated against
300 samples per scenario.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
2026-10-31 19:54:45 -03:00

72 lines
2.1 KiB
Rust

use acaua_core::{doctor, fusion, pillar1, pillar2, pillar3, pillar4, storage, zeek, AcauaError};
#[test]
fn pillar1_returns_a_skeleton_score() {
let input = pillar1::BeaconingInput {
timestamps: vec![1.0, 2.0, 3.0],
};
let score = pillar1::score(&input).unwrap();
assert_eq!(score.observations, 3);
assert_eq!(score.status, "insufficient_data");
}
#[test]
fn pillar2_counts_long_connections_without_panicking() {
let input = pillar2::SessionInput {
durations_secs: vec![1.0, 400.0],
bytes: vec![10, 20],
};
let score = pillar2::score(&input).unwrap();
assert_eq!(score.long_connections, 1);
assert_eq!(score.status, "skeleton");
}
#[test]
fn pillar3_handles_an_empty_protocol_list() {
let score = pillar3::score(&pillar3::ProtocolInput::default()).unwrap();
assert_eq!(score.distinct_protocols, 0);
assert_eq!(score.status, "skeleton");
}
#[test]
fn pillar4_fuses_three_inputs() {
let score = pillar4::score(&pillar4::FusionInput::default()).unwrap();
assert_eq!(score.inputs, 3);
assert_eq!(score.status, "skeleton");
}
#[test]
fn fusion_returns_no_alerts_yet() {
let report = fusion::fuse(&[0.1, 0.2]).unwrap();
assert!(report.alerts.is_empty());
assert_eq!(report.status, "skeleton");
}
#[test]
fn storage_reports_the_reserved_backend() {
let store = storage::Storage::open(std::env::temp_dir()).unwrap();
let summary = store.summary().unwrap();
assert_eq!(summary.ttl_days, 7);
assert_eq!(summary.records, 0);
}
#[test]
fn zeek_rejects_a_missing_directory() {
let error =
zeek::analyze_dir("/definitely/not/a/zeek/directory", std::env::temp_dir()).unwrap_err();
assert!(matches!(error, AcauaError::InvalidInput(_)));
}
#[test]
fn zeek_classifies_known_logs() {
assert_eq!(zeek::classify_log("dns.log"), zeek::ZeekLogKind::Dns);
assert_eq!(zeek::classify_log("other.log"), zeek::ZeekLogKind::Unknown);
}
#[test]
fn doctor_reports_checks() {
let report = doctor::run();
assert!(!report.checks.is_empty());
assert_eq!(report.status, "skeleton");
}