From 1d3adab6539f12984e5fe5340ff185a3743261a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABl=20Madon?= <mael.madon@irit.fr>
Date: Fri, 2 Dec 2022 15:32:37 +0000
Subject: [PATCH] Active test in the CI

---
 .gitlab-ci.yml                                | 26 ++++++++++++++++---
 src/broker/cloud_broker.cpp                   |  4 +++
 src/json_workload.cpp                         | 13 +++++++++-
 src/queue.cpp                                 | 22 ++++++++++------
 src/queue.hpp                                 |  5 +++-
 .../bin_packing-2machines-para_homo_jobs.csv  |  2 +-
 ...acking_energy-2machines-para_homo_jobs.csv |  2 +-
 .../broker-bpNRJ-2machines-para_homo_jobs.csv |  4 +--
 .../cocktail_user_model-2machines_jobs.csv    |  6 ++---
 ...er_think_time_only-many_following_jobs.csv |  4 +--
 ...er_think_time_only-many_preceding_jobs.csv |  6 ++---
 ...ink_time_only-many_start_sessions_jobs.csv |  6 ++---
 ...ticore_filler-2machines-para_homo_jobs.csv | 12 ++++-----
 .../routine_greedy-2machines_jobs.csv         |  8 +++---
 test/helper.py                                |  2 +-
 test/test_broker.py                           |  6 +++++
 test/test_schedulers_multi.py                 |  6 ++---
 17 files changed, 92 insertions(+), 42 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9205243..54157bc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,26 @@
 image: oarteam/batsim_ci
 
-build:
-  stage: build
+stages:
+  - build-and-test
+
+# unfortunately, it's difficult to create two separate jobs for building and testing
+# because the jobs will start again with a clean nix-store.. 
+build-and-test:
+  stage: build-and-test 
   script:
-    - nix-build ./default.nix -A batmen
\ No newline at end of file
+    #### In one command ####
+    - nix-shell ./default.nix --pure -A test_rebuild --command 'pytest'
+
+    #### In two separate commands ####
+    ## Build batmen
+    #- nix-build ./default.nix -A batmen
+    #- mkdir -p build && mv result/bin/batmen build/batmen
+
+    ## Test
+    #- nix-shell ./default.nix --pure -A test --command 'pytest'
+
+  allow_failure: true
+  artifacts:
+    when: always
+    paths:
+      - test-out/
diff --git a/src/broker/cloud_broker.cpp b/src/broker/cloud_broker.cpp
index d610ce2..00ebeba 100644
--- a/src/broker/cloud_broker.cpp
+++ b/src/broker/cloud_broker.cpp
@@ -188,7 +188,11 @@ void CloudBroker::jobs_to_submit(
         user = user_queue.front();
     }
 
+    /* Reorder the user queue */
     user_queue.sort(CompareUsers());
+
+    /* Sort the jobs before sending them to submission, for determinism */
+    jobs.sort(JobComparator());
 }
 
 void CloudBroker::feedback_job_status(double date,
diff --git a/src/json_workload.cpp b/src/json_workload.cpp
index 79a590c..0446f9d 100644
--- a/src/json_workload.cpp
+++ b/src/json_workload.cpp
@@ -177,7 +177,18 @@ Job *Workload::job_from_json_object(const Value &object)
 
 bool JobComparator::operator()(const Job *j1, const Job *j2) const
 {
-    return j1->unique_number < j2->unique_number;
+    PPK_ASSERT_ERROR(j1->id.find('!') != string::npos,
+        "I thought jobID had always a form 'wl!id'...");
+
+    string id1 = j1->id.substr(j1->id.find('!') + 1, j1->id.size());
+    string id2 = j2->id.substr(j2->id.find('!') + 1, j2->id.size());
+
+    if (id1 == id2) /* different workload, same job number: comp on wl name */
+        return j1->id < j2->id;
+    if (id1.length() == id2.length()) /* same length: lexicographic order */
+        return id1 < id2;
+    return id1.length() < id2.length();
+
 }
 
 bool SessionComparator::operator()(const Session *s1, const Session *s2) const
diff --git a/src/queue.cpp b/src/queue.cpp
index 4ae78a5..4b25b42 100644
--- a/src/queue.cpp
+++ b/src/queue.cpp
@@ -45,7 +45,7 @@ bool FCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
     (void) info;
 
     if (j1->release_date == j2->release_date)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->release_date < j2->release_date;
 }
