Commit 834664a2 authored by Luke Champine's avatar Luke Champine Committed by GitHub

Merge pull request #1590 from NebulousLabs/erasure-lock

Erasure lock
parents 825ba9af 16df7141
......@@ -265,7 +265,6 @@ func TestHostPoorConnectivity(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
// Create the various nodes that will be forming the simulated ecosystem of
// this test.
......
......@@ -27,7 +27,6 @@ func TestHostDBHostsActiveHandler(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostDBHostsActiveHandler")
if err != nil {
t.Fatal(err)
......@@ -117,7 +116,6 @@ func TestHostDBHostsAllHandler(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostDBHostsAllHandler")
if err != nil {
t.Fatal(err)
......@@ -149,7 +147,6 @@ func TestHostDBHostsHandler(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostDBHostsHandler")
if err != nil {
t.Fatal(err)
......@@ -320,6 +317,7 @@ func TestHostDBScanOnlineOffline(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostDBScanOnlineOffline")
if err != nil {
t.Fatal(err)
......
......@@ -24,7 +24,6 @@ func TestHostAndRentVanilla(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostAndRentVanilla")
if err != nil {
t.Fatal(err)
......@@ -164,7 +163,6 @@ func TestHostAndRentMultiHost(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostAndRentMultiHost-Host1andRenter")
if err != nil {
t.Fatal(err)
......@@ -280,7 +278,6 @@ func TestHostAndRentManyFiles(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestHostAndRentManyFiles-Host1andRenter")
if err != nil {
t.Fatal(err)
......@@ -490,7 +487,6 @@ func TestRenterUploadDownload(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestRenterUploadDownload")
if err != nil {
t.Fatal(err)
......@@ -617,7 +613,6 @@ func TestRenterCancelAllowance(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestRenterCancelAllowance")
if err != nil {
t.Fatal(err)
......@@ -698,7 +693,6 @@ func TestRenterParallelDelete(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestRenterParallelDelete")
if err != nil {
t.Fatal(err)
......@@ -808,7 +802,6 @@ func TestRenterRenew(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestRenterRenew")
if err != nil {
t.Fatal(err)
......@@ -828,6 +821,19 @@ func TestRenterRenew(t *testing.T) {
if err != nil {
t.Fatal(err)
}
var ah HostdbActiveGET
for i := 0; i < 50; i++ {
if err = st.getAPI("/hostdb/active", &ah); err != nil {
t.Fatal(err)
}
if len(ah.Hosts) == 1 {
break
}
time.Sleep(time.Millisecond * 100)
}
if len(ah.Hosts) != 1 {
t.Fatalf("expected 1 host, got %v", len(ah.Hosts))
}
// Set an allowance for the renter, allowing a contract to be formed.
allowanceValues := url.Values{}
......@@ -873,7 +879,7 @@ func TestRenterRenew(t *testing.T) {
contractID := rc.Contracts[0].ID
// Mine enough blocks to enter the renewal window.
for i := 0; i < testPeriod/2; i++ {
for i := 0; i < testPeriod; i++ {
st.miner.AddBlock()
}
// Wait for the contract to be renewed.
......@@ -911,7 +917,6 @@ func TestRenterAllowance(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
st, err := createServerTester("TestRenterAllowance")
if err != nil {
t.Fatal(err)
......
......@@ -11,9 +11,9 @@ import (
func TestRPCID(t *testing.T) {
cases := map[rpcID]string{
rpcID{}: " ",
rpcID{'f', 'o', 'o'}: "foo ",
rpcID{'f', 'o', 'o', 'b', 'a', 'r', 'b', 'a'}: "foobarba",
{}: " ",
{'f', 'o', 'o'}: "foo ",
{'f', 'o', 'o', 'b', 'a', 'r', 'b', 'a'}: "foobarba",
}
for id, s := range cases {
if id.String() != s {
......
......@@ -34,7 +34,7 @@ var (
//
// TODO: Allow this number to be established in the renter settings.
maxActiveDownloadPieces = build.Select(build.Var{
Standard: int(24),
Standard: int(40),
Dev: int(10),
Testing: int(5),
}).(int)
......
......@@ -52,7 +52,7 @@ func TestFileAvailable(t *testing.T) {
for i := uint64(0); i < f.numChunks(); i++ {
fc.Pieces = append(fc.Pieces, pieceData{Chunk: i, Piece: 0})
}
f.contracts = map[types.FileContractID]fileContract{types.FileContractID{}: fc}
f.contracts = map[types.FileContractID]fileContract{{}: fc}
if !f.available() {
t.Error("file should be available")
......
......@@ -283,12 +283,14 @@ func (hdb *HostDB) threadedScan() {
// Grab a set of hosts to scan, grab hosts that are active, inactive,
// and offline to get high diversity.
var onlineHosts, offlineHosts []modules.HostDBEntry
for _, host := range hdb.hostTree.All() {
allHosts := hdb.hostTree.All()
for i := len(allHosts) - 1; i >= 0; i-- {
if len(onlineHosts) >= hostCheckupQuantity && len(offlineHosts) >= hostCheckupQuantity {
break
}
// Figure out if the host is online or offline.
host := allHosts[i]
online := len(host.ScanHistory) > 0 && host.ScanHistory[len(host.ScanHistory)-1].Success
if online && len(onlineHosts) < hostCheckupQuantity {
onlineHosts = append(onlineHosts, host)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment