From e1dcc6996f6119607e1954368549f43b529bf611 Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Sat, 21 Mar 2020 11:35:33 -0700 Subject: [PATCH] Adding new test assertions --- .../local/savedsearches.conf | 0 tests/test_docker_splunk.py | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/splunk_app_example/local/savedsearches.conf diff --git a/tests/fixtures/splunk_app_example/local/savedsearches.conf b/tests/fixtures/splunk_app_example/local/savedsearches.conf new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_docker_splunk.py b/tests/test_docker_splunk.py index afc22cf0..0c93d048 100644 --- a/tests/test_docker_splunk.py +++ b/tests/test_docker_splunk.py @@ -1924,7 +1924,7 @@ def test_compose_1deployment1so(self): self.check_common_keys(inventory_json, container_mapping[container]) # Check Splunkd on all the containers assert self.check_splunkd("admin", self.password) - # Make sure apps are installed, and shcluster is setup properly + # Make sure apps are installed and certain subdirectories are excluded containers = self.client.containers(filters={"label": "com.docker.compose.project={}".format(self.project_name)}) assert len(containers) == 3 for container in containers: @@ -1939,6 +1939,14 @@ def test_compose_1deployment1so(self): resp = requests.get(url, auth=("admin", self.password), verify=False) # Deployment server should *not* install the app assert resp.status_code == 404 + # Check that the app exists in etc/apps + exec_command = self.client.exec_create(container["Id"], "ls /opt/splunk/etc/apps/splunk_app_example/local/", user="splunk") + std_out = self.client.exec_start(exec_command) + assert "savedsearches.conf" in std_out + # Check that the app exists in etc/deployment-apps + exec_command = self.client.exec_create(container["Id"], "ls /opt/splunk/etc/deployment-apps/splunk_app_example/local/", user="splunk") + std_out = self.client.exec_start(exec_command) + assert "savedsearches.conf" not in std_out if container_name == "so1": RETRIES = 5 for i in range(RETRIES): @@ -2002,6 +2010,14 @@ def test_compose_1deployment1uf(self): resp = requests.get(url, auth=("admin", self.password), verify=False) # Deployment server should *not* install the app assert resp.status_code == 404 + # Check that the app exists in etc/apps + exec_command = self.client.exec_create(container["Id"], "ls /opt/splunk/etc/apps/splunk_app_example/local/", user="splunk") + std_out = self.client.exec_start(exec_command) + assert "savedsearches.conf" in std_out + # Check that the app exists in etc/deployment-apps + exec_command = self.client.exec_create(container["Id"], "ls /opt/splunk/etc/deployment-apps/splunk_app_example/local/", user="splunk") + std_out = self.client.exec_start(exec_command) + assert "savedsearches.conf" not in std_out if container_name == "uf1": RETRIES = 5 for i in range(RETRIES):