MCPcopy Create free account
hub / github.com/encodeous/nylon / TestSerialize

Function TestSerialize

state/serialize_test.go:10–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestSerialize(t *testing.T) {
11 cfg, ks := SampleNetwork(t, 50, 50, true)
12 cs := SampleConfigState(&cfg, ks, "router-1")
13
14 // test node local config
15 x1, err := yaml.Marshal(cs.LocalCfg)
16 assert.NoError(t, err)
17 y1 := LocalCfg{}
18 err = yaml.Unmarshal(x1, &y1)
19 assert.NoError(t, err)
20 assert.EqualValues(t, cs.LocalCfg, y1)
21
22 // test central config
23 x2, err := yaml.Marshal(cs.CentralCfg)
24 assert.NoError(t, err)
25 y2 := CentralCfg{}
26 err = yaml.Unmarshal(x2, &y2)
27 assert.NoError(t, err)
28 assert.EqualValues(t, cs.CentralCfg, y2)
29}
30
31func TestDeserializeInvalid(t *testing.T) {
32 // test node local config

Callers

nothing calls this directly

Calls 2

SampleNetworkFunction · 0.85
SampleConfigStateFunction · 0.85

Tested by

no test coverage detected