MCPcopy
hub / github.com/grafana/tempo / writeEntry

Function writeEntry

tools/chloggen/internal/chlog/entry_test.go:574–590  ·  view source on GitHub ↗
(t *testing.T, dir string, entry *Entry, ext string)

Source from the content-addressed store, hash-verified

572}
573
574func writeEntry(t *testing.T, dir string, entry *Entry, ext string) {
575 require.Contains(t, []string{"yaml", "yml"}, ext, "ext must be 'yaml' or 'yml'")
576
577 entryBytes, err := yaml.Marshal(entry)
578 require.NoError(t, err)
579
580 entryFile, err := os.CreateTemp(dir, "*."+ext)
581 require.NoError(t, err)
582 defer entryFile.Close()
583
584 _, err = entryFile.Write(entryBytes)
585 require.NoError(t, err)
586
587 // Record the source path so it matches what ReadEntries sets on the entries
588 // it returns (used by struct-equality assertions and BackfillIssues).
589 entry.path = entryFile.Name()
590}

Calls 4

MarshalMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected