Skip to content

Commit

Permalink
fix: db creation in tests, mock filename
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Oct 10, 2024
1 parent 99a7c98 commit 7854687
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions core/meterer/meterer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ func TestMain(m *testing.M) {
os.Exit(code)
}

// // Mock data initialization method
// func InitializeMockPayments(pcs *meterer.OnchainPaymentState, privateKey1 *ecdsa.PrivateKey, privateKey2 *ecdsa.PrivateKey) {
// // Initialize mock active reservations
// now := uint64(time.Now().Unix())
// pcs.ActiveReservations = map[string]core.ActiveReservation{
// crypto.PubkeyToAddress(privateKey1.PublicKey).Hex(): {DataRate: 100, StartTimestamp: now + 1200, EndTimestamp: now + 1800, QuorumSplit: []byte{50, 50}, QuorumNumbers: []uint8{0, 1}},
// crypto.PubkeyToAddress(privateKey2.PublicKey).Hex(): {DataRate: 200, StartTimestamp: now - 120, EndTimestamp: now + 180, QuorumSplit: []byte{30, 70}, QuorumNumbers: []uint8{0, 1}},
// }
// pcs.OnDemandPayments = map[string]core.OnDemandPayment{
// crypto.PubkeyToAddress(privateKey1.PublicKey).Hex(): {CumulativePayment: 1500},
// crypto.PubkeyToAddress(privateKey2.PublicKey).Hex(): {CumulativePayment: 1000},
// }
// }

func setup(_ *testing.M) {

deployLocalStack = !(os.Getenv("DEPLOY_LOCALSTACK") == "false")
Expand Down Expand Up @@ -117,13 +103,18 @@ func setup(_ *testing.M) {
EndpointURL: fmt.Sprintf("http://0.0.0.0:4566"),
}

meterer.CreateReservationTable(clientConfig, "reservations")
meterer.CreateOnDemandTable(clientConfig, "ondemand")
meterer.CreateGlobalReservationTable(clientConfig, "global")

store, err := meterer.NewOffchainStore(
clientConfig,
"reservations",
"ondemand",
"global",
logger,
)

if err != nil {
teardown()
panic("failed to create offchain store")
Expand Down
File renamed without changes.

0 comments on commit 7854687

Please sign in to comment.