Skip to content

Commit

Permalink
Rewrite config api unit test to gtest.
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Feb 2, 2025
1 parent 0401988 commit 86abcf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/src/tests/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vespa_add_executable(config_api_test_app TEST
api.cpp
DEPENDS
vespa_config
GTest::gtest
)
vespa_add_test(NAME config_api_test_app COMMAND config_api_test_app)
vespa_generate_config(config_api_test_app ../../test/resources/configdefinitions/my.def)
9 changes: 5 additions & 4 deletions config/src/tests/api/api.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config/common/configcontext.h>
#include <config-my.h>
#include <vespa/config/subscription/configsubscriber.hpp>
#include <vespa/vespalib/gtest/gtest.h>

using namespace config;

TEST("require that can subscribe with empty config id") {
TEST(ConfigApiTest, require_that_can_subscribe_with_empty_config_id)
{
ConfigSet set;
auto ctx = std::make_shared<ConfigContext>(set);
MyConfigBuilder builder;
Expand All @@ -17,7 +18,7 @@ TEST("require that can subscribe with empty config id") {
ASSERT_TRUE(subscriber.nextConfigNow());
std::unique_ptr<MyConfig> cfg(handle->getConfig());
ASSERT_TRUE(cfg);
ASSERT_EQUAL("myfoo", cfg->myField);
ASSERT_EQ("myfoo", cfg->myField);
}

TEST_MAIN() { TEST_RUN_ALL(); }
GTEST_MAIN_RUN_ALL_TESTS()

0 comments on commit 86abcf8

Please sign in to comment.