From 0f27403e36ec0d5e1ef97b4f35f397d60cde23e9 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 11 Aug 2025 18:54:09 +0000 Subject: [PATCH] chore(tests): differentiate 'failed to copy content' errors (#846) ``` 2025-08-11T13:02:51.0737198Z --- FAIL: TestRunner_RunEvent (431.14s) 2025-08-11T13:02:51.0737236Z --- FAIL: TestRunner_RunEvent/evalmatrix (2.69s) 2025-08-11T13:02:51.0737270Z runner_test.go:211: 2025-08-11T13:02:51.0737303Z Error Trace: /home/debian/.cache/act/1682da88a8a84081/hostexecutor/act/runner/runner_test.go:211 2025-08-11T13:02:51.0737398Z /home/debian/.cache/act/1682da88a8a84081/hostexecutor/act/runner/runner_test.go:362 2025-08-11T13:02:51.0737436Z Error: Received unexpected error: 2025-08-11T13:02:51.0737470Z failed to copy content to container: Error response from daemon: Could not find the file /var/run/act/ in container ab61dffc6010bc922c0ab2d2c7edb7a7fe066258ce0145d4146771ce6afbc8f9 2025-08-11T13:02:51.0737507Z Test: TestRunner_RunEvent/evalmatrix 2025-08-11T13:02:51.0737551Z Messages: /home/debian/.cache/act/1682da88a8a84081/hostexecutor/act/runner/testdata/evalmatrix ``` ``` 2025-08-11T13:12:06.9179188Z --- FAIL: TestRunner_RunEvent (343.90s) 2025-08-11T13:12:06.9179215Z --- FAIL: TestRunner_RunEvent/strategy (7.71s) 2025-08-11T13:12:06.9179241Z runner_test.go:211: 2025-08-11T13:12:06.9179269Z Error Trace: /home/debian/.cache/act/5a78e5e8c5cb3275/hostexecutor/act/runner/runner_test.go:211 2025-08-11T13:12:06.9179296Z /home/debian/.cache/act/5a78e5e8c5cb3275/hostexecutor/act/runner/runner_test.go:362 2025-08-11T13:12:06.9179325Z Error: Received unexpected error: 2025-08-11T13:12:06.9179352Z failed to copy content to container: Error response from daemon: Could not find the file /var/run/act/ in container 0bee24fbd0b16843147b45915d25aa7bb32c09d68bfdff81cc73bf7278d1c72d 2025-08-11T13:12:06.9179381Z Test: TestRunner_RunEvent/strategy 2025-08-11T13:12:06.9179407Z Messages: /home/debian/.cache/act/5a78e5e8c5cb3275/hostexecutor/act/model/testdata/strategy ``` ``` 2025-08-11T13:34:24.7442134Z --- FAIL: TestRunner_RunEvent (369.80s) 2025-08-11T13:34:24.7442158Z --- FAIL: TestRunner_RunEvent/no-panic-on-invalid-composite-action (3.04s) 2025-08-11T13:34:24.7442185Z runner_test.go:214: 2025-08-11T13:34:24.7442209Z Error Trace: /home/debian/.cache/act/690f62172f9b2595/hostexecutor/act/runner/runner_test.go:214 2025-08-11T13:34:24.7442235Z /home/debian/.cache/act/690f62172f9b2595/hostexecutor/act/runner/runner_test.go:362 2025-08-11T13:34:24.7442262Z Error: Error "failed to copy content to container: Error response from daemon: Could not find the file /var/run/act/ in container 6441c18fec5b0e3a172672a243e599b628f7729ecaeb543fa3bd2cd02af146e1" does not contain "missing steps in composite action" 2025-08-11T13:34:24.7442295Z Test: TestRunner_RunEvent/no-panic-on-invalid-composite-action ``` In the absence of a stack trace, having three different places in the sources where the same error message shows does not help to figure out how it can happen. This is a daily false negative. - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/846): chore(tests): differentiate 'failed to copy content' errors Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/846 Reviewed-by: Mathieu Fenniak Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- act/container/docker_run.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/act/container/docker_run.go b/act/container/docker_run.go index ac52cee5..b64703c0 100644 --- a/act/container/docker_run.go +++ b/act/container/docker_run.go @@ -835,7 +835,7 @@ func (cr *containerReference) CopyTarStream(ctx context.Context, destPath string // Copy Content err = cr.cli.CopyToContainer(ctx, cr.id, destPath, tarStream, container.CopyToContainerOptions{}) if err != nil { - return fmt.Errorf("failed to copy content to container: %w", err) + return fmt.Errorf("copyTarStream: failed to copy content to container: %w", err) } // If this fails, then folders have wrong permissions on non root container if cr.UID != 0 || cr.GID != 0 { @@ -911,7 +911,7 @@ func (cr *containerReference) copyDir(dstPath, srcPath string, useGitIgnore bool } err = cr.cli.CopyToContainer(ctx, cr.id, "/", tarFile, container.CopyToContainerOptions{}) if err != nil { - return fmt.Errorf("failed to copy content to container: %w", err) + return fmt.Errorf("copyDir: failed to copy content to container: %w", err) } return nil } @@ -945,7 +945,7 @@ func (cr *containerReference) copyContent(dstPath string, files ...*FileEntry) c logger.Debugf("Extracting content to '%s'", dstPath) err := cr.cli.CopyToContainer(ctx, cr.id, dstPath, &buf, container.CopyToContainerOptions{}) if err != nil { - return fmt.Errorf("failed to copy content to container: %w", err) + return fmt.Errorf("copyContent: failed to copy content to container: %w", err) } return nil }