aboutsummaryrefslogtreecommitdiff
path: root/kolla_ansible/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-09-17 11:03:26 +0000
committerGerrit Code Review <review@openstack.org>2020-09-17 11:03:26 +0000
commitfbef9b36d609f9ab7495e2a847ab5c2bf085fdd3 (patch)
treede4de127662eeebb6062edec2786596bf84a2744 /kolla_ansible/tests
parentbc388d5657b8c97a3f63b1606d53b4bfd722e91d (diff)
parent56a07702bcea02cf3793d6c830acc687b68244be (diff)
downloadkolla-ansible-fbef9b36d609f9ab7495e2a847ab5c2bf085fdd3.tar.gz
kolla-ansible-fbef9b36d609f9ab7495e2a847ab5c2bf085fdd3.zip
Merge "Performance: use a single config file for fluentd"
Diffstat (limited to 'kolla_ansible/tests')
-rw-r--r--kolla_ansible/tests/unit/test_fluentd_filters.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/kolla_ansible/tests/unit/test_fluentd_filters.py b/kolla_ansible/tests/unit/test_fluentd_filters.py
new file mode 100644
index 000000000..353d01732
--- /dev/null
+++ b/kolla_ansible/tests/unit/test_fluentd_filters.py
@@ -0,0 +1,96 @@
+# Copyright (c) 2020 StackHPC Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import unittest
+
+from kolla_ansible.fluentd_filters import customise_fluentd
+
+
+class TestFilters(unittest.TestCase):
+
+ def test_customise_fluentd_no_files(self):
+ default_files = [
+ ]
+ customised_files = [
+ ]
+ expected = [
+ ]
+ result = customise_fluentd(default_files, customised_files)
+ self.assertEqual(expected, result)
+
+ def test_customise_fluentd_no_customised_files(self):
+ default_files = [
+ "foo/bar.conf.j2"
+ ]
+ customised_files = [
+ ]
+ expected = [
+ "foo/bar.conf.j2"
+ ]
+ result = customise_fluentd(default_files, customised_files)
+ self.assertEqual(expected, result)
+
+ def test_customise_fluentd_no_default_files(self):
+ default_files = [
+ ]
+ customised_files = [
+ "foo/bar.conf"
+ ]
+ expected = [
+ "foo/bar.conf"
+ ]
+ result = customise_fluentd(default_files, customised_files)
+ self.assertEqual(expected, result)
+
+ def test_customise_fluentd_both(self):
+ default_files = [
+ "foo/bar.conf.j2"
+ ]
+ customised_files = [
+ "baz/qux.conf"
+ ]
+ expected = [
+ "foo/bar.conf.j2",
+ "baz/qux.conf"
+ ]
+ result = customise_fluentd(default_files, customised_files)
+ self.assertEqual(expected, result)
+
+ def test_customise_fluentd_override(self):
+ default_files = [
+ "foo/bar.conf.j2"
+ ]
+ customised_files = [
+ "baz/bar.conf"
+ ]
+ expected = [
+ "baz/bar.conf"
+ ]
+ result = customise_fluentd(default_files, customised_files)
+ self.assertEqual(expected, result)
+
+ def test_customise_fluentd_both_with_override(self):
+ default_files = [
+ "foo/bar.conf.j2",
+ "baz/qux.conf.j2"
+ ]
+ customised_files = [
+ "baz/bar.conf"
+ ]
+ expected = [
+ "baz/bar.conf",
+ "baz/qux.conf.j2"
+ ]
+ result = customise_fluentd(default_files, customised_files)
+ self.assertEqual(expected, result)