ADD: added updated drone.yml and changed some function calls
This commit is contained in:
@@ -22,7 +22,10 @@ SCENARIO("Testing the SimCore Sensor")
|
||||
|
||||
|
||||
std::string uuid = name;
|
||||
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
|
||||
std::string controller = "controller";
|
||||
std::string type = "ship";
|
||||
std::string image = "ship:latest";
|
||||
kubecontrol::KubePod ShipPod1(controller,uuid,type,image,"simulator");
|
||||
ShipPod1.setName(name);
|
||||
|
||||
nlohmann::json vars;
|
||||
@@ -49,7 +52,10 @@ ShipPod1.start(api);
|
||||
LOG_S(INFO)<<"started";
|
||||
|
||||
std::string name2 = "componenttest2";
|
||||
kubecontrol::KubePod ShipPod2("controller",name2,"CMS","ship:latest","simulator");
|
||||
std::string controller2 = "controller";
|
||||
std::string type2 = "ship";
|
||||
std::string image2 = "ship:latest";
|
||||
kubecontrol::KubePod ShipPod2(controller2,name2,type2,image2,"simulator");
|
||||
|
||||
nlohmann::json vars1;
|
||||
vars1["ENTITY_ID"] = name2;
|
||||
@@ -68,7 +74,7 @@ nlohmann::json vars1;
|
||||
vars["ENTITY_SENSORS"].push_back("radar:latest");
|
||||
ShipPod2.setEnvironmentVar("CONFIG", vars1.dump());
|
||||
|
||||
auto envmaps2 = std::make_shared<std::map<std::string, std::string>>();
|
||||
auto envmaps2 = std::make_shared<std::map<std::string, std::string>>();
|
||||
envmaps2->emplace("CONFIG", vars1.dump());
|
||||
|
||||
ShipPod2.addContainer("CMS", "systemprototype:latest",envmaps2);
|
||||
@@ -86,7 +92,7 @@ LOG_S(INFO)<<"started multi container pod";
|
||||
{
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
@@ -96,11 +102,11 @@ std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
REQUIRE(ShipPod1.getComponent() == "ship");
|
||||
REQUIRE(ShipPod1.getOwner() == "controller");
|
||||
REQUIRE(ShipPod1.getStatus() == "Running");
|
||||
REQUIRE(ShipPod1.getIp() != "");
|
||||
REQUIRE(!ShipPod1.getIp().empty());
|
||||
REQUIRE(ShipPod1.getPodsChilds(api).size() == 2);
|
||||
|
||||
// REQUIRE(info1 != "");
|
||||
|
||||
|
||||
|
||||
ShipPod1.stop(api);
|
||||
|
||||
@@ -111,4 +117,4 @@ std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
} //SCENARIO
|
||||
|
||||
@@ -14,23 +14,24 @@
|
||||
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
kubecontrol::kubecontrol kc("../docs/config");
|
||||
|
||||
std::string file= "../docs/config";
|
||||
kubecontrol::kubecontrol kubecontroler(file);
|
||||
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
kc.createYAML();
|
||||
kc.startPod();
|
||||
kubecontroler.createYAML();
|
||||
kubecontroler.startPod();
|
||||
// kc.getPods();
|
||||
// kc.deletePod("debug-debian");
|
||||
kc.getPods();
|
||||
|
||||
kubecontroler.getPods();
|
||||
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(true == true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,4 +39,4 @@ kubecontrol::kubecontrol kc("../docs/config");
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
} //SCENARIO
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "kubecontrol/KubePod.hpp"
|
||||
#include "nlohmann/json_fwd.hpp"
|
||||
#include <math.h>
|
||||
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
@@ -19,7 +21,10 @@ const int podGrid = 2;
|
||||
void startShip(kubecontrol::PodController* podc,std::string uuid,std::string Name, std::string lat, std::string lon)
|
||||
{
|
||||
|
||||
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
|
||||
std::string owner = "controller";
|
||||
std::string type = "ship";
|
||||
std::string image = "ship:latest";
|
||||
kubecontrol::KubePod ShipPod1(owner,uuid,type,image,"simulator");
|
||||
|
||||
nlohmann::json vars;
|
||||
vars["ENTITY_ID"] = uuid;
|
||||
@@ -37,29 +42,30 @@ void startShip(kubecontrol::PodController* podc,std::string uuid,std::string Nam
|
||||
|
||||
vars["ENTITY_SENSORS"].push_back("radar:latest");
|
||||
ShipPod1.setEnvironmentVar("CONFIG", vars.dump());
|
||||
|
||||
|
||||
podc->startPod(ShipPod1);
|
||||
|
||||
}
|
||||
void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *uuidList)
|
||||
{
|
||||
// GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
|
||||
// GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
|
||||
double lat = 54, lon = 1;
|
||||
int counter = 0;
|
||||
double distance = 10000;
|
||||
|
||||
int rasterSize = podGrid;
|
||||
|
||||
for (int i = 0; i < rasterSize; i++ )
|
||||
for (int i = 0; i < rasterSize; i++ )
|
||||
{
|
||||
double lonTmp = lon;
|
||||
for (int a = 0; a < rasterSize; a++)
|
||||
for (int a = 0; a < rasterSize; a++)
|
||||
{
|
||||
|
||||
|
||||
std::string name = "test";
|
||||
name += std::to_string(counter);
|
||||
double lat2, lon2;
|
||||
// geod.Direct(lat, lonTmp, 90, distance, lat2, lon2);
|
||||
double lat2 = 0;
|
||||
double lon2 = 0;
|
||||
// geod.Direct(lat, lonTmp, 90, distance, lat2, lon2);
|
||||
lat2= lat+10;
|
||||
// SimCore::Identifier id;
|
||||
// ids->push_back(id.getUUID());
|
||||
@@ -79,7 +85,7 @@ void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *u
|
||||
}
|
||||
double lat2, lon2;
|
||||
|
||||
// geod.Direct(lat, lon, 0, distance, lat2, lon2);
|
||||
// geod.Direct(lat, lon, 0, distance, lat2, lon2);
|
||||
|
||||
lat = lat + 10;
|
||||
|
||||
@@ -92,7 +98,7 @@ void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *u
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
|
||||
|
||||
|
||||
// kubecontrol::PodController podc("docs/config");
|
||||
auto podc = new kubecontrol::PodController("docs/config");
|
||||
std::vector<std::string> uuidList;
|
||||
@@ -121,7 +127,7 @@ std::this_thread::sleep_for(std::chrono::milliseconds(4000));
|
||||
{
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
auto info = podc->getInfoForPod(uuidList[random_index]);
|
||||
@@ -133,7 +139,7 @@ std::this_thread::sleep_for(std::chrono::milliseconds(4000));
|
||||
|
||||
// REQUIRE(info1 != "");
|
||||
podc->stopAllPods();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -141,4 +147,4 @@ std::this_thread::sleep_for(std::chrono::milliseconds(4000));
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
} //SCENARIO
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "kubecontrol/KubePod.hpp"
|
||||
#include "nlohmann/json_fwd.hpp"
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
@@ -14,12 +15,15 @@
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
|
||||
|
||||
|
||||
kubecontrol::PodController podc("docs/config");
|
||||
std::string name = "test1";
|
||||
|
||||
std::string uuid = name;
|
||||
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
|
||||
std::string owner = "controller";
|
||||
std::string type = "ship";
|
||||
std::string image = "ship:latest";
|
||||
kubecontrol::KubePod ShipPod1(owner,uuid,type,image,"simulator");
|
||||
|
||||
nlohmann::json vars;
|
||||
vars["ENTITY_ID"] = uuid;
|
||||
@@ -63,9 +67,9 @@ ShipPod1.updateInfoForThisPod(podc.getKubernetesAPI());
|
||||
// LOG_S(INFO)<<podc.PodList_.size();;
|
||||
// for(auto i: podc.PodList_)
|
||||
// {
|
||||
// LOG_S(INFO)<< i.InfoPod.Uuid;
|
||||
// LOG_S(INFO)<< i.InfoPod.ToString();
|
||||
|
||||
// LOG_S(INFO)<< i.InfoPod.Uuid;
|
||||
// LOG_S(INFO)<< i.InfoPod.ToString();
|
||||
|
||||
// }
|
||||
|
||||
// nlohmann::json jall = nlohmann::json::parse(podc.getPodsInfo());
|
||||
@@ -74,11 +78,11 @@ ShipPod1.updateInfoForThisPod(podc.getKubernetesAPI());
|
||||
{
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
auto info = podc.getInfoForPod(ShipPod1.getUUID());
|
||||
for (auto item: info.Childs)
|
||||
for (auto item: info.Childs)
|
||||
{
|
||||
LOG_S(INFO)<<item.UUID;
|
||||
LOG_S(INFO)<<item.IP;
|
||||
@@ -96,7 +100,7 @@ ShipPod1.updateInfoForThisPod(podc.getKubernetesAPI());
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
podc.stopAllPods();
|
||||
// REQUIRE(info1 != "");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -104,4 +108,4 @@ ShipPod1.updateInfoForThisPod(podc.getKubernetesAPI());
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
} //SCENARIO
|
||||
|
||||
Reference in New Issue
Block a user