Orchestrata Ultimate › Tests › Reference › scripts › test_container_cpu_accounting

Tests reference — tests/scripts/test_container_cpu_accounting.py

Module of tests/scripts, split out because the directory page would be too large.

Prose pending.

tests/scripts/test_container_cpu_accounting.py

source · 44 tests · 523 lines

Tests for scripts/container_cpu_accounting.py — cgroup cpuacct

Kind Name Line Description
function test_main_entrypoint_wraps_a_real_command_via_real_subprocess 495 The main guard + full argv path, via one real subprocess -- the
class TestResolveProject 48
method TestResolveProject.test_default_profile_is_test 49
method TestResolveProject.test_explicit_profile_argument_wins 52
method TestResolveProject.test_reads_env_var_when_no_argument 58
method TestResolveProject.test_unknown_profile_raises 63
method TestResolveProject.test_covers_every_documented_fleet 67
class TestListContainerPids 79
method TestListContainerPids.test_real_fleet_has_the_two_containers_the_research_names 80
method TestListContainerPids.test_nonexistent_project_returns_no_containers 87
method TestListContainerPids.test_missing_incus_executable_raises 93
method TestListContainerPids.test_unreachable_incus_socket_raises 99
method TestListContainerPids.test_impossible_timeout_raises 104
class TestCgroupCpuDir 112
method TestCgroupCpuDir.test_real_container_pid_resolves_to_an_existing_directory 113
method TestCgroupCpuDir.test_non_container_pid_raises 121
method TestCgroupCpuDir.test_nonexistent_pid_raises 128
class TestReadUsageSeconds 136
method TestReadUsageSeconds.test_real_container_usage_is_a_nonnegative_float 137
method TestReadUsageSeconds.test_missing_directory_raises 143
method TestReadUsageSeconds.test_cpu_stat_without_usage_usec_raises 147
method TestReadUsageSeconds.test_cpu_stat_with_bad_usage_usec_raises 154
class TestTakeSnapshot 165
method TestTakeSnapshot.test_default_containers_are_memgraph_and_redis 166
method TestTakeSnapshot.test_unknown_container_raises 173
method TestTakeSnapshot.test_all_four_test_fleet_containers_are_readable 177
class TestSnapshotRoundTrip 185
method TestSnapshotRoundTrip.test_to_dict_from_dict_round_trip 186
method TestSnapshotRoundTrip.test_from_dict_rejects_malformed_input 193
method TestSnapshotRoundTrip.test_from_dict_rejects_missing_keys 199
class TestDiffReport 207
method TestDiffReport.test_computes_per_container_and_total_deltas 213
method TestDiffReport.test_container_present_only_in_one_snapshot_is_skipped_not_guessed 223
method TestDiffReport.test_mismatched_project_raises 232
method TestDiffReport.test_real_before_after_around_a_real_sleep_is_nonnegative 238 The actual instrument, n=1: two real cgroup reads around one real
class TestContainerCpuNdjsonPath 257
method TestContainerCpuNdjsonPath.test_default_is_cwd_reports 258
method TestContainerCpuNdjsonPath.test_override_via_env 265
class TestPersistDiffReport 281
method TestPersistDiffReport.test_writes_one_ndjson_line_joined_by_run_id 282
method TestPersistDiffReport.test_omits_absent_join_keys 311
method TestPersistDiffReport.test_appends_across_calls 329
method TestPersistDiffReport.test_write_failure_is_swallowed_not_raised 343 Best-effort like every other sink in this project: a REAL write
method TestPersistDiffReport.test_real_run_tests_style_record_round_trips_through_take_snapshot 362 End-to-end with real infra: snapshot, diff, persist, read back --
class TestMainSnapshot 385
method TestMainSnapshot.test_snapshot_prints_valid_json_to_stdout 386
method TestMainSnapshot.test_snapshot_writes_to_output_file 395
method TestMainSnapshot.test_snapshot_honors_custom_containers 402
method TestMainSnapshot.test_snapshot_of_unknown_container_reports_error_and_exits_1 410
method TestMainSnapshot.test_unknown_profile_reports_error_and_exits_1 419
class TestMainDiff 427
method TestMainDiff.test_diff_reports_delta_between_two_files 428
class TestMainRun 452
method TestMainRun.test_run_wraps_a_real_command_and_forwards_its_exit_code 453
method TestMainRun.test_run_forwards_a_nonzero_exit_code 473
method TestMainRun.test_run_without_a_command_is_a_usage_error 487