mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-09 08:40:29 +00:00
test: speed up (#1386)
Reduce redundant fixture setup, Git subprocesses, and large data copies while preserving test coverage. Local macOS measurements against main: | Measurement | Before | After | | --- | ---: | ---: | | Git package time, median of 3 alternating runs | 4.09 s | 3.48 s (-15%) | | Allocations across 18 action-bundle cases | 489 MiB | 251 MiB (-49%) | | Traced Git starts per checkout table run | 234 | 175 | Reviewed-on: https://gitea.com/gitea/runner/pulls/1386 Reviewed-by: bircni <[email protected]>
This commit is contained in:
1 parent
664978c819
commit
30e600d8f6
28 files changed
+261
-291
No files matched your search
@@ -96,6 +96,7 @@ func TestSetupLinesInputs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPrettyOSName(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
osRelease string
|
||||
@@ -109,7 +110,7 @@ func TestPrettyOSName(t *testing.T) {
|
||||
{"missing file", "", "", true},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "os-release")
|
||||
path := filepath.Join(dir, tt.name)
|
||||
if !tt.missing {
|
||||
require.NoError(t, os.WriteFile(path, []byte(tt.osRelease), 0o600))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user