ADD: added massivpodhandling test
This commit is contained in:
@@ -109,6 +109,10 @@ IF (${TEST_KUBECONTROL_LIBRARY})
|
||||
add_executable(test_podcontroller tests/test_podcontroller.cpp)
|
||||
target_link_libraries(test_podcontroller Catch2::Catch2 kubecontrol )
|
||||
catch_discover_tests(test_podcontroller)
|
||||
|
||||
add_executable(test_massivPodHandling tests/test_massivPodHandling.cpp)
|
||||
target_link_libraries(test_massivPodHandling Catch2::Catch2 kubecontrol )
|
||||
catch_discover_tests(test_massivPodHandling)
|
||||
|
||||
add_executable(test_podInfo tests/test_podInfo.cpp)
|
||||
target_link_libraries(test_podInfo Catch2::Catch2 kubecontrol )
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace kubecontrol
|
||||
InfoPod.update(response);
|
||||
while (InfoPod.Status != "Running" && InfoPod.Status != "Succeeded") {
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
response = this->getInfo(curlURL, token);
|
||||
|
||||
InfoPod.update(response);
|
||||
|
||||
115
tests/test_massivPodHandling.cpp
Normal file
115
tests/test_massivPodHandling.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
|
||||
|
||||
|
||||
#include "kubecontrol/KubePod.hpp"
|
||||
#include "nlohmann/json_fwd.hpp"
|
||||
#include <thread>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <kubecontrol/PodController.hpp>
|
||||
#include <crossguid/guid.hpp>
|
||||
|
||||
void startShip(kubecontrol::PodController* podc,std::string Name, std::string lat, std::string lon)
|
||||
{
|
||||
|
||||
std::string uuid = xg::newGuid().str();
|
||||
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
|
||||
|
||||
nlohmann::json vars;
|
||||
vars["ENTITY_ID"] = uuid;
|
||||
vars["ENTITY_NAME"] = Name;
|
||||
vars["ENTITY_SIDE"] = "Neutral";
|
||||
vars["POSITION"]["LAT"] = lat;
|
||||
vars["POSITION"]["LON"] = lon;
|
||||
vars["POSITION"]["Height"] = "0";
|
||||
vars["COURSE"] = "0";
|
||||
vars["SPEED"] = "0";
|
||||
vars["GROUNDTRUTH_PORT"] = std::to_string(10000);
|
||||
vars["GROUNDTRUTH_ADDR"] = "239.0.0.1";
|
||||
vars["COMMAND_PORT"] = "5555";
|
||||
vars["ENTITY_RCS"] = std::to_string(850);
|
||||
|
||||
vars["ENTITY_SENSORS"].push_back("radar:latest");
|
||||
ShipPod1.setEnvironmentVar("CONFIG", vars.dump());
|
||||
|
||||
podc->startPod(ShipPod1);
|
||||
|
||||
}
|
||||
void createScenario(kubecontrol::PodController* podc)
|
||||
{
|
||||
// GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
|
||||
double lat = 54, lon = 1;
|
||||
int counter = 0;
|
||||
double distance = 10000;
|
||||
|
||||
int rasterSize = 2;
|
||||
|
||||
for (int i = 0; i < rasterSize; i++ )
|
||||
{
|
||||
double lonTmp = lon;
|
||||
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);
|
||||
lat2= lat+10;
|
||||
// SimCore::Identifier id;
|
||||
// ids->push_back(id.getUUID());
|
||||
|
||||
startShip( podc,name, std::to_string(lat2), std::to_string(lon2));
|
||||
|
||||
// SimCore::Position pos;
|
||||
// pos.setGeodesicPos(lat2, lon2, 0);
|
||||
// auto track = std::make_shared<SimCore::SimTrack>(id,name,SimCore::Kind::EntityKind::SURFACE,SimCore::Side::NEUTRAL);
|
||||
// track->setPosition(pos);
|
||||
// list->addTrack(track);
|
||||
// SimControl::startNewShip(name, std::to_string(lat2), std::to_string(lon2), "0", "0", "0");
|
||||
lonTmp = lon2;
|
||||
counter ++;
|
||||
}
|
||||
double lat2, lon2;
|
||||
|
||||
// geod.Direct(lat, lon, 0, distance, lat2, lon2);
|
||||
|
||||
lat = lat + 10;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
|
||||
|
||||
kubecontrol::PodController podc("docs/config");
|
||||
|
||||
createScenario(&podc);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
|
||||
podc.stopAllPods();
|
||||
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(true == true);
|
||||
|
||||
// REQUIRE(info1 != "");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
Reference in New Issue
Block a user