MCPcopy
hub / github.com/keploy/keploy / TestReadFileAnyMissingBoth

Function TestReadFileAnyMissingBoth

pkg/platform/yaml/codec_test.go:576–593  ·  view source on GitHub ↗

TestReadFileAnyMissingBoth verifies ReadFileAny returns fs.ErrNotExist when neither format's file is present.

(t *testing.T)

Source from the content-addressed store, hash-verified

574// TestReadFileAnyMissingBoth verifies ReadFileAny returns fs.ErrNotExist
575// when neither format's file is present.
576func TestReadFileAnyMissingBoth(t *testing.T) {
577 ctx := context.Background()
578 logger := testLogger()
579
580 tempDir, err := os.MkdirTemp("", "readfile_any_missing_test")
581 if err != nil {
582 t.Fatal(err)
583 }
584 defer os.RemoveAll(tempDir)
585
586 _, _, err = ReadFileAny(ctx, logger, tempDir, "nope", FormatJSON)
587 if err == nil {
588 t.Fatal("expected error, got nil")
589 }
590 if !os.IsNotExist(err) {
591 t.Errorf("expected os.IsNotExist, got %v", err)
592 }
593}
594
595// TestFileExistsAnyDetection verifies FileExistsAny reports the correct
596// detected format regardless of what the caller prefers.

Callers

nothing calls this directly

Calls 2

ReadFileAnyFunction · 0.85
testLoggerFunction · 0.70

Tested by

no test coverage detected