Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/config_test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ envoy_cc_test(
],
deps = [
":config_test_lib",
"//source/common/filesystem:filesystem_lib",
"//test/test_common:environment_lib",
"//test/test_common:utility_lib",
],
Expand Down
20 changes: 17 additions & 3 deletions test/config_test/example_configs_test.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
#include "common/filesystem/filesystem_impl.h"

#include "test/config_test/config_test.h"
#include "test/test_common/environment.h"
#include "test/test_common/utility.h"

#include "gtest/gtest.h"

namespace Envoy {

// freebind/freebind.yaml is not supported on macOS or Windows and is disabled via Bazel.
constexpr uint64_t LinuxOnlyConfigFileTestCount = 1UL;

TEST(ExampleConfigsTest, All) {
TestEnvironment::exec(
{TestEnvironment::runfilesPath("test/config_test/example_configs_test_setup.sh")});

#ifdef WIN32
Filesystem::InstanceImplWin32 file_system;
#else
Filesystem::InstanceImplPosix file_system;
#endif

const auto config_file_count = std::stoi(
file_system.fileReadToEnd(TestEnvironment::temporaryDirectory() + "/config-file-count.txt"));

// Change working directory, otherwise we won't be able to read files using relative paths.
#ifdef PATH_MAX
char cwd[PATH_MAX];
Expand All @@ -20,10 +35,9 @@ TEST(ExampleConfigsTest, All) {
RELEASE_ASSERT(::chdir(directory.c_str()) == 0, "");

#if defined(__APPLE__) || defined(WIN32)
// freebind/freebind.yaml is not supported on macOS or Windows and is disabled via Bazel.
EXPECT_EQ(37UL, ConfigTest::run(directory));
EXPECT_EQ(config_file_count - LinuxOnlyConfigFileTestCount, ConfigTest::run(directory));
Comment thread
phlax marked this conversation as resolved.
Outdated
#else
EXPECT_EQ(38UL, ConfigTest::run(directory));
EXPECT_EQ(config_file_count, ConfigTest::run(directory));
#endif

ConfigTest::testMerge();
Expand Down
3 changes: 3 additions & 0 deletions test/config_test/example_configs_test_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ set -e
DIR="$TEST_TMPDIR"/test/config_test
mkdir -p "$DIR"
tar -xvf "$TEST_SRCDIR"/envoy/configs/example_configs.tar -C "$DIR"

CONFIG_FILE_COUNT=$(find "$DIR" -type f | grep .yaml | wc -l)
echo "$CONFIG_FILE_COUNT" > "$TEST_TMPDIR"/config-file-count.txt
Comment thread
phlax marked this conversation as resolved.
Outdated