Skip to content

Commit

Permalink
(#2) passing test++
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 8, 2019
1 parent 13692a9 commit e4bbe7c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ComprehensiveIntegrationHostFailuresTest : public ::testing::Test {
std::shared_ptr<wrench::CloudComputeService> cloud_service = nullptr;
std::shared_ptr<wrench::BareMetalComputeService> baremetal_service = nullptr;

void do_IntegrationFailurTest_test(std::map<std::string, bool> args);
void do_IntegrationFailureTest_test(std::map<std::string, bool> args);


protected:
Expand Down Expand Up @@ -73,15 +73,16 @@ class ComprehensiveIntegrationHostFailuresTest : public ::testing::Test {
"BareMetalHead", "BareMetalHost1", "BareMetalHost2"};

for (auto const &h : hostnames) {
xml += "<host id=\"" + h + "\" speed=\"1f\" core=\"4\"> <prop id=\"ram\" value=\"100\"/> \n"
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"10000000000000\"/>"
" <prop id=\"mount\" value=\"/\"/>"
" </disk>"
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100\"/>"
" <prop id=\"mount\" value=\"/scratch\"/>"
" </disk>"
xml += "<host id=\"" + h + "\" speed=\"1f\" core=\"4\" > \n"
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">\n"
" <prop id=\"size\" value=\"10000000000000B\"/>\n"
" <prop id=\"mount\" value=\"/\"/>\n"
" </disk>\n"
" <disk id=\"scratch_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">\n"
" <prop id=\"size\" value=\"100B\"/>\n"
" <prop id=\"mount\" value=\"/scratch\"/>\n"
" </disk>\n"
" <prop id=\"ram\" value=\"100\" /> \n"
"</host>\n";
}

Expand Down Expand Up @@ -119,6 +120,7 @@ class ComprehensiveIntegrationHostFailuresTest : public ::testing::Test {

xml += " </zone> \n"
"</platform>\n";

#if 0

" <host id=\"StorageHost1\" speed=\"1f\" core=\"1\"/> "
Expand All @@ -142,6 +144,7 @@ class ComprehensiveIntegrationHostFailuresTest : public ::testing::Test {
FILE *platform_file = fopen(platform_file_path.c_str(), "w");
fprintf(platform_file, "%s", xml.c_str());
fclose(platform_file);
WRENCH_INFO("%s", xml.c_str());
}

std::string platform_file_path = UNIQUE_TMP_PATH_PREFIX + "platform.xml";
Expand Down Expand Up @@ -347,51 +350,51 @@ TEST_F(ComprehensiveIntegrationHostFailuresTest, OneNonFaultyStorageOneFaultyBar
std::map<std::string, bool> args;
args["storage1"] = false;
args["baremetal"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, OneFaultyStorageOneNonFaultyBareMetal) {
std::map<std::string, bool> args;
args["storage1"] = true;
args["baremetal"] = false;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, OneFaultyStorageOneFaultyBareMetal) {
std::map<std::string, bool> args;
args["storage1"] = true;
args["baremetal"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, TwoFaultyStorageOneFaultyBareMetal) {
std::map<std::string, bool> args;
args["storage1"] = true;
args["storage2"] = true;
args["baremetal"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, OneNonFaultyStorageOneFaultyCloud) {
std::map<std::string, bool> args;
args["storage1"] = false;
args["cloud"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, OneFaultyStorageOneFaultyCloud) {
std::map<std::string, bool> args;
args["storage1"] = true;
args["cloud"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, TwoFaultyStorageOneFaultyCloud) {
std::map<std::string, bool> args;
args["storage1"] = true;
args["storage2"] = true;
args["cloud"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

TEST_F(ComprehensiveIntegrationHostFailuresTest, WholeEnchilada) {
Expand All @@ -400,10 +403,10 @@ TEST_F(ComprehensiveIntegrationHostFailuresTest, WholeEnchilada) {
args["storage2"] = true;
args["baremetal"] = true;
args["cloud"] = true;
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailurTest_test, args);
DO_TEST_WITH_FORK_ONE_ARG(do_IntegrationFailureTest_test, args);
}

void ComprehensiveIntegrationHostFailuresTest::do_IntegrationFailurTest_test(std::map<std::string, bool> args) {
void ComprehensiveIntegrationHostFailuresTest::do_IntegrationFailureTest_test(std::map<std::string, bool> args) {

// Create and initialize a simulation
auto *simulation = new wrench::Simulation();
Expand All @@ -416,7 +419,9 @@ void ComprehensiveIntegrationHostFailuresTest::do_IntegrationFailurTest_test(std
simulation->init(&argc, argv);

// Setting up the platform
WRENCH_INFO("HERE");
ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path));
WRENCH_INFO("DONE!");

// Create Storage Services
if (args.find("storage1") != args.end()) {
Expand Down
18 changes: 11 additions & 7 deletions test/simulation/SimpleSimulationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,16 @@ class SimpleSimulationTest : public ::testing::Test {
"<platform version=\"4.1\"> "
" <zone id=\"AS0\" routing=\"Full\"> "
" <host id=\"DualCoreHost\" speed=\"1f\" core=\"2\" > "
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100\"/>"
" <prop id=\"mount\" value=\"/\"/>"
" <disk id=\"large_disk1\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100B\"/>"
" <prop id=\"mount\" value=\"/disk1\"/>"
" </disk>"
" <disk id=\"large_disk2\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100B\"/>"
" <prop id=\"mount\" value=\"/disk2\"/>"
" </disk>"
" <disk id=\"scratch\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"101\"/>"
" <prop id=\"size\" value=\"101B\"/>"
" <prop id=\"mount\" value=\"/scratch\"/>"
" </disk>"
" </host> "
Expand All @@ -103,7 +107,7 @@ class SimpleSimulationTest : public ::testing::Test {
" <prop id=\"mount\" value=\"/\"/>"
" </disk>"
" <disk id=\"scratch\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"101\"/>"
" <prop id=\"size\" value=\"101B\"/>"
" <prop id=\"mount\" value=\"/scratch\"/>"
" </disk>"
" </host> "
Expand Down Expand Up @@ -356,10 +360,10 @@ void SimpleSimulationTest::do_getReadyTasksTest_test() {

// Create a Storage Service
ASSERT_THROW(storage_service = simulation->add(
new wrench::SimpleStorageService(hostname, {"/"}, {},
new wrench::SimpleStorageService(hostname, {"/disk1"}, {},
{{wrench::SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD, -1}})), std::invalid_argument);
storage_service = simulation->add(
new wrench::SimpleStorageService(hostname, {"/"}, {},
new wrench::SimpleStorageService(hostname, {"/disk2"}, {},
{{wrench::SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD, 123}}));


Expand Down

0 comments on commit e4bbe7c

Please sign in to comment.