@@ -67,7 +67,7 @@ bool LCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
     (void) info;
 
     if (j1->release_date == j2->release_date)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->release_date > j2->release_date;
 }
@@ -95,7 +95,7 @@ bool DescendingBoundedSlowdownOrder::compare(const SortableJob *j1, const Sortab
     (void) info;
 
     if (j1->bounded_slowdown == j2->bounded_slowdown)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->bounded_slowdown > j2->bounded_slowdown;
 }
@@ -116,7 +116,7 @@ bool DescendingSlowdownOrder::compare(const SortableJob *j1, const SortableJob *
     (void) info;
 
     if (j1->slowdown == j2->slowdown)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->slowdown > j2->slowdown;
 }
@@ -137,7 +137,10 @@ bool AscendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2, c
     (void) info;
 
     if (j1->job->nb_requested_resources == j2->job->nb_requested_resources)
-        return j1->job->submission_time < j2->job->submission_time;
+        if (j1->job->submission_time == j2->job->submission_time)
+            return jobcmp(j1->job, j2->job);
+        else
+            return j1->job->submission_time < j2->job->submission_time;
     else
         return j1->job->nb_requested_resources < j2->job->nb_requested_resources;
 }
@@ -159,7 +162,10 @@ bool DescendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2,
     (void) info;
 
     if (j1->job->nb_requested_resources == j2->job->nb_requested_resources)
-        return j1->job->submission_time < j2->job->submission_time;
+        if (j1->job->submission_time == j2->job->submission_time)
+            return jobcmp(j1->job, j2->job);
+        else
+            return j1->job->submission_time < j2->job->submission_time;
     else
         return j1->job->nb_requested_resources > j2->job->nb_requested_resources;
 }
@@ -181,7 +187,7 @@ bool AscendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *j
     (void) info;
 
     if (j1->job->walltime == j2->job->walltime)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->job->walltime < j2->job->walltime;
 }
@@ -203,7 +209,7 @@ bool DescendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *
     (void) info;
 
     if (j1->job->walltime == j2->job->walltime)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->job->walltime > j2->job->walltime;
 }
diff --git a/src/queue.hpp b/src/queue.hpp
index a99be23..2c17c1a 100644
--- a/src/queue.hpp
+++ b/src/queue.hpp
@@ -2,7 +2,7 @@
 
 #include <list>
 
-struct Job;
+#include "json_workload.hpp"
 
 #include "schedule.hpp"
 
@@ -37,6 +37,9 @@ public:
     virtual ~SortableJobOrder();
     virtual bool compare(const SortableJob * j1, const SortableJob * j2, const CompareInformation * info = nullptr) const = 0;
     virtual void updateJob(SortableJob * job, const UpdateInformation * info = nullptr) const = 0;
+
+protected:
+    JobComparator jobcmp;
 };
 
 class FCFSOrder : public SortableJobOrder
diff --git a/test/expected_log/bin_packing-2machines-para_homo_jobs.csv b/test/expected_log/bin_packing-2machines-para_homo_jobs.csv
index c43e8b8..9523f91 100644
--- a/test/expected_log/bin_packing-2machines-para_homo_jobs.csv
+++ b/test/expected_log/bin_packing-2machines-para_homo_jobs.csv
@@ -5,8 +5,8 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 1,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,0,687380.500000,""
 2,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
 3,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,2213.000000,8213.000000,0.000000,2213.000000,1.000000,0,480221.000000,""
 9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,2213.000000,8213.000000,0.000000,2213.000000,1.000000,0,480221.000000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,2213.000000,8213.000000,0.000000,2213.000000,1.000000,0,480221.000000,""
 4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,7043.000000,13043.000000,0.000000,7043.000000,1.000000,1,1116315.500000,""
 5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,7043.000000,13043.000000,0.000000,7043.000000,1.000000,1,1116315.500000,""
 6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,7043.000000,13043.000000,0.000000,7043.000000,1.000000,1,1116315.500000,""
