swarm/api: make api.NewManifest synchronous (#14880)

Previously, NewManifest was asynchronous so subsequent code which tried
to use the returned manifest could error as the manifest was not yet
persisted.
pull/3102/merge
Lewis Marshall 7 years ago committed by Felix Lange
parent e9b850805e
commit 60c858a529
  1. 1
      cmd/swarm/run_test.go
  2. 2
      cmd/swarm/upload_test.go
  3. 2
      swarm/api/manifest.go

@ -161,6 +161,7 @@ func newTestNode(t *testing.T, dir string) *testNode {
conf := &node.Config{ conf := &node.Config{
DataDir: dir, DataDir: dir,
IPCPath: "bzzd.ipc", IPCPath: "bzzd.ipc",
NoUSB: true,
} }
n, err := node.New(conf) n, err := node.New(conf)
if err != nil { if err != nil {

@ -27,8 +27,6 @@ import (
// TestCLISwarmUp tests that running 'swarm up' makes the resulting file // TestCLISwarmUp tests that running 'swarm up' makes the resulting file
// available from all nodes via the HTTP API // available from all nodes via the HTTP API
func TestCLISwarmUp(t *testing.T) { func TestCLISwarmUp(t *testing.T) {
t.Skip("flaky test")
// start 3 node cluster // start 3 node cluster
t.Log("starting 3 node cluster") t.Log("starting 3 node cluster")
cluster := newTestCluster(t, 3) cluster := newTestCluster(t, 3)

@ -63,7 +63,7 @@ func (a *Api) NewManifest() (storage.Key, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return a.Store(bytes.NewReader(data), int64(len(data)), nil) return a.Store(bytes.NewReader(data), int64(len(data)), &sync.WaitGroup{})
} }
// ManifestWriter is used to add and remove entries from an underlying manifest // ManifestWriter is used to add and remove entries from an underlying manifest

Loading…
Cancel
Save