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

Function writeBundle

e2e/distribution_test.go:299–318  ·  view source on GitHub ↗
(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey)

Source from the content-addressed store, hash-verified

297}
298
299func writeBundle(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey) (string, int64) {
300 t.Helper()
301 cfgBytes, err := yaml.Marshal(cfg)
302 if err != nil {
303 t.Fatal(err)
304 }
305 bundleStr, err := state.BundleConfig(string(cfgBytes), key)
306 if err != nil {
307 t.Fatal(err)
308 }
309 unbundled, err := state.UnbundleConfig(bundleStr, key.Pubkey())
310 if err != nil {
311 t.Fatal(err)
312 }
313 path := filepath.Join(runDir, name)
314 if err := os.WriteFile(path, []byte(bundleStr), 0644); err != nil {
315 t.Fatal(err)
316 }
317 return path, unbundled.Timestamp
318}
319
320func writeRawBundle(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey) string {
321 t.Helper()

Calls 3

BundleConfigFunction · 0.92
UnbundleConfigFunction · 0.92
PubkeyMethod · 0.80

Tested by

no test coverage detected