MCPcopy
hub / github.com/nats-io/nats.go / createTmpFile

Function createTmpFile

nats_test.go:1403–1416  ·  view source on GitHub ↗
(t *testing.T, content []byte)

Source from the content-addressed store, hash-verified

1401}
1402
1403func createTmpFile(t *testing.T, content []byte) string {
1404 t.Helper()
1405 conf, err := os.CreateTemp("", "")
1406 if err != nil {
1407 t.Fatalf("Error creating conf file: %v", err)
1408 }
1409 fName := conf.Name()
1410 conf.Close()
1411 if err := os.WriteFile(fName, content, 0666); err != nil {
1412 os.Remove(fName)
1413 t.Fatalf("Error writing conf file: %v", err)
1414 }
1415 return fName
1416}
1417
1418func TestNKeyOptionFromSeed(t *testing.T) {
1419 if _, err := NkeyOptionFromSeed("file_that_does_not_exist"); err == nil {

Callers 1

TestNKeyOptionFromSeedFunction · 0.70

Calls 3

FatalfMethod · 0.80
NameMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected