From 05e0ffdebcfc1bd50aa90cc0194bcf881b30d386 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 6 Aug 2019 13:42:25 -0700 Subject: [PATCH] Collect gitea sshd logs Currently we don't have any logs from our gitea sshd processes because sshd logs to syslog by default and /dev/log isn't in our containers. You can ask sshd nicely to log to stderr instead with the -e flag which docker will pick up and store for us. Update the sshd command to include -e then use testinfra to check we collect logs and they are accssible from docker. Change-Id: Ib7d6d405554c3c30be410bc08c6fee7d4363b096 --- docker/gitea/Dockerfile | 2 +- testinfra/test_gitea.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/gitea/Dockerfile b/docker/gitea/Dockerfile index 069dda8b64..90e85dbda1 100644 --- a/docker/gitea/Dockerfile +++ b/docker/gitea/Dockerfile @@ -113,4 +113,4 @@ COPY sshd-entrypoint.sh /usr/bin/entrypoint EXPOSE 22 VOLUME ["/data"] ENTRYPOINT ["/usr/bin/entrypoint"] -CMD ["/usr/sbin/sshd", "-D"] +CMD ["/usr/sbin/sshd", "-D", "-e"] diff --git a/testinfra/test_gitea.py b/testinfra/test_gitea.py index d50160681a..c9c3e2a884 100644 --- a/testinfra/test_gitea.py +++ b/testinfra/test_gitea.py @@ -29,3 +29,7 @@ def test_ulimit(host): expected = ("STACK max stack size " "16777216 9223372036854775807 bytes") assert expected in cmd.stdout.split('\n') + +def test_sshd_logs(host): + cmd = host.run("docker logs giteadocker_gitea-ssh_1") + assert cmd.stdout != '' or cmd.stderr != ''