Skip to content

Commit

Permalink
Merge pull request ethereum#299 from ethersphere/test_missing_hash_no…
Browse files Browse the repository at this point in the history
…_error

cmd/swarm: make sure swarm doesnt crash when requested missing hashes
  • Loading branch information
nonsense authored Apr 17, 2018
2 parents 8ee6561 + 304225a commit b1d253c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/swarm/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func testCLISwarmUp(toEncrypt bool, t *testing.T) {
}

if res.StatusCode != 200 {
t.Fatalf("expected HTTP status %d, got %s", 200, res.Status)
t.Fatalf("expected HTTP status 200, got %s", res.Status)
}

reply, err := ioutil.ReadAll(res.Body)
Expand All @@ -102,4 +102,15 @@ func testCLISwarmUp(toEncrypt bool, t *testing.T) {
t.Fatalf("expected HTTP body %q, got %q", data, reply)
}
}

// get an non-existent hash from each node
for _, node := range cluster.Nodes {
res, err := http.Get(node.URL + "/bzz:/1023e8bae0f70be7d7b5f74343088ba408a218254391490c85ae16278e230340")
if err != nil {
t.Fatal(err)
}
if res.StatusCode != 404 {
t.Fatalf("expected HTTP status 404, got %s", res.Status)
}
}
}

0 comments on commit b1d253c

Please sign in to comment.