Skip to content

Commit 98cd6a5

Browse files
author
tonyl
committed
merge
2 parents 3341b31 + 3afe177 commit 98cd6a5

File tree

3 files changed

+89
-17
lines changed

3 files changed

+89
-17
lines changed

.circleci/config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
destination: test-results
7070
- store_test_results:
7171
path: test-results
72-
redhat8-testing:
72+
redhat8-testing:
7373
machine:
7474
image: circleci/classic:latest
7575
steps:
@@ -137,7 +137,6 @@ redhat8-testing:
137137
- store_artifacts:
138138
path: test-results
139139
destination: test-results
140-
141140
workflows:
142141
version: 2
143142
build:

base/redhat-8/install.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
set -e
1717

1818
# reinstalling local en def for now, removed in minimal image https://bugzilla.redhat.com/show_bug.cgi?id=1665251
19+
microdnf -y update
1920
microdnf -y --nodocs install glibc-langpack-en
2021

2122
#Currently there is no access to the UTF-8 char map, the following command is commented out until
@@ -27,24 +28,26 @@ export LANG=en_US.utf8
2728

2829
microdnf -y --nodocs install wget sudo shadow-utils procps
2930
#install busybox direct from the multiarch since epel isn't availible yet for redhat8
30-
wget https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-x86_64
31-
mv busybox-x86_64 /bin/busybox
31+
wget -O /bin/busybox https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-`arch`
3232
chmod +x /bin/busybox
33-
microdnf -y --nodocs install python2 tar
34-
pip2 -q --no-cache-dir install requests ansible
33+
microdnf -y --nodocs install gcc redhat-rpm-config python2-devel libffi-devel openssl-devel tar
34+
pip2 --no-cache-dir install requests ansible
35+
microdnf -y remove gcc libffi-devel openssl-devel
36+
microdnf clean all
3537

3638
cd /bin
37-
ln -s busybox diff
38-
ln -s busybox hostname
39-
ln -s busybox killall
40-
ln -s busybox netstat
41-
ln -s busybox nslookup
42-
ln -s busybox ping
43-
ln -s busybox ping6
44-
ln -s busybox readline
45-
ln -s busybox route
46-
ln -s busybox syslogd
47-
ln -s busybox traceroute
39+
ln -s python2 python || true
40+
ln -s busybox diff || true
41+
ln -s busybox hostname || true
42+
ln -s busybox killall || true
43+
ln -s busybox netstat || true
44+
ln -s busybox nslookup || true
45+
ln -s busybox ping || true
46+
ln -s busybox ping6 || true
47+
ln -s busybox readline || true
48+
ln -s busybox route || true
49+
ln -s busybox syslogd || true
50+
ln -s busybox traceroute || true
4851
chmod u+s /bin/ping
4952
groupadd sudo
5053

tests/test_docker_splunk.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,76 @@ def test_adhoc_1uf_change_tailed_files(self):
759759
if cid:
760760
self.client.remove_container(cid, v=True, force=True)
761761

762+
def test_adhoc_1so_splunk_secret_env(self):
763+
# Create a splunk container
764+
cid = None
765+
try:
766+
splunk_container_name = generate_random_string()
767+
cid = self.client.create_container(self.SPLUNK_IMAGE_NAME, tty=True, ports=[8089], name=splunk_container_name,
768+
environment={
769+
"DEBUG": "true",
770+
"SPLUNK_START_ARGS": "--accept-license",
771+
"SPLUNK_PASSWORD": self.password,
772+
"SPLUNK_SECRET": "wubbalubbadubdub"
773+
},
774+
host_config=self.client.create_host_config(port_bindings={8089: ("0.0.0.0",)})
775+
)
776+
cid = cid.get("Id")
777+
self.client.start(cid)
778+
# Poll for the container to be ready
779+
assert self.wait_for_containers(1, name=splunk_container_name)
780+
# Check splunkd
781+
splunkd_port = self.client.port(cid, 8089)[0]["HostPort"]
782+
url = "https://localhost:{}/services/server/info".format(splunkd_port)
783+
kwargs = {"auth": ("admin", self.password), "verify": False}
784+
status, content = self.handle_request_retry("GET", url, kwargs)
785+
assert status == 200
786+
# Check if the created file exists
787+
exec_command = self.client.exec_create(cid, "cat /opt/splunk/etc/auth/splunk.secret", user="splunk")
788+
std_out = self.client.exec_start(exec_command)
789+
assert "wubbalubbadubdub" in std_out
790+
except Exception as e:
791+
self.logger.error(e)
792+
raise e
793+
finally:
794+
if cid:
795+
self.client.remove_container(cid, v=True, force=True)
796+
797+
def test_adhoc_1uf_splunk_secret_env(self):
798+
# Create a uf container
799+
cid = None
800+
try:
801+
splunk_container_name = generate_random_string()
802+
cid = self.client.create_container(self.UF_IMAGE_NAME, tty=True, ports=[8089], name=splunk_container_name,
803+
environment={
804+
"DEBUG": "true",
805+
"SPLUNK_START_ARGS": "--accept-license",
806+
"SPLUNK_PASSWORD": self.password,
807+
"SPLUNK_SECRET": "wubbalubbadubdub"
808+
},
809+
host_config=self.client.create_host_config(port_bindings={8089: ("0.0.0.0",)})
810+
)
811+
cid = cid.get("Id")
812+
self.client.start(cid)
813+
# Poll for the container to be ready
814+
assert self.wait_for_containers(1, name=splunk_container_name)
815+
# Check splunkd
816+
splunkd_port = self.client.port(cid, 8089)[0]["HostPort"]
817+
url = "https://localhost:{}/services/server/info".format(splunkd_port)
818+
kwargs = {"auth": ("admin", self.password), "verify": False}
819+
status, content = self.handle_request_retry("GET", url, kwargs)
820+
assert status == 200
821+
# Check if the created file exists
822+
exec_command = self.client.exec_create(cid, "cat /opt/splunkforwarder/etc/auth/splunk.secret", user="splunk")
823+
std_out = self.client.exec_start(exec_command)
824+
assert "wubbalubbadubdub" in std_out
825+
except Exception as e:
826+
self.logger.error(e)
827+
raise e
828+
finally:
829+
if cid:
830+
self.client.remove_container(cid, v=True, force=True)
831+
762832
def test_adhoc_1so_preplaybook_with_sudo(self):
763833
# Create a splunk container
764834
cid = None

0 commit comments

Comments
 (0)