diff --git a/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv b/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv
index be6a496..c072e09 100644
--- a/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv
+++ b/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv
@@ -5,8 +5,8 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 1,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,0,687380.500000,""
 2,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
 3,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,0,480221.000000,""
 9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,0,480221.000000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,0,480221.000000,""
 4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,7043.000000,13193.000000,150.000000,7193.000000,1.021298,1,1116315.500000,""
 5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,7043.000000,13193.000000,150.000000,7193.000000,1.021298,1,1116315.500000,""
 6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,7043.000000,13193.000000,150.000000,7193.000000,1.021298,1,1116315.500000,""
diff --git a/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv b/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv
index 4193aa7..566e7ac 100644
--- a/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv
+++ b/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv
@@ -65,8 +65,8 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 65,bob1,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,1,21700.000000,""
 66,bob1,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,1,21700.000000,""
 67,bob1,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8085.000000,100.000000,8185.000000,85.000000,185.000000,1.850000,0,21078.437500,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6087.500000,2213.000000,8300.500000,87.500000,2300.500000,1.039539,0,454437.125000,""
-9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,1,396288.125000,""
+9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6087.500000,2213.000000,8300.500000,87.500000,2300.500000,1.039539,0,454437.125000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,1,396288.125000,""
 8,alice,100_sec,8993.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8993.000000,100.000000,9093.000000,0.000000,100.000000,1.000000,0,20559.250000,""
 68,bob1,100_sec,9000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,9000.000000,100.000000,9100.000000,0.000000,100.000000,1.000000,0,20917.562500,""
 69,bob1,100_sec,9000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,9000.000000,100.000000,9100.000000,0.000000,100.000000,1.000000,0,20917.562500,""
diff --git a/test/expected_log/cocktail_user_model-2machines_jobs.csv b/test/expected_log/cocktail_user_model-2machines_jobs.csv
index 4a19869..8ee91af 100644
--- a/test/expected_log/cocktail_user_model-2machines_jobs.csv
+++ b/test/expected_log/cocktail_user_model-2machines_jobs.csv
@@ -13,6 +13,7 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 2,alice,100_sec,1500.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,1500.000000,100.000000,1600.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 3,alice,100_sec,1750.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,1750.000000,100.000000,1850.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 4,alice,100_sec,1875.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,1875.000000,100.000000,1975.000000,0.000000,100.000000,1.000000,0,10731.250000,""
+3,caty,100_sec,2000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 6,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 7,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 8,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
@@ -21,7 +22,6 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 11,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 12,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 13,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
-3,caty,100_sec,2000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 5,alice,100_sec,2000.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.500000,100.000000,2100.500000,0.000000,100.000000,1.000000,0,17279.593750,""
 6,alice,100_sec,2157.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2157.500000,100.000000,2257.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 7,alice,100_sec,2283.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2283.000000,100.000000,2383.000000,0.000000,100.000000,1.000000,0,10731.250000,""
@@ -70,6 +70,7 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 30,alice,100_sec,4791.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,4791.500000,100.000000,4891.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 31,alice,100_sec,4892.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,4892.000000,100.000000,4992.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 32,alice,100_sec,4992.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,4992.500000,100.000000,5092.500000,0.000000,100.000000,1.000000,0,16818.906250,""
+8,caty,100_sec,5000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 38,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 39,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 40,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
@@ -78,7 +79,6 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 43,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 44,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 45,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
-8,caty,100_sec,5000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 33,alice,100_sec,5093.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5093.000000,100.000000,5193.000000,0.000000,100.000000,1.000000,0,11191.937500,""
 34,alice,100_sec,5193.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5193.500000,100.000000,5293.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 35,alice,100_sec,5294.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5294.000000,100.000000,5394.000000,0.000000,100.000000,1.000000,0,10731.250000,""
@@ -128,6 +128,7 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 59,alice,100_sec,7706.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,7706.000000,100.000000,7806.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 60,alice,100_sec,7806.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,7806.500000,100.000000,7906.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 61,alice,100_sec,7907.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,7907.000000,100.000000,8007.000000,0.000000,100.000000,1.000000,0,11191.937500,""
+13,caty,100_sec,8000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 78,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 79,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 80,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
@@ -136,7 +137,6 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 83,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 84,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 85,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
-13,caty,100_sec,8000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 62,alice,100_sec,8007.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8007.500000,100.000000,8107.500000,0.000000,100.000000,1.000000,0,16818.906250,""
 63,alice,100_sec,8108.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8108.000000,100.000000,8208.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 64,alice,100_sec,8208.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8208.500000,100.000000,8308.500000,0.000000,100.000000,1.000000,0,10731.250000,""
