diff --git a/test/deploy/dex/proxy.yaml b/test/deploy/dex/proxy.yaml index 1d7d8a66..be4d4878 100644 --- a/test/deploy/dex/proxy.yaml +++ b/test/deploy/dex/proxy.yaml @@ -20,6 +20,9 @@ spec: labels: app: proxy spec: + volumes: + - name: log-dir + emptyDir: {} containers: - name: proxy image: docker.io/getpinniped/test-forward-proxy @@ -34,6 +37,9 @@ spec: limits: cpu: "10m" memory: "64Mi" + volumeMounts: + - name: log-dir + mountPath: "/var/log/squid/" readinessProbe: tcpSocket: port: http @@ -41,6 +47,16 @@ spec: timeoutSeconds: 5 periodSeconds: 5 failureThreshold: 2 + - name: accesslogs + image: debian:10.6-slim + command: + - "/bin/sh" + - "-c" + args: + - tail -F /var/log/squid/access.log + volumeMounts: + - name: log-dir + mountPath: "/var/log/squid/" --- apiVersion: v1 kind: Service diff --git a/test/integration/supervisor_login_test.go b/test/integration/supervisor_login_test.go index 3b5e50a9..f666ef1a 100644 --- a/test/integration/supervisor_login_test.go +++ b/test/integration/supervisor_login_test.go @@ -35,7 +35,8 @@ func TestSupervisorLogin(t *testing.T) { env := library.IntegrationEnv(t) // If anything in this test crashes, dump out the supervisor pod logs. - defer library.DumpLogs(t, env.SupervisorNamespace) + defer library.DumpLogs(t, env.SupervisorNamespace, "") + defer library.DumpLogs(t, "dex", "app=proxy") ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/library/dumplogs.go b/test/library/dumplogs.go index 33f33694..dc727e03 100644 --- a/test/library/dumplogs.go +++ b/test/library/dumplogs.go @@ -15,7 +15,7 @@ import ( ) // DumpLogs is meant to be called in a `defer` to dump the logs of components in the cluster on a test failure. -func DumpLogs(t *testing.T, namespace string) { +func DumpLogs(t *testing.T, namespace string, labelSelector string) { // Only trigger on failed tests. if !t.Failed() { return @@ -26,7 +26,7 @@ func DumpLogs(t *testing.T, namespace string) { defer cancel() logTailLines := int64(40) - pods, err := kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{}) + pods, err := kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) require.NoError(t, err) for _, pod := range pods.Items {