aboutsummaryrefslogtreecommitdiffstats
path: root/configutil/src/tests/host_filter/host_filter_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'configutil/src/tests/host_filter/host_filter_test.cpp')
-rw-r--r--configutil/src/tests/host_filter/host_filter_test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/configutil/src/tests/host_filter/host_filter_test.cpp b/configutil/src/tests/host_filter/host_filter_test.cpp
new file mode 100644
index 00000000000..66c0418bb46
--- /dev/null
+++ b/configutil/src/tests/host_filter/host_filter_test.cpp
@@ -0,0 +1,18 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/vespalib/testkit/testapp.h>
+#include <lib/hostfilter.h>
+
+TEST("empty hostfilter includes any and all hosts") {
+ HostFilter filter;
+ EXPECT_TRUE(filter.includes("foo.yahoo.com"));
+}
+
+TEST("explicit host set limits to provided hosts only") {
+ HostFilter::HostSet hosts({"bar.yahoo.com", "zoidberg.yahoo.com"});
+ HostFilter filter(std::move(hosts));
+ EXPECT_TRUE(filter.includes("bar.yahoo.com"));
+ EXPECT_TRUE(filter.includes("zoidberg.yahoo.com"));
+ EXPECT_FALSE(filter.includes("foo.yahoo.com"));
+}
+
+TEST_MAIN() { TEST_RUN_ALL(); }