Commit c95ccbb7 authored by Luke Champine's avatar Luke Champine

Merge branch 'TestContractorHostRemoval-ndf' into 'master'

Fix ndf in TestContractorHostRemoval

See merge request !3369
parents b3dadc02 0206f380
Pipeline #43536222 failed with stages
in 120 minutes and 18 seconds
......@@ -1515,9 +1515,9 @@ func TestContractorHostRemoval(t *testing.T) {
}
// Verify that st and stH1 are dropped in favor of the newer, better hosts.
rc = RenterContracts{}
err = build.Retry(100, time.Millisecond*100, func() error {
err = build.Retry(600, time.Millisecond*100, func() error {
var newContracts int
var rc RenterContracts
err = st.getAPI("/renter/contracts", &rc)
if err != nil {
return errors.New("couldn't get renter stats")
......@@ -1553,18 +1553,29 @@ func TestContractorHostRemoval(t *testing.T) {
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
// wait until the renew is complete.
err = st.getAPI("/renter/contracts", &rc)
if err != nil {
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.
for i := 0; i < 11; i++ {
_, err := st.miner.AddBlock()
......@@ -1677,6 +1688,11 @@ func TestContractorHostRemoval(t *testing.T) {
if err != nil {
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 {
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