ADD: added a general kubenetes API and integrated that in the classes and remodeled the info management

This commit is contained in:
hwinkel
2023-12-22 13:14:40 +01:00
parent 351cf9ec69
commit 4045f21786
13 changed files with 363 additions and 833 deletions

View File

@@ -14,6 +14,8 @@
#include <kubecontrol/PodController.hpp>
#include <crossguid/guid.hpp>
const int podGrid = 2;
void startShip(kubecontrol::PodController* podc,std::string uuid,std::string Name, std::string lat, std::string lon)
{
@@ -46,7 +48,7 @@ void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *u
int counter = 0;
double distance = 10000;
int rasterSize = 5;
int rasterSize = podGrid;
for (int i = 0; i < rasterSize; i++ )
{
@@ -98,17 +100,22 @@ std::vector<std::string> uuidList;
createScenario(podc, &uuidList);
LOG_S(INFO)<<"Amount Parent Pods: " << uuidList.size();
std::this_thread::sleep_for(std::chrono::milliseconds(20000));
std::this_thread::sleep_for(std::chrono::milliseconds(4000));
// podc.stopPod(std::string Label)
for (auto i: uuidList)
{
auto retrurn = std::async(std::launch::async, &kubecontrol::PodController::stopPod,podc,i);
}
// for (auto i: uuidList)
// {
// auto retrurn = std::async(std::launch::async, &kubecontrol::PodController::stopPod,podc,i);
// }
// std::this_thread::sleep_for(std::chrono::milliseconds(20000));
// Create a random number generator
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(0, uuidList.size()-1);
// Generate a random index
int random_index = distribution(generator);
podc->stopAllPods();
GIVEN("different Attributes for a Track in different forms")
{
@@ -117,9 +124,15 @@ podc->stopAllPods();
THEN("check if Track attributes are correct")
{
REQUIRE(true == true);
auto info = podc->getInfoForPod(uuidList[random_index]);
REQUIRE(info.Component == "ship");
REQUIRE(info.UUID == uuidList[random_index]);
REQUIRE(info.IP != "");
REQUIRE(info.Owner == "controller");
REQUIRE(podc->getInfoForAllPods().size() == podGrid*podGrid);
// REQUIRE(info1 != "");
podc->stopAllPods();