From ab343c5bb249f52dd2bb3c8775d3233980d4df04 Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Wed, 18 Dec 2024 13:33:14 +0100 Subject: [PATCH] run transition in loop --- .github/workflows/test.yml | 2 +- autopilot/contractor/hostfilter.go | 1 + internal/test/e2e/cluster_test.go | 13 +++++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39a2618df..632d9aaec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,7 +83,7 @@ jobs: - name: Test uses: SiaFoundation/workflows/.github/actions/go-test@master with: - go-test-args: "-race;-timeout=20m;-tags=netgo,v2" + go-test-args: "-race;-timeout=20m;-tags=netgo,v2;-run=TestV1ToV2Transition;-count=50" test-mysql-v2: # Run all tests against MySQL needs: analyze diff --git a/autopilot/contractor/hostfilter.go b/autopilot/contractor/hostfilter.go index b9dd6064d..473097f25 100644 --- a/autopilot/contractor/hostfilter.go +++ b/autopilot/contractor/hostfilter.go @@ -119,6 +119,7 @@ func (c *Contractor) isUsableContract(cfg api.AutopilotConfig, contract contract usable = usable && !secondHalf // only unusable if in second half of renew window refresh = false renew = true + fmt.Println("renew", shouldRenew, secondHalf, contract.EndHeight(), cfg.Contracts.RenewWindow, bh) } } return diff --git a/internal/test/e2e/cluster_test.go b/internal/test/e2e/cluster_test.go index 0734a1cb4..390c61d3c 100644 --- a/internal/test/e2e/cluster_test.go +++ b/internal/test/e2e/cluster_test.go @@ -2987,6 +2987,7 @@ func TestV1ToV2Transition(t *testing.T) { // mine until we reach the v2 allowheight cluster.MineBlocks(network.HardforkV2.AllowHeight - cm.Tip().Height) + fmt.Println("allow", network.HardforkV2.AllowHeight-cm.Tip().Height) // slowly mine a few more blocks to allow renter to react for i := 0; i < 5; i++ { @@ -3000,8 +3001,16 @@ func TestV1ToV2Transition(t *testing.T) { archivedContracts, err = cluster.Bus.Contracts(context.Background(), api.ContractsOpts{FilterMode: api.ContractFilterModeArchived}) tt.OK(err) if len(archivedContracts) != nHosts-1 { - return fmt.Errorf("expected %v archived contracts, got %v", nHosts-1, len(archivedContracts)) + var reasons []string + for _, c := range archivedContracts { + reasons = append(reasons, c.ArchivalReason) + } + return fmt.Errorf("expected %v archived contracts, got %v (reasons: %v)", nHosts-1, len(archivedContracts), reasons) + } + for _, c := range archivedContracts { + fmt.Println("c1", c.ID, c.StartHeight, c.ProofHeight, c.EndHeight()) } + return nil }) @@ -3009,7 +3018,7 @@ func TestV1ToV2Transition(t *testing.T) { usedHosts := make(map[types.PublicKey]struct{}) for _, c := range archivedContracts { if c.ArchivalReason != "migrated to v2" { - t.Fatalf("expected archival reason to be 'migrated to v2', got %v", c.ArchivalReason) + t.Fatalf("expected archival reason to be 'migrated to v2', got '%v' (v2: %v)", c.ArchivalReason, c.V2) } usedHosts[c.HostKey] = struct{}{} }