Commit 0206f380 authored by Matthew Sevey's avatar Matthew Sevey Committed by Luke Champine

Fix ndf in TestContractorHostRemoval

parent b3dadc02
...@@ -1515,9 +1515,9 @@ func TestContractorHostRemoval(t *testing.T) { ...@@ -1515,9 +1515,9 @@ func TestContractorHostRemoval(t *testing.T) {
} }
// Verify that st and stH1 are dropped in favor of the newer, better hosts. // Verify that st and stH1 are dropped in favor of the newer, better hosts.
rc = RenterContracts{} err = build.Retry(600, time.Millisecond*100, func() error {
err = build.Retry(100, time.Millisecond*100, func() error {
var newContracts int var newContracts int
var rc RenterContracts
err = st.getAPI("/renter/contracts", &rc) err = st.getAPI("/renter/contracts", &rc)
if err != nil { if err != nil {
return errors.New("couldn't get renter stats") return errors.New("couldn't get renter stats")
...@@ -1553,18 +1553,29 @@ func TestContractorHostRemoval(t *testing.T) { ...@@ -1553,18 +1553,29 @@ func TestContractorHostRemoval(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// Block until data has been uploaded ot new contracts.
err = build.Retry(120, 250*time.Millisecond, func() error {
err = st.getAPI("/renter/contracts", &rc)
if err != nil {
return err
}
for _, contract := range rc.ActiveContracts {
if contract.Size != modules.SectorSize {
return fmt.Errorf("Each contrat should have 1 sector: %v - %v", contract.Size, contract.ID)
}
}
return nil
})
if err != nil {
t.Fatal(err)
}
// Grab the current contracts, then mine blocks to trigger a renew, and then // Grab the current contracts, then mine blocks to trigger a renew, and then
// wait until the renew is complete. // wait until the renew is complete.
err = st.getAPI("/renter/contracts", &rc) err = st.getAPI("/renter/contracts", &rc)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
// Check the amount of data in each contract.
for _, contract := range rc.ActiveContracts {
if contract.Size != modules.SectorSize {
t.Error("Each contrat should have 1 sector:", contract.Size, contract.ID)
}
}
// Mine blocks to force a contract renewal. // Mine blocks to force a contract renewal.
for i := 0; i < 11; i++ { for i := 0; i < 11; i++ {
_, err := st.miner.AddBlock() _, err := st.miner.AddBlock()
...@@ -1677,6 +1688,11 @@ func TestContractorHostRemoval(t *testing.T) { ...@@ -1677,6 +1688,11 @@ func TestContractorHostRemoval(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
rc = RenterContracts{}
err = st.getAPI("/renter/contracts", &rc)
if err != nil {
t.Fatal(err)
}
if rc.ActiveContracts[0].HostPublicKey.String() == rc1Host || rc.ActiveContracts[0].HostPublicKey.String() == rc2Host { if rc.ActiveContracts[0].HostPublicKey.String() == rc1Host || rc.ActiveContracts[0].HostPublicKey.String() == rc2Host {
t.Error("renter is renewing the wrong contracts", rc.ActiveContracts[0].HostPublicKey.String()) t.Error("renter is renewing the wrong contracts", rc.ActiveContracts[0].HostPublicKey.String())
} }
......
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