diff --git a/test/helper.py b/test/helper.py index 7f6579ac8b7699883fd9ae706fe4ad62787dac5c..12dd71f2634733f4e78643877d7a39fee39b2a1d 100644 --- a/test/helper.py +++ b/test/helper.py @@ -5,6 +5,7 @@ import subprocess import filecmp from collections import namedtuple from os.path import abspath +import pandas as pd empty_workload = abspath('test/workloads/static/empty.json') @@ -79,4 +80,15 @@ def assert_expected_behavior(test_file) : assert filecmp.cmp(expected, obtained), f"\ Files {expected} and {obtained} should be equal but are not.\n\ Run `diff {expected} {obtained}` to investigate why.\n\ - Run `cp {obtained} {expected}` to override the expected file with the obtained." \ No newline at end of file + Run `cp {obtained} {expected}` to override the expected file with the obtained." + +def assert_same_outputs(expected, obtained): + """Test that the relevent columns of the _jobs.csv are identical""" + cols = ["job_id", "submission_time", "final_state", "starting_time", "execution_time"] + + df_o = pd.read_csv(obtained)[cols] + df_e = pd.read_csv(expected)[cols] + + assert df_o.equals(df_e), f"\ + Files {expected} and {obtained} should be equal but are not.\n\ + Run `diff {expected} {obtained}` to investigate why." \ No newline at end of file diff --git a/test/test_broker.py b/test/test_broker.py index 5da510c829b6561ef517e6dd7256b5fd3d6d4051..a6092d95de6771e1fe7bcc7e736d2205dcd2da0c 100644 --- a/test/test_broker.py +++ b/test/test_broker.py @@ -32,10 +32,7 @@ def test_easy_bf_fast(platform_monoC, workload_static): expected = 'test-out/' + test_name_easy + '/_jobs.csv' obtained = 'test-out/' + test_name_easy_fast + '/_jobs.csv' - assert filecmp.cmp(expected, obtained), f"\ - Files {expected} and {obtained} should be equal but are not.\n\ - Run `diff {expected} {obtained}` to investigate why.\n\ - Run `cp {obtained} {expected}` to override the expected file with the obtained." + assert_same_outputs(expected, obtained) def test_broker_multi(platform_multiC, workload_static, sched_multi): diff --git a/test/test_schedulers_mono.py b/test/test_schedulers_mono.py index d268d5b5aab16dbe61c778991f1edf097e7a30da..643747c60b4e0d13a345740fe234cb8283625f8e 100755 --- a/test/test_schedulers_mono.py +++ b/test/test_schedulers_mono.py @@ -65,7 +65,4 @@ def test_easy_bf_fast(platform_monoC, workload_static): test_easy = f'easy_bf-{platform_monoC.name}-{workload_static.name}' obtained = f'test-out/{test_name}/_jobs.csv' expected = f'test-out/{test_easy}/_jobs.csv' - assert filecmp.cmp(expected, obtained), f"\ - Files {expected} and {obtained} should be equal but are not.\n\ - Run `diff {expected} {obtained}` to investigate why.\n\ - Run `cp {obtained} {expected}` to override the expected file with the obtained." + assert_same_outputs(expected, obtained) \ No newline at end of file