From 94cee067df980b567a3e9b5e9b4fa274c99dc17c Mon Sep 17 00:00:00 2001 From: Tim Geoghegan Date: Tue, 6 Sep 2022 16:52:02 -0700 Subject: [PATCH] Upload logs on integration test failures Logs emitted by integration tests should get attached to actions runs for analysis now. --- .github/workflows/ci-build.yml | 17 +++++++++++++++++ integration_tests/src/daphne.rs | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 77bba7364..fc65e584b 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -53,7 +53,24 @@ jobs: - name: Build run: cargo test --no-run --locked - name: Test + id: test + env: + JANUS_E2E_LOGS_PATH: ${{ github.workspace }}/test-logs run: cargo test + # Continue on error so we can upload logs + continue-on-error: true + - name: Upload container logs + # Only get logs on test failure + if: steps.test.outcome == 'failure' + uses: actions/upload-artifact@v3 + with: + name: container-logs + path: ${{ github.workspace }}/test-logs/ + if-no-files-found: error + # Force overall job to fail if tests fail + - name: test status + if: steps.test.outcome == 'failure' + run: exit 1 janus_lints: runs-on: ubuntu-latest diff --git a/integration_tests/src/daphne.rs b/integration_tests/src/daphne.rs index 11322cd13..ae4c8460d 100644 --- a/integration_tests/src/daphne.rs +++ b/integration_tests/src/daphne.rs @@ -21,6 +21,7 @@ use testcontainers::{ clients::Cli, core::Port, images::generic::GenericImage, Container, RunnableImage, }; use tokio::{select, sync::oneshot, task, time::interval}; +use tracing::debug; use crate::logs::CopyLogs; @@ -310,7 +311,7 @@ impl<'a> CopyLogs for Daphne<'a> { "--timestamps", self.daphne_container.id(), ]; - tracing::debug!(?args, "invoking docker"); + debug!(?args, "invoking docker"); let child_status = Command::new("docker") .args(args) .stdin(Stdio::null())