(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func TestBundleUnbundle(t *testing.T) { |
| 18 | root := GenerateKey() |
| 19 | cfg := CentralCfg{ |
| 20 | Dist: nil, |
| 21 | Routers: make([]RouterCfg, 0), |
| 22 | Clients: []ClientCfg{ |
| 23 | {NodeCfg{ |
| 24 | Id: "blah", |
| 25 | PubKey: NyPublicKey{}, |
| 26 | Prefixes: []PrefixHealthWrapper{ |
| 27 | { |
| 28 | &StaticPrefixHealth{ |
| 29 | Prefix: netip.MustParsePrefix("10.0.0.1/32"), |
| 30 | Metric: 0, |
| 31 | }, |
| 32 | }, |
| 33 | }, |
| 34 | }}, |
| 35 | }, |
| 36 | Graph: []string{ |
| 37 | "blah, blah", |
| 38 | "a = blah", |
| 39 | "b = a", |
| 40 | "a, b", |
| 41 | }, |
| 42 | Timestamp: 0, |
| 43 | } |
| 44 | txt, err := yaml.Marshal(cfg) |
| 45 | assert.NoError(t, err) |
| 46 | bundle, err := BundleConfig(string(txt), root) |
| 47 | assert.NoError(t, err) |
| 48 | |
| 49 | finalCfg, err := UnbundleConfig(bundle, root.Pubkey()) |
| 50 | assert.NoError(t, err) |
| 51 | finalCfg.Timestamp = 0 // cannot enforce timestamp to be the same |
| 52 | assert.EqualValues(t, cfg, *finalCfg) |
| 53 | } |
| 54 | |
| 55 | func TestBundleTamper(t *testing.T) { |
| 56 | root := GenerateKey() |
nothing calls this directly
no test coverage detected