MCPcopy
hub / github.com/istio/istio / generateModulePath

Function generateModulePath

pkg/wasm/cache_test.go:948–959  ·  view source on GitHub ↗
(t *testing.T, baseDir, resourceName, filename string)

Source from the content-addressed store, hash-verified

946}
947
948func generateModulePath(t *testing.T, baseDir, resourceName, filename string) string {
949 t.Helper()
950 sha := sha256.Sum256([]byte(resourceName))
951 moduleDir := filepath.Join(baseDir, hex.EncodeToString(sha[:]))
952 if _, err := os.Stat(moduleDir); errors.Is(err, os.ErrNotExist) {
953 err := os.Mkdir(moduleDir, 0o755)
954 if err != nil {
955 t.Fatalf("failed to create module dir %s: %v", moduleDir, err)
956 }
957 }
958 return filepath.Join(moduleDir, filename)
959}

Callers 3

TestWasmCacheFunction · 0.85
TestAllInsecureServerFunction · 0.85

Calls 3

StatMethod · 0.80
HelperMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…