MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / TestFileExist

Function TestFileExist

tests/utils/utils.go:257–267  ·  view source on GitHub ↗

TestFileExist tests if a file specified with `fileName` exist under directory `directoryPath`, on pod `podName` in namespace `namespace`

(namespace, podName, directoryPath, fileName string)

Source from the content-addressed store, hash-verified

255// TestFileExist tests if a file specified with `fileName` exist under directory `directoryPath`, on pod `podName` in
256// namespace `namespace`
257func TestFileExist(namespace, podName, directoryPath, fileName string) bool {
258 filePath := directoryPath + "/" + fileName
259 testFileExistCommand := "test -f " + filePath
260 _, _, err := run.Unchecked(fmt.Sprintf(
261 "kubectl exec -n %v %v -- %v",
262 namespace,
263 podName,
264 testFileExistCommand))
265
266 return err == nil
267}
268
269// TestDirectoryEmpty tests if a directory `directoryPath` exists on pod `podName` in namespace `namespace`
270func TestDirectoryEmpty(namespace, podName, directoryPath string) bool {

Callers

nothing calls this directly

Calls 1

UncheckedFunction · 0.92

Tested by

no test coverage detected