75 lines
1.8 KiB
C++
75 lines
1.8 KiB
C++
|
|
|
|
|
|
#include "kubecontrol/PodController.hpp"
|
|
#include "nlohmann/json_fwd.hpp"
|
|
#include <thread>
|
|
#define CATCH_CONFIG_MAIN
|
|
#include <catch2/catch.hpp>
|
|
#include "loguru.hpp"
|
|
|
|
|
|
SCENARIO("Testing the SimCore Sensor")
|
|
{
|
|
|
|
|
|
// kubecontrol::PodController podc("docs/config");
|
|
|
|
kubecontrol::KubernetesAPI api(YAML::LoadFile("docs/config"));
|
|
std::string name = "hamburg";
|
|
|
|
std::string uuid = name;
|
|
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
|
|
|
|
nlohmann::json vars;
|
|
vars["ENTITY_ID"] = uuid;
|
|
vars["ENTITY_NAME"] = "FGS Hamburg";
|
|
vars["ENTITY_SIDE"] = "Neutral";
|
|
vars["POSITION"]["LAT"] = "55";
|
|
vars["POSITION"]["LON"] = "8";
|
|
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());
|
|
|
|
|
|
LOG_S(INFO)<<"Starting";
|
|
|
|
ShipPod1.start(api);
|
|
LOG_S(INFO)<<"started";
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
|
|
|
GIVEN("different Attributes for a Track in different forms")
|
|
{
|
|
WHEN("constructing Track Object with data")
|
|
{
|
|
|
|
THEN("check if Track attributes are correct")
|
|
{
|
|
REQUIRE(ShipPod1.getUUID() == "hamburg");
|
|
REQUIRE(ShipPod1.getComponent() == "ship");
|
|
REQUIRE(ShipPod1.getOwner() == "controller");
|
|
REQUIRE(ShipPod1.getStatus() == "Running");
|
|
REQUIRE(ShipPod1.getIp() != "");
|
|
REQUIRE(ShipPod1.getUUIDsForChildPods(api).size() == 2);
|
|
|
|
// REQUIRE(info1 != "");
|
|
|
|
|
|
ShipPod1.stop(api);
|
|
|
|
|
|
|
|
|
|
} //THEN
|
|
} // WHEN
|
|
} // GIVEN
|
|
} //SCENARIO
|