From 20a3045e1a6fec6f22e70677503fadc7b693614d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Elek?= Date: Tue, 28 Nov 2023 15:17:31 +0100 Subject: [PATCH] satellite/durability: use fixed number of pieces in integration test Test was flaky because we asserted if we have 15 classes: 6 email (for each used (!!!) nodes) 6 last_net (for each used (!!!) nodes) 1 wallet 1 country ("HU") 1 empty value But there was a very low chance to use only 5 nodes, out of the 6 (RS.Success=5, RS.Total=6). In that specific case, we had only 12 classes, as we didn't see all the used emails, as we iterated over the used nodes only (and one node was not used). https://github.com/storj/storj/issues/6549 Change-Id: I66882d5fa9b0d5f5b2397ea856494037972d4b81 --- satellite/durability/observer_integration_test.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/satellite/durability/observer_integration_test.go b/satellite/durability/observer_integration_test.go index 90d6c47c2..ff8e656e8 100644 --- a/satellite/durability/observer_integration_test.go +++ b/satellite/durability/observer_integration_test.go @@ -10,12 +10,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/zap" "storj.io/common/storj/location" "storj.io/common/testcontext" "storj.io/storj/private/testplanet" - "storj.io/storj/satellite" "storj.io/storj/satellite/durability" ) @@ -25,12 +23,7 @@ func TestDurabilityIntegration(t *testing.T) { StorageNodeCount: 6, UplinkCount: 1, Reconfigure: testplanet.Reconfigure{ - Satellite: func(log *zap.Logger, index int, config *satellite.Config) { - config.Metainfo.RS.Min = 3 - config.Metainfo.RS.Repair = 5 - config.Metainfo.RS.Success = 5 - config.Metainfo.RS.Total = 6 - }, + Satellite: testplanet.ReconfigureRS(3, 5, 6, 6), }, }, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { @@ -72,11 +65,11 @@ func TestDurabilityIntegration(t *testing.T) { rangedLoopService := planet.Satellites[0].RangedLoop.RangedLoop.Service _, err := rangedLoopService.RunOnce(ctx) + require.NoError(t, err) require.Len(t, result, 15) // one or two pieces are controlled out of the 5-6 --> 3 or 4 pieces are available without HU nodes - require.True(t, result["HU"].Min() > 2) - require.True(t, result["HU"].Min() < 5) - require.NoError(t, err) + require.Equal(t, result["HU"].Min(), 4) + }) }