Skip to content

Commit 4f481c1

Browse files
authored
Merge pull request #311 from splunk/test/splunk-launch-test
Adding test for SPLUNK_LAUNCH_CONF env var
2 parents 67456bc + 3af5765 commit 4f481c1

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

base/redhat-8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# the container catalog moved from registry.access.redhat.com to registry.redhat.io
1717
# So at some point before they deprecate the old registry we have to make sure that
1818
# we have access to the new registry and change where we pull the ubi image from.
19-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
19+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1-328
2020
LABEL name="splunk" \
2121
maintainer="support@splunk.com" \
2222
vendor="splunk" \

tests/test_docker_splunk.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,42 @@ def test_adhoc_1so_preplaybook(self):
703703
except OSError:
704704
pass
705705

706+
def test_adhoc_1so_splunk_launch_conf(self):
707+
# Create a splunk container
708+
cid = None
709+
try:
710+
splunk_container_name = generate_random_string()
711+
cid = self.client.create_container(self.SPLUNK_IMAGE_NAME, tty=True, ports=[8089], name=splunk_container_name,
712+
environment={
713+
"DEBUG": "true",
714+
"SPLUNK_START_ARGS": "--accept-license",
715+
"SPLUNK_PASSWORD": self.password,
716+
"SPLUNK_LAUNCH_CONF": "OPTIMISTIC_ABOUT_FILE_LOCKING=1,HELLO=WORLD"
717+
},
718+
host_config=self.client.create_host_config(port_bindings={8089: ("0.0.0.0",)})
719+
)
720+
cid = cid.get("Id")
721+
self.client.start(cid)
722+
# Poll for the container to be ready
723+
assert self.wait_for_containers(1, name=splunk_container_name)
724+
# Check splunkd
725+
splunkd_port = self.client.port(cid, 8089)[0]["HostPort"]
726+
url = "https://localhost:{}/services/server/info".format(splunkd_port)
727+
kwargs = {"auth": ("admin", self.password), "verify": False}
728+
status, content = self.handle_request_retry("GET", url, kwargs)
729+
assert status == 200
730+
# Check splunk-launch.conf
731+
exec_command = self.client.exec_create(cid, r'cat /opt/splunk/etc/splunk-launch.conf', user="splunk")
732+
std_out = self.client.exec_start(exec_command)
733+
assert "OPTIMISTIC_ABOUT_FILE_LOCKING=1" in std_out
734+
assert "HELLO=WORLD" in std_out
735+
except Exception as e:
736+
self.logger.error(e)
737+
raise e
738+
finally:
739+
if cid:
740+
self.client.remove_container(cid, v=True, force=True)
741+
706742
def test_adhoc_1so_change_tailed_files(self):
707743
# Create a splunk container
708744
cid = None

0 commit comments

Comments
 (0)