def test_prepare_task_data_cgroup_not_found(*mocks): containers = { task('/t1', labels={'label_key': 'label_value'}, resources={'cpu': 3}): Container('/t1', platform_mock) } tasks_measurements, tasks_resources, tasks_labels = \ _prepare_tasks_data(containers) assert tasks_measurements == {}
def test_prepare_task_data_cgroup_not_found(*mocks): containers = { task('/t1', labels={'label_key': 'label_value'}, resources={'cpu': 3}): Container('/t1', platform_mock) } with pytest.raises(MissingMeasurementException): tasks_measurements, tasks_resources, tasks_labels = \ _prepare_tasks_data(containers)
def test_prepare_task_data_cgroup_not_found(*mocks): rdt_information = RDTInformation(True, True, True, True, '0', '0', 0, 0, 0) containers = { task('/t1', labels={'label_key': 'label_value'}, resources={'cpu': 3}): Container('/t1', 1, 1, rdt_information) } tasks_measurements, tasks_resources, tasks_labels = \ _prepare_tasks_data(containers) assert tasks_measurements == {}
def test_prepare_tasks_data(*mocks): containers = { task('/t1', labels={'label_key': 'label_value'}, resources={'cpu': 3}): Container('/t1', platform_mock) } tasks_measurements, tasks_resources, tasks_labels = _prepare_tasks_data( containers) assert tasks_measurements == {'t1_task_id': {'cpu_usage': 13}} assert tasks_resources == {'t1_task_id': {'cpu': 3}} assert tasks_labels == {'t1_task_id': {'label_key': 'label_value'}}
def test_prepare_tasks_data(*mocks): rdt_information = RDTInformation(True, True, True, True, '0', '0', 0, 0, 0) containers = { task('/t1', labels={'label_key': 'label_value'}, resources={'cpu': 3}): Container('/t1', 1, 1, rdt_information) } tasks_measurements, tasks_resources, tasks_labels = _prepare_tasks_data( containers) assert tasks_measurements == {'t1_task_id': {'cpu_usage': 13}} assert tasks_resources == {'t1_task_id': {'cpu': 3}} assert tasks_labels == {'t1_task_id': {'label_key': 'label_value'}}
def test_prepare_tasks_data(*mocks): t = task('/t1', labels={'label_key': 'label_value'}, resources={'cpu': 3}) containers = {t: Container('/t1', platform_mock)} tasks_data = _prepare_tasks_data(containers) assert tasks_data == { 't1_task_id': TaskData(t.name, t.task_id, t.cgroup_path, t.subcgroups_paths, t.labels, t.resources, { 'task_up': 1, 'task_last_seen': 12345.6, 'task_cpu_usage_seconds': 13 }) }