Skip to content

Commit

Permalink
(#2) test passing++
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 10, 2019
1 parent 8cbaf6e commit 3467567
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@ namespace wrench {
}
}
StorageService::readFiles(files_to_read);
WRENCH_INFO("SETTING TASK %s's READ INPUT END DATE TO %lf",
task->getID().c_str(), S4U_Simulation::getClock());
task->setReadInputEndDate(S4U_Simulation::getClock());
} catch (WorkflowExecutionException &e) {
this->failure_timestamp_should_be_generated = true;
Expand Down
2 changes: 2 additions & 0 deletions src/wrench/services/storage/StorageService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ namespace wrench {

// Send a message to the daemon of the dst service
std::string answer_mailbox = S4U_Mailbox::generateUniqueMailboxName("copy_file");
WRENCH_INFO("GENERATING FILE COPY START TIMESTAMP (SYNC)");
auto start_timestamp = new SimulationTimestampFileCopyStart(file, src_location, dst_location);
src_location->getStorageService()->simulation->getOutput().addTimestamp<SimulationTimestampFileCopyStart>(start_timestamp);

Expand Down Expand Up @@ -619,6 +620,7 @@ namespace wrench {
assertServiceIsUp(src_location->getStorageService());
assertServiceIsUp(dst_location->getStorageService());

WRENCH_INFO("GENERATING FILE COPY START (FOR ASYNC)");
auto start_timestamp = new SimulationTimestampFileCopyStart(file, src_location, dst_location);
src_location->getStorageService()->simulation->getOutput().addTimestamp<SimulationTimestampFileCopyStart>(start_timestamp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace wrench {
std::string message = "Simple Storage service " + this->getName() +
" starting on host " + this->getHostname();
for (auto const &fs : this->file_systems) {
message += "\n\t- " + fs.first + ": " +
message += "\n\t- mount point " + fs.first + ": " +
std::to_string(fs.second->getFreeSpace()) + "/" +
std::to_string(fs.second->getTotalCapacity()) + " Bytes";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "../../include/TestWithFork.h"
#include "../../include/UniqueTmpPathPrefix.h"

WRENCH_LOG_NEW_DEFAULT_CATEGORY(simulation_timestamp_file_copy_test, "Log category for SimulationTimestampFileCopyTest");


class SimulationTimestampFileCopyTest : public ::testing::Test {

public:
Expand Down Expand Up @@ -93,39 +96,39 @@ class SimulationTimestampFileCopyBasicTestWMS : public wrench::WMS {
auto dmm = this->createDataMovementManager();

// regular copy with successful completion
WRENCH_INFO("DOING SYNCHRONOUS COPY");
dmm->doSynchronousFileCopy(this->test->file_1,
wrench::FileLocation::LOCATION(this->test->source_storage_service),
wrench::FileLocation::LOCATION(this->test->destination_storage_service));

WRENCH_INFO("DOING ASYNCHRONOUS COPY");
dmm->initiateAsynchronousFileCopy(this->test->xl_file,
wrench::FileLocation::LOCATION(this->test->source_storage_service),
wrench::FileLocation::LOCATION(this->test->destination_storage_service));

WRENCH_INFO("DOING SYNCHRONOUS COPY");
dmm->doSynchronousFileCopy(this->test->file_2,
wrench::FileLocation::LOCATION(this->test->source_storage_service),
wrench::FileLocation::LOCATION(this->test->destination_storage_service));

WRENCH_INFO("DOING SYNCHRONOUS COPY");
dmm->doSynchronousFileCopy(this->test->file_3,
wrench::FileLocation::LOCATION(this->test->source_storage_service),
wrench::FileLocation::LOCATION(this->test->destination_storage_service));

bool failed = false;

// this should fail and a SimulationTimestampFileCopyFailure should be created
try {
WRENCH_INFO("DOING SYNCHRONOUS COPY THAT WILL FAIL");
dmm->doSynchronousFileCopy(this->test->too_large_file,
wrench::FileLocation::LOCATION(this->test->source_storage_service),
wrench::FileLocation::LOCATION(this->test->destination_storage_service));

} catch(wrench::WorkflowExecutionException &e) {
failed = true;
}
if (not failed) {
throw std::runtime_error("file copy should have failed");
} catch(wrench::WorkflowExecutionException &e) {
}

// wait for xl_file file copy to complete
simulation->sleep(100);
wrench::Simulation::sleep(100);

/*
* expected outcome:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class SimulationTimestampTaskTest : public ::testing::Test {
" <prop id=\"size\" value=\"100000000000000B\"/>"
" <prop id=\"mount\" value=\"/\"/>"
" </disk>"
" <disk id=\"large_disk_backup\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100000000000000B\"/>"
" <prop id=\"mount\" value=\"/backup\"/>"
" </disk>"
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100B\"/>"
" <prop id=\"mount\" value=\"/scratch\"/>"
Expand All @@ -51,6 +55,10 @@ class SimulationTimestampTaskTest : public ::testing::Test {
" <prop id=\"size\" value=\"100000000000000B\"/>"
" <prop id=\"mount\" value=\"/\"/>"
" </disk>"
" <disk id=\"large_disk_backup\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100000000000000B\"/>"
" <prop id=\"mount\" value=\"/backup\"/>"
" </disk>"
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100B\"/>"
" <prop id=\"mount\" value=\"/scratch\"/>"
Expand Down Expand Up @@ -346,7 +354,7 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskMultiple_test() {
{})));

ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/"})));
ASSERT_NO_THROW(backup_storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/"})));
ASSERT_NO_THROW(backup_storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/backup"})));


std::shared_ptr<wrench::WMS> wms = nullptr;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class DataMovementManagerCopyRegisterTestWMS : public wrench::WMS {
throw std::runtime_error("Synchronous file copy succeeded but file was not registered at DstHost");
}

WRENCH_INFO("===========================================");
// Do the same thing but kill the FileRegistryService first

wrench::StorageService::deleteFile(this->test->src_file_1,
Expand Down Expand Up @@ -176,7 +175,6 @@ class DataMovementManagerCopyRegisterTestWMS : public wrench::WMS {
throw std::runtime_error("Got an exception while trying to instantiate a file copy: " + std::string(e.what()));
}

WRENCH_INFO("===========================================");
try {
async_copy_event = this->getWorkflow()->waitForNextExecutionEvent();
} catch (wrench::WorkflowExecutionException &e) {
Expand Down
3 changes: 1 addition & 2 deletions test/workflow/WorkflowTaskTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class WorkflowTaskExecutionHistoryTestWMS : public wrench::WMS {

wrench::StandardJob *job_that_will_complete = job_manager->createStandardJob(this->test->t4,
{{this->test->small_input_file,
wrench::FileLocation::LOCATION(this->test->storage_service)},
wrench::FileLocation::LOCATION(this->test->backup_storage_service)},
{this->test->large_input_file,
wrench::FileLocation::LOCATION(this->test->storage_service)},
{this->test->t4_output_file,
Expand Down Expand Up @@ -383,7 +383,6 @@ void WorkflowTaskTest::do_WorkflowTaskExecutionHistory_test() {

// none of the values should be -1 except task_failure
for (auto &value : t4_successful_execution_history_values) {
WRENCH_INFO("VALUE=%lf", value);
ASSERT_NE(value, -1.0);
}

Expand Down

0 comments on commit 3467567

Please sign in to comment.