From 740e09b5d40b764ee0e3ec3978f05cfd903b0108 Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 14 Dec 2023 15:34:42 +0000 Subject: [PATCH] chore: collect hermes config.toml --- e2e/testsuite/diagnostics/diagnostics.go | 14 ++++++++++---- e2e/testsuite/testsuite.go | 11 ++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/e2e/testsuite/diagnostics/diagnostics.go b/e2e/testsuite/diagnostics/diagnostics.go index 7e1b406ec29..38ae500947e 100644 --- a/e2e/testsuite/diagnostics/diagnostics.go +++ b/e2e/testsuite/diagnostics/diagnostics.go @@ -52,7 +52,7 @@ func Collect(t *testing.T, dc *dockerclient.Client, debugModeEnabled bool, chain testContainers, err := dockerutil.GetTestContainers(ctx, t, dc) if err != nil { - t.Logf("failed listing containers test cleanup: %s", err) + t.Logf("failed listing containers during test cleanup: %s", err) return } @@ -72,7 +72,6 @@ func Collect(t *testing.T, dc *dockerclient.Client, debugModeEnabled bool, chain logFile := fmt.Sprintf("%s/%s.log", containerDir, containerName) if err := os.WriteFile(logFile, logsBz, defaultFilePerm); err != nil { - t.Logf("failed writing log file for container %s in test cleanup: %s", containerName, err) continue } @@ -82,11 +81,11 @@ func Collect(t *testing.T, dc *dockerclient.Client, debugModeEnabled bool, chain for _, chainName := range chainNames { diagnosticFiles = append(diagnosticFiles, chainDiagnosticAbsoluteFilePaths(chainName)...) } + diagnosticFiles = append(diagnosticFiles, relayerDiagnosticAbsoluteFilePaths()...) for _, absoluteFilePathInContainer := range diagnosticFiles { localFilePath := ospath.Join(containerDir, ospath.Base(absoluteFilePathInContainer)) if err := fetchAndWriteDiagnosticsFile(ctx, dc, container.ID, localFilePath, absoluteFilePathInContainer); err != nil { - t.Logf("failed to fetch and write file %s for container %s in test cleanup: %s", absoluteFilePathInContainer, containerName, err) continue } t.Logf("successfully wrote diagnostics file %s", absoluteFilePathInContainer) @@ -94,7 +93,6 @@ func Collect(t *testing.T, dc *dockerclient.Client, debugModeEnabled bool, chain localFilePath := ospath.Join(containerDir, dockerInspectFileName) if err := fetchAndWriteDockerInspectOutput(ctx, dc, container.ID, localFilePath); err != nil { - t.Logf("failed to fetch docker inspect output: %s", err) continue } t.Logf("successfully wrote docker inspect output") @@ -156,6 +154,14 @@ func chainDiagnosticAbsoluteFilePaths(chainName string) []string { } } +// relayerDiagnosticAbsoluteFilePaths returns a slice of absolute file paths (in the containers) which are the files that should be +// copied locally when fetching diagnostics. +func relayerDiagnosticAbsoluteFilePaths() []string { + return []string{ + "/home/hermes/.hermes/config.toml", + } +} + // getE2EDir finds the e2e directory above the test. func getE2EDir(t *testing.T) (string, error) { t.Helper() diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index d16becd10df..e65a1246d80 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -135,13 +135,6 @@ func (s *E2ETestSuite) ConfigureRelayer(ctx context.Context, chainA, chainB ibc. s.startRelayerFn = func(relayer ibc.Relayer) { err := relayer.StartRelayer(ctx, eRep, pathName) s.Require().NoError(err, fmt.Sprintf("failed to start relayer: %s", err)) - s.T().Cleanup(func() { - if !s.T().Failed() { - if err := relayer.StopRelayer(ctx, eRep); err != nil { - s.T().Logf("error stopping relayer: %v", err) - } - } - }) // wait for relayer to start. s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB), "failed to wait for blocks") } @@ -377,9 +370,9 @@ func (s *E2ETestSuite) createChains(chainOptions ChainOptions) (ibc.Chain, ibc.C // cleanup task which deletes all containers. By registering a cleanup function afterwards, it is executed first // this allows us to process the logs before the containers are removed. t.Cleanup(func() { - debugModeEnabled := LoadConfig().DebugConfig.DumpLogs + dumpLogs := LoadConfig().DebugConfig.DumpLogs chains := []string{chainOptions.ChainASpec.ChainConfig.Name, chainOptions.ChainBSpec.ChainConfig.Name} - diagnostics.Collect(t, s.DockerClient, debugModeEnabled, chains...) + diagnostics.Collect(t, s.DockerClient, dumpLogs, chains...) }) chains, err := cf.Chains(t.Name())