Skip to content

Commit 6c418b3

Browse files
authored
Merge branch 'master' into develop
2 parents 472e12e + 5362d7c commit 6c418b3

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

docs/TROUBLESHOOTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [Container Debugging](#container-debugging)
77
* [Getting logs](#getting-logs)
88
* [Interactive shell](#interactive-shell)
9+
* [Installing packages](#installing-packages)
910
* [Debug variables](#debug-variables)
1011
* [No-provision](#no-provision)
1112
* [Generate Splunk diag](#generate-splunk-diag)
@@ -56,7 +57,7 @@ To gain interactive shell access to the container's runtime as the splunk user,
5657
$ docker exec -it -u splunk <container_name/container_id> /bin/bash
5758
```
5859

59-
#### Installing Packages
60+
#### Installing packages
6061
Once inside the container, you can install additional packages with the default package manager:
6162
```
6263
$ microdnf install <package_name>

tests/test_docker_splunk.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,28 @@ def test_splunk_uid_gid(self):
423423
if cid:
424424
self.client.remove_container(cid, v=True, force=True)
425425

426+
def test_splunk_uid_gid(self):
427+
cid = None
428+
try:
429+
# Run container
430+
cid = self.client.create_container(self.SPLUNK_IMAGE_NAME, tty=True, command="no-provision")
431+
cid = cid.get("Id")
432+
self.client.start(cid)
433+
# Wait a bit
434+
time.sleep(5)
435+
# If the container is still running, we should be able to exec inside
436+
# Check that the git SHA exists in /opt/ansible
437+
exec_command = self.client.exec_create(cid, "id", user="splunk")
438+
std_out = self.client.exec_start(exec_command)
439+
assert "uid=41812" in std_out
440+
assert "gid=41812" in std_out
441+
except Exception as e:
442+
self.logger.error(e)
443+
raise e
444+
finally:
445+
if cid:
446+
self.client.remove_container(cid, v=True, force=True)
447+
426448
def test_uf_entrypoint_help(self):
427449
# Run container
428450
cid = self.client.create_container(self.UF_IMAGE_NAME, tty=True, command="help")
@@ -506,6 +528,28 @@ def test_uf_uid_gid(self):
506528
if cid:
507529
self.client.remove_container(cid, v=True, force=True)
508530

531+
def test_uf_uid_gid(self):
532+
cid = None
533+
try:
534+
# Run container
535+
cid = self.client.create_container(self.UF_IMAGE_NAME, tty=True, command="no-provision")
536+
cid = cid.get("Id")
537+
self.client.start(cid)
538+
# Wait a bit
539+
time.sleep(5)
540+
# If the container is still running, we should be able to exec inside
541+
# Check that the git SHA exists in /opt/ansible
542+
exec_command = self.client.exec_create(cid, "id", user="splunk")
543+
std_out = self.client.exec_start(exec_command)
544+
assert "uid=41812" in std_out
545+
assert "gid=41812" in std_out
546+
except Exception as e:
547+
self.logger.error(e)
548+
raise e
549+
finally:
550+
if cid:
551+
self.client.remove_container(cid, v=True, force=True)
552+
509553
def test_adhoc_1so_using_default_yml(self):
510554
# Generate default.yml
511555
cid = self.client.create_container(self.SPLUNK_IMAGE_NAME, tty=True, command="create-defaults")

0 commit comments

Comments
 (0)