MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestLoadNodeKey

Function TestLoadNodeKey

p2p/key_test.go:28–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestLoadNodeKey(t *testing.T) {
29 filePath := filepath.Join(os.TempDir(), tmrand.Str(12)+"_peer_id.json")
30
31 _, err := LoadNodeKey(filePath)
32 assert.True(t, os.IsNotExist(err))
33
34 _, err = LoadOrGenNodeKey(filePath)
35 require.NoError(t, err)
36
37 nodeKey, err := LoadNodeKey(filePath)
38 assert.NoError(t, err)
39 assert.NotNil(t, nodeKey)
40}
41
42func TestNodeKeySaveAs(t *testing.T) {
43 filePath := filepath.Join(os.TempDir(), tmrand.Str(12)+"_peer_id.json")

Callers

nothing calls this directly

Calls 3

LoadNodeKeyFunction · 0.85
LoadOrGenNodeKeyFunction · 0.85
StrMethod · 0.80

Tested by

no test coverage detected