diff --git a/test/expected_log/fb_user_think_time_only-many_following_jobs.csv b/test/expected_log/fb_user_think_time_only-many_following_jobs.csv
index 7579f12..6bb6b5b 100644
--- a/test/expected_log/fb_user_think_time_only-many_following_jobs.csv
+++ b/test/expected_log/fb_user_think_time_only-many_following_jobs.csv
@@ -1,7 +1,7 @@
 job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
 1:s1,fb_user_think_time_only,1000,0.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,0.000000,1000.000000,1000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
-4:s4,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
+3:s3,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
 2:s2,fb_user_think_time_only,2000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,2000.000000,4000.000000,0.000000,2000.000000,1.000000,0,434000.000000,""
-3:s3,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
+4:s4,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
 5:s5,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,4000.000000,1000.000000,5000.000000,2000.000000,3000.000000,3.000000,0,217000.000000,""
 6:s6,fb_user_think_time_only,1000,3000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,4000.000000,1000.000000,5000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
diff --git a/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv b/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv
index 0fae0f7..a874b8f 100644
--- a/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv
+++ b/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv
@@ -1,7 +1,7 @@
 job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
 1:s1,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
-3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
-4:s4,fb_user_think_time_only,1000,1500.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,500.000000,1500.000000,1.500000,1,217000.000000,""
-2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,2000.000000,4000.000000,1000.000000,3000.000000,1.500000,0,434000.000000,""
+2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,2000.000000,3000.000000,0.000000,2000.000000,1.000000,1,434000.000000,""
+3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,1000.000000,2000.000000,2.000000,0,217000.000000,""
+4:s4,fb_user_think_time_only,1000,1500.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1500.000000,2500.000000,2.500000,0,217000.000000,""
 5:s5,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
 6:s6,fb_user_think_time_only,1000,5000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,1000.000000,6000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
diff --git a/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv b/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv
index 2d9681b..4c2a974 100644
--- a/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv
+++ b/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv
@@ -1,6 +1,6 @@
 job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
-1:s1,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
-2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,2000.000000,3000.000000,0.000000,2000.000000,1.000000,0,434000.000000,""
-3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
+1:s1,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
+2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,2000.000000,3000.000000,0.000000,2000.000000,1.000000,1,434000.000000,""
+3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,1000.000000,2000.000000,2.000000,0,217000.000000,""
 4:s4,fb_user_think_time_only,1000,1500.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1500.000000,2500.000000,2.500000,0,217000.000000,""
 5:s5,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
diff --git a/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv b/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv
index 4bc200b..8307607 100644
--- a/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv
+++ b/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv
@@ -5,12 +5,12 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 3,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,10560.000000,3520.000000,14080.000000,10560.000000,14080.000000,4.000000,0,454960.000000,""
 8,w0,blast_vm_xlarge,0.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,14080.000000,2213.000000,16293.000000,14080.000000,16293.000000,7.362404,0,350760.500000,""
 10,w0,blast_vm_xlarge,1000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,16293.000000,2213.000000,18506.000000,15293.000000,17506.000000,7.910529,0,350760.500000,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,18506.000000,2213.000000,20719.000000,12506.000000,14719.000000,6.651152,0,350760.500000,""
