diff --git a/CMakeLists.txt b/CMakeLists.txt index 539a57d..6feee4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/src/kubecontrol/KubePod.cpp b/src/kubecontrol/KubePod.cpp index a16f455..e18a0fc 100644 --- a/src/kubecontrol/KubePod.cpp +++ b/src/kubecontrol/KubePod.cpp @@ -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); diff --git a/tests/test_massivPodHandling.cpp b/tests/test_massivPodHandling.cpp new file mode 100644 index 0000000..47e059f --- /dev/null +++ b/tests/test_massivPodHandling.cpp @@ -0,0 +1,115 @@ + + + +#include "kubecontrol/KubePod.hpp" +#include "nlohmann/json_fwd.hpp" +#include +#define CATCH_CONFIG_MAIN +#include + +#include +#include + +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(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 \ No newline at end of file