Skip to content

Commit 15a8f15

Browse files
nwang92alishamayor
andauthored
Adding test for standalone forwarding cases (#347)
Co-authored-by: Alisha Mayor <alishamayor@gmail.com>
1 parent 20e3a5b commit 15a8f15

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/test_docker_splunk.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,42 @@ def test_adhoc_1uf_password_from_file(self):
933933
if cid:
934934
self.client.remove_container(cid, v=True, force=True)
935935

936+
def test_adhoc_1so_reflexive_forwarding(self):
937+
# Create a splunk container
938+
cid = None
939+
try:
940+
splunk_container_name = generate_random_string()
941+
# When adding SPLUNK_STANDALONE_URL to the standalone, we shouldn't have any situation where it starts forwarding/disables indexing
942+
cid = self.client.create_container(self.SPLUNK_IMAGE_NAME, tty=True, ports=[8089], name=splunk_container_name,
943+
environment={
944+
"DEBUG": "true",
945+
"SPLUNK_START_ARGS": "--accept-license",
946+
"SPLUNK_PASSWORD": self.password,
947+
"SPLUNK_STANDALONE_URL": splunk_container_name
948+
},
949+
host_config=self.client.create_host_config(port_bindings={8089: ("0.0.0.0",)})
950+
)
951+
cid = cid.get("Id")
952+
self.client.start(cid)
953+
# Poll for the container to be ready
954+
assert self.wait_for_containers(1, name=splunk_container_name)
955+
# Check splunkd
956+
splunkd_port = self.client.port(cid, 8089)[0]["HostPort"]
957+
url = "https://localhost:{}/services/server/info".format(splunkd_port)
958+
kwargs = {"auth": ("admin", self.password), "verify": False}
959+
status, content = self.handle_request_retry("GET", url, kwargs)
960+
assert status == 200
961+
# Check the decrypted pass4SymmKey
962+
exec_command = self.client.exec_create(cid, "ls /opt/splunk/etc/system/local/", user="splunk")
963+
std_out = self.client.exec_start(exec_command)
964+
assert "outputs.conf" not in std_out
965+
except Exception as e:
966+
self.logger.error(e)
967+
raise e
968+
finally:
969+
if cid:
970+
self.client.remove_container(cid, v=True, force=True)
971+
936972
def test_adhoc_1so_splunk_pass4symmkey(self):
937973
# Create a splunk container
938974
cid = None

0 commit comments

Comments
 (0)