-4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,20719.000000,7043.000000,27762.000000,14719.000000,21762.000000,3.089876,0,807303.875000,""
-5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,27762.000000,7043.000000,34805.000000,21762.000000,28805.000000,4.089876,0,807303.875000,""
-6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,34805.000000,7043.000000,41848.000000,28805.000000,35848.000000,5.089876,0,807303.875000,""
-7,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,41848.000000,7043.000000,48891.000000,35848.000000,42891.000000,6.089876,0,807303.875000,""
-9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,48891.000000,2213.000000,51104.000000,42891.000000,45104.000000,20.381383,0,350760.500000,""
+4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,18506.000000,7043.000000,25549.000000,12506.000000,19549.000000,2.775664,0,807303.875000,""
+5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,25549.000000,7043.000000,32592.000000,19549.000000,26592.000000,3.775664,0,807303.875000,""
+6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,32592.000000,7043.000000,39635.000000,26592.000000,33635.000000,4.775664,0,807303.875000,""
+7,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,39635.000000,7043.000000,46678.000000,33635.000000,40678.000000,5.775664,0,807303.875000,""
+9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,46678.000000,2213.000000,48891.000000,40678.000000,42891.000000,19.381383,0,350760.500000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,48891.000000,2213.000000,51104.000000,42891.000000,45104.000000,20.381383,0,350760.500000,""
 12,w0,blast_vm_large,14000.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,51104.000000,3520.000000,54624.000000,37104.000000,40624.000000,11.540909,0,454960.000000,""
 13,w0,blast_vm_large,14000.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,54624.000000,3520.000000,58144.000000,40624.000000,44144.000000,12.540909,0,454960.000000,""
 14,w0,blast_vm_large,14000.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,58144.000000,3520.000000,61664.000000,44144.000000,47664.000000,13.540909,0,454960.000000,""
diff --git a/test/expected_log/routine_greedy-2machines_jobs.csv b/test/expected_log/routine_greedy-2machines_jobs.csv
index c67a235..e22260e 100644
--- a/test/expected_log/routine_greedy-2machines_jobs.csv
+++ b/test/expected_log/routine_greedy-2machines_jobs.csv
@@ -33,14 +33,14 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 7,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 8,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 9,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-10,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-11,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-12,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-13,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 9,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+10,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 10,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+11,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 11,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+12,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 12,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+13,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 13,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 14,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 15,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
diff --git a/test/helper.py b/test/helper.py
index f057016..ffe972e 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -59,7 +59,7 @@ def init_instance(test_name):
     return (output_dir, robin_filename, schedconf_filename)
 
 def has_expected_output(test_file):
-    return os.path.exists('test/expected_log/' + test_file + '/_jobs.csv')
+    return os.path.exists('test/expected_log/' + test_file + '_jobs.csv')
 
 def assert_expected_output(test_file):
     expected = 'test/expected_log/' + test_file + '_jobs.csv'
diff --git a/test/test_broker.py b/test/test_broker.py
index 6866ae6..fc72749 100644
--- a/test/test_broker.py
+++ b/test/test_broker.py
@@ -23,6 +23,9 @@ def test_broker_mono(platform_monoC, workload_static, sched_mono):
     ret = run_robin(robin_filename)
     assert ret.returncode == 0
 
+    if has_expected_output(test_name):
+        assert_expected_output(test_name)
+
 
 def test_broker_multi(platform_multiC, workload_static, sched_multi):
     """Test the broker mode with multicore platform files and schedulers"""
@@ -41,3 +44,6 @@ def test_broker_multi(platform_multiC, workload_static, sched_multi):
     instance.to_file(robin_filename)
     ret = run_robin(robin_filename)
     assert ret.returncode == 0
+
+    if has_expected_output(test_name):
+        assert_expected_output(test_name)
diff --git a/test/test_schedulers_multi.py b/test/test_schedulers_multi.py
index f2b646e..ce0f4b0 100644
--- a/test/test_schedulers_multi.py
+++ b/test/test_schedulers_multi.py
@@ -21,7 +21,7 @@ def test_multicore_filler(platform_multiC, workload_static):
     assert ret.returncode == 0
 
     if has_expected_output(test_name):
-        assert assert_expected_output(test_name)
+        assert_expected_output(test_name)
 
 
 def test_bin_packing(platform_multiC, workload_static):
@@ -44,7 +44,7 @@ def test_bin_packing(platform_multiC, workload_static):
     assert ret.returncode == 0
 
     if has_expected_output(test_name):
-        assert assert_expected_output(test_name)
+        assert_expected_output(test_name)
 
 
 def test_bin_packing_energy(platform_multiC, workload_static):
@@ -67,4 +67,4 @@ def test_bin_packing_energy(platform_multiC, workload_static):
     assert ret.returncode == 0
 
     if has_expected_output(test_name):
-        assert assert_expected_output(test_name)
+        assert_expected_output(test_name)
-- 
GitLab