ADD: added test_podInfo and a bug fix
This commit is contained in:
@@ -112,5 +112,8 @@ IF (${TEST_KUBECONTROL_LIBRARY})
|
|||||||
target_link_libraries(test_podcontroller Catch2::Catch2 kubecontrol )
|
target_link_libraries(test_podcontroller Catch2::Catch2 kubecontrol )
|
||||||
catch_discover_tests(test_podcontroller)
|
catch_discover_tests(test_podcontroller)
|
||||||
|
|
||||||
|
add_executable(test_podInfo tests/test_podInfo.cpp)
|
||||||
|
target_link_libraries(test_podInfo Catch2::Catch2 kubecontrol )
|
||||||
|
catch_discover_tests(test_podInfo)
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
Submodule libs/yaml-cpp updated: f791b955d8...35b4498026
@@ -25,11 +25,9 @@ namespace kubecontrol
|
|||||||
void PodInfo::update(std::string response)
|
void PodInfo::update(std::string response)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nlohmann::json j;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
j = nlohmann::json::parse(response);
|
nlohmann::json j = nlohmann::json::parse(response);
|
||||||
|
|
||||||
if (j.contains("items"))
|
if (j.contains("items"))
|
||||||
{
|
{
|
||||||
|
|||||||
36
tests/test_podInfo.cpp
Normal file
36
tests/test_podInfo.cpp
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "kubecontrol/PodController.hpp"
|
||||||
|
#include "nlohmann/json_fwd.hpp"
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include <catch2/catch.hpp>
|
||||||
|
#include <kubecontrol/PodInfo.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
SCENARIO("Testing the SimCore Sensor")
|
||||||
|
{
|
||||||
|
kubecontrol::PodController podc("docs/config");
|
||||||
|
auto tmp = podc.getInfoForPod("webapp");
|
||||||
|
LOG_S(INFO)<<tmp;
|
||||||
|
kubecontrol::PodInfo info(tmp);
|
||||||
|
|
||||||
|
GIVEN("different Attributes for a Track in different forms")
|
||||||
|
{
|
||||||
|
WHEN("constructing Track Object with data")
|
||||||
|
{
|
||||||
|
|
||||||
|
THEN("check if Track attributes are correct")
|
||||||
|
{
|
||||||
|
REQUIRE(info.Uuid == "webapp");
|
||||||
|
|
||||||
|
// REQUIRE(info1 != "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} //THEN
|
||||||
|
} // WHEN
|
||||||
|
} // GIVEN
|
||||||
|
} //SCENARIO
|
||||||
Reference in New Issue
Block a user