diff --git a/core/meterer/meterer.go b/core/meterer/meterer.go index ffab45b63c..8f5d9b9831 100644 --- a/core/meterer/meterer.go +++ b/core/meterer/meterer.go @@ -52,6 +52,11 @@ func (m *Meterer) Start(ctx context.Context) { ticker := time.NewTicker(1 * time.Hour) defer ticker.Stop() + // initial tick immediately upto Start + if err := m.ChainState.RefreshOnchainPaymentState(ctx, nil); err != nil { + m.logger.Error("Failed to make initial query to the on-chain state", "error", err) + } + for { select { case <-ticker.C: diff --git a/core/meterer/meterer_test.go b/core/meterer/meterer_test.go index 017968d904..ddd91c2900 100644 --- a/core/meterer/meterer_test.go +++ b/core/meterer/meterer_test.go @@ -43,9 +43,9 @@ var ( deployLocalStack bool localStackPort = "4566" paymentChainState = &mock.MockOnchainPaymentState{} - ondemandTableName = "ondemand-meterer-test" - reservationTableName = "reservations-meterer-test" - globalReservationTableName = "global-reservation-meterer-test" + ondemandTableName = "ondemand_meterer" + reservationTableName = "reservations_meterer" + globalReservationTableName = "global_reservation_meterer" ) func TestMain(m *testing.M) { diff --git a/disperser/apiserver/server_test.go b/disperser/apiserver/server_test.go index 34950fef1b..24486f66a0 100644 --- a/disperser/apiserver/server_test.go +++ b/disperser/apiserver/server_test.go @@ -53,7 +53,7 @@ var ( bucketTableName = fmt.Sprintf("test-BucketStore-%v", UUID) deployLocalStack bool - localStackPort = "4568" + localStackPort = "4569" allowlistFile *os.File testMaxBlobSize = 2 * 1024 * 1024 ) @@ -137,7 +137,7 @@ func TestDisperseBlobWithRequiredQuorums(t *testing.T) { } transactor.On("GetQuorumSecurityParams", tmock.Anything).Return(quorumParams, nil) - dispersalServer := newTestServer(transactor) + dispersalServer := newTestServer(transactor, t.Name()) data := make([]byte, 1024) _, err := rand.Read(data) @@ -193,6 +193,7 @@ func TestDisperseBlobWithRequiredQuorums(t *testing.T) { } func TestDisperseBlobWithInvalidQuorum(t *testing.T) { + data := make([]byte, 1024) _, err := rand.Read(data) assert.NoError(t, err) @@ -207,6 +208,7 @@ func TestDisperseBlobWithInvalidQuorum(t *testing.T) { } ctx := peer.NewContext(context.Background(), p) + // (*dispersalServer).tx.On("GetRequiredQuorumNumbers", tmock.Anything).Return([]uint8{0, 1}, nil).Twice() _, err = dispersalServer.DisperseBlob(ctx, &pb.DisperseBlobRequest{ Data: data, CustomQuorumNumbers: []uint32{2}, @@ -605,7 +607,7 @@ func setup() { transactor.On("GetQuorumSecurityParams", tmock.Anything).Return(quorumParams, nil) transactor.On("GetRequiredQuorumNumbers", tmock.Anything).Return([]uint8{}, nil) - dispersalServer = newTestServer(transactor) + dispersalServer = newTestServer(transactor, "setup") dispersalServerV2 = newTestServerV2() } @@ -618,7 +620,7 @@ func teardown() { } } -func newTestServer(transactor core.Writer) *apiserver.DispersalServer { +func newTestServer(transactor core.Writer, testName string) *apiserver.DispersalServer { logger := logging.NewNoopLogger() bucketName := "test-eigenda-blobstore" @@ -650,8 +652,8 @@ func newTestServer(transactor core.Writer) *apiserver.DispersalServer { mockState := &mock.MockOnchainPaymentState{} - table_names := []string{"reservations-apiserver-test", "ondemand-apiserver-test", "global-apiserver-test"} - + // append test name to each table name for an unique store + table_names := []string{"reservations_server_" + testName, "ondemand_server_" + testName, "global_server_" + testName} err = meterer.CreateReservationTable(awsConfig, table_names[0]) if err != nil { teardown() diff --git a/test/integration_test.go b/test/integration_test.go index cf7f440cce..0c331bdb38 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -259,7 +259,7 @@ func mustMakeDisperser(t *testing.T, cst core.IndexedChainState, store disperser EndpointURL: fmt.Sprintf("http://0.0.0.0:%s", localStackPort), } - table_names := []string{"reservations-integration-test", "ondemand-integration-test", "global-integration-test"} + table_names := []string{"reservations_integration", "ondemand_integration", "global_integration"} err = meterer.CreateReservationTable(clientConfig, table_names[0]) if err != nil {