(t *testing.T)
| 227 | } |
| 228 | |
| 229 | func startDistributedSingleNode(t *testing.T) (*Harness, testcontainers.Container, string, state.NyPrivateKey, state.NyPublicKey, state.NodeId, int64) { |
| 230 | t.Helper() |
| 231 | h := NewHarness(t) |
| 232 | ctx := context.Background() |
| 233 | privKey := state.GenerateKey() |
| 234 | pubKey := privKey.Pubkey() |
| 235 | runDir := h.SetupTestDir() |
| 236 | |
| 237 | nodeKey := state.GenerateKey() |
| 238 | nodeId := state.NodeId("node-1") |
| 239 | cfg := state.CentralCfg{ |
| 240 | Timestamp: 1, |
| 241 | Dist: &state.DistributionCfg{ |
| 242 | Key: pubKey, |
| 243 | Repos: []string{"http://repo:80/bundle"}, |
| 244 | }, |
| 245 | Routers: []state.RouterCfg{ |
| 246 | SimpleRouter(string(nodeId), nodeKey.Pubkey(), "10.0.0.1", ""), |
| 247 | }, |
| 248 | } |
| 249 | bundlePath, timestamp := writeBundle(t, runDir, "bundle-initial", cfg, privKey) |
| 250 | |
| 251 | repoContainer := startBundleRepo(t, h, ctx, bundlePath) |
| 252 | centralConfigPath := h.WriteConfig(runDir, "central.yaml", withTimestamp(cfg, timestamp)) |
| 253 | nodeCfg := SimpleLocal(string(nodeId), nodeKey) |
| 254 | nodeCfg.Dist = &state.LocalDistributionCfg{ |
| 255 | Key: pubKey, |
| 256 | Url: "http://repo:80/bundle", |
| 257 | } |
| 258 | nodeConfigPath := h.WriteConfig(runDir, "node.yaml", nodeCfg) |
| 259 | |
| 260 | h.StartNodes(NodeSpec{ |
| 261 | Name: string(nodeId), |
| 262 | IP: GetIP(h.Subnet, 10), |
| 263 | CentralConfigPath: centralConfigPath, |
| 264 | NodeConfigPath: nodeConfigPath, |
| 265 | }) |
| 266 | h.WaitForLog(string(nodeId), "Nylon has been initialized") |
| 267 | |
| 268 | return h, repoContainer, runDir, privKey, pubKey, nodeId, timestamp |
| 269 | } |
| 270 | |
| 271 | func startBundleRepo(t *testing.T, h *Harness, ctx context.Context, bundlePath string) testcontainers.Container { |
| 272 | t.Helper() |
no test coverage detected