1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-05 18:40:59 +00:00

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.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/846): <!--number 846 --><!--line 0 --><!--description Y2hvcmUodGVzdHMpOiBkaWZmZXJlbnRpYXRlICdmYWlsZWQgdG8gY29weSBjb250ZW50JyBlcnJvcnM=-->chore(tests): differentiate 'failed to copy content' errors<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/846
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-08-11 18:54:09 +00:00 committed by earl-warren
parent e760d04aa6
commit 0f27403e36
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201

View file

@ -835,7 +835,7 @@ func (cr *containerReference) CopyTarStream(ctx context.Context, destPath string
// Copy Content // Copy Content
err = cr.cli.CopyToContainer(ctx, cr.id, destPath, tarStream, container.CopyToContainerOptions{}) err = cr.cli.CopyToContainer(ctx, cr.id, destPath, tarStream, container.CopyToContainerOptions{})
if err != nil { 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 this fails, then folders have wrong permissions on non root container
if cr.UID != 0 || cr.GID != 0 { 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{}) err = cr.cli.CopyToContainer(ctx, cr.id, "/", tarFile, container.CopyToContainerOptions{})
if err != nil { 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 return nil
} }
@ -945,7 +945,7 @@ func (cr *containerReference) copyContent(dstPath string, files ...*FileEntry) c
logger.Debugf("Extracting content to '%s'", dstPath) logger.Debugf("Extracting content to '%s'", dstPath)
err := cr.cli.CopyToContainer(ctx, cr.id, dstPath, &buf, container.CopyToContainerOptions{}) err := cr.cli.CopyToContainer(ctx, cr.id, dstPath, &buf, container.CopyToContainerOptions{})
if err != nil { 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 return nil
} }