Skip to content
Snippets Groups Projects
Commit 58b917c9 authored by Maël Madon's avatar Maël Madon
Browse files

test: easy_bf and easy_bf_fast now behave almost the same (little difference...

test: easy_bf and easy_bf_fast now behave almost the same (little difference in the order they give to jobs that arrive simultaneously)
parent 83bb1e10
No related branches found
No related tags found
1 merge request!19Use the faster implementation of easy backfilling
...@@ -5,6 +5,7 @@ import subprocess ...@@ -5,6 +5,7 @@ import subprocess
import filecmp import filecmp
from collections import namedtuple from collections import namedtuple
from os.path import abspath from os.path import abspath
import pandas as pd
empty_workload = abspath('test/workloads/static/empty.json') empty_workload = abspath('test/workloads/static/empty.json')
...@@ -79,4 +80,15 @@ def assert_expected_behavior(test_file) : ...@@ -79,4 +80,15 @@ def assert_expected_behavior(test_file) :
assert filecmp.cmp(expected, obtained), f"\ assert filecmp.cmp(expected, obtained), f"\
Files {expected} and {obtained} should be equal but are not.\n\ Files {expected} and {obtained} should be equal but are not.\n\
Run `diff {expected} {obtained}` to investigate why.\n\ Run `diff {expected} {obtained}` to investigate why.\n\
Run `cp {obtained} {expected}` to override the expected file with the obtained." Run `cp {obtained} {expected}` to override the expected file with the obtained."
\ No newline at end of file
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
...@@ -32,10 +32,7 @@ def test_easy_bf_fast(platform_monoC, workload_static): ...@@ -32,10 +32,7 @@ def test_easy_bf_fast(platform_monoC, workload_static):
expected = 'test-out/' + test_name_easy + '/_jobs.csv' expected = 'test-out/' + test_name_easy + '/_jobs.csv'
obtained = 'test-out/' + test_name_easy_fast + '/_jobs.csv' obtained = 'test-out/' + test_name_easy_fast + '/_jobs.csv'
assert filecmp.cmp(expected, obtained), f"\ assert_same_outputs(expected, obtained)
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."
def test_broker_multi(platform_multiC, workload_static, sched_multi): def test_broker_multi(platform_multiC, workload_static, sched_multi):
......
...@@ -65,7 +65,4 @@ def test_easy_bf_fast(platform_monoC, workload_static): ...@@ -65,7 +65,4 @@ def test_easy_bf_fast(platform_monoC, workload_static):
test_easy = f'easy_bf-{platform_monoC.name}-{workload_static.name}' test_easy = f'easy_bf-{platform_monoC.name}-{workload_static.name}'
obtained = f'test-out/{test_name}/_jobs.csv' obtained = f'test-out/{test_name}/_jobs.csv'
expected = f'test-out/{test_easy}/_jobs.csv' expected = f'test-out/{test_easy}/_jobs.csv'
assert filecmp.cmp(expected, obtained), f"\ assert_same_outputs(expected, obtained)
Files {expected} and {obtained} should be equal but are not.\n\ \ No newline at end of file
Run `diff {expected} {obtained}` to investigate why.\n\
Run `cp {obtained} {expected}` to override the expected file with the obtained."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment