Merge pull request #299 from ethersphere/test_missing_hash_no_error

cmd/swarm: make sure swarm doesnt crash when requested missing hashes
This commit is contained in:
Anton Evangelatov 2018-04-17 11:31:15 +03:00 committed by GitHub
commit b1d253c0fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
@ -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)
}
}
}