MCPcopy Create free account
hub / github.com/celer-pkg/celer / setupArchiveFile

Function setupArchiveFile

configs/pkgcache_repo_test.go:97–120  ·  view source on GitHub ↗
(t *testing.T, tmpWorkspace string)

Source from the content-addressed store, hash-verified

95}
96
97func setupArchiveFile(t *testing.T, tmpWorkspace string) (archivePath string, archiveSha string) {
98 t.Helper()
99
100 // Create a tiny source tree and compress it into a local archive so the
101 // archive-cache test stays deterministic and does not depend on downloads.
102 srcRoot := filepath.Join(tmpWorkspace, "archive-src")
103 if err := os.MkdirAll(srcRoot, os.ModePerm); err != nil {
104 t.Fatal(err)
105 }
106 if err := os.WriteFile(filepath.Join(srcRoot, "hello.txt"), []byte("hello-from-archive"), os.ModePerm); err != nil {
107 t.Fatal(err)
108 }
109
110 archivePath = filepath.Join(tmpWorkspace, "x264-archive.tar.gz")
111 if err := fileio.Targz(archivePath, srcRoot, false); err != nil {
112 t.Fatal(err)
113 }
114
115 checksum, err := fileio.ComputeSHA256(archivePath)
116 if err != nil {
117 t.Fatal(err)
118 }
119 return archivePath, checksum
120}
121
122func TestBuildConfigClone_GitRepoCache(t *testing.T) {
123 // Goal:

Callers 1

Calls 4

TargzFunction · 0.92
ComputeSHA256Function · 0.92
MkdirAllMethod · 0.80
WriteFileMethod · 0.80

Tested by

no test coverage detected