Skip to content

Commit 03568cc

Browse files
committed
ran go mod tidy
1 parent 7d194b7 commit 03568cc

File tree

4 files changed

+27
-30
lines changed

4 files changed

+27
-30
lines changed

cmd/solana_exporter/exporter_test.go

+22-19
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import (
1616
"time"
1717
)
1818

19-
const InflationRewardLamports = 10
20-
const FeeRewardLamports = 10
21-
2219
type (
2320
Simulator struct {
2421
Server *rpc.MockServer
@@ -28,17 +25,21 @@ type (
2825
Epoch int
2926
TransactionCount int
3027

31-
SlotTime time.Duration
32-
EpochSize int
33-
LeaderSchedule map[string][]int
34-
Nodekeys []string
35-
Votekeys []string
28+
// constants for the simulator
29+
SlotTime time.Duration
30+
EpochSize int
31+
LeaderSchedule map[string][]int
32+
Nodekeys []string
33+
Votekeys []string
34+
FeeRewardLamports int
35+
InflationRewardLamports int
3636
}
3737
)
3838

3939
func NewSimulator(t *testing.T, slot int) (*Simulator, *rpc.Client) {
4040
nodekeys := []string{"aaa", "bbb", "ccc"}
4141
votekeys := []string{"AAA", "BBB", "CCC"}
42+
feeRewardLamports, inflationRewardLamports := 10, 10
4243

4344
validatorInfos := make(map[string]rpc.MockValidatorInfo)
4445
for i, nodekey := range nodekeys {
@@ -68,21 +69,23 @@ func NewSimulator(t *testing.T, slot int) (*Simulator, *rpc.Client) {
6869
"CCC": 6 * rpc.LamportsInSol,
6970
},
7071
map[string]int{
71-
"AAA": InflationRewardLamports,
72-
"BBB": InflationRewardLamports,
73-
"CCC": InflationRewardLamports,
72+
"AAA": inflationRewardLamports,
73+
"BBB": inflationRewardLamports,
74+
"CCC": inflationRewardLamports,
7475
},
7576
nil,
7677
validatorInfos,
7778
)
7879
simulator := Simulator{
79-
Slot: 0,
80-
Server: mockServer,
81-
EpochSize: 24,
82-
SlotTime: 100 * time.Millisecond,
83-
LeaderSchedule: leaderSchedule,
84-
Nodekeys: nodekeys,
85-
Votekeys: votekeys,
80+
Slot: 0,
81+
Server: mockServer,
82+
EpochSize: 24,
83+
SlotTime: 100 * time.Millisecond,
84+
LeaderSchedule: leaderSchedule,
85+
Nodekeys: nodekeys,
86+
Votekeys: votekeys,
87+
InflationRewardLamports: inflationRewardLamports,
88+
FeeRewardLamports: feeRewardLamports,
8689
}
8790
simulator.PopulateSlot(0)
8891
if slot > 0 {
@@ -146,7 +149,7 @@ func (c *Simulator) PopulateSlot(slot int) {
146149
}
147150

148151
c.TransactionCount += len(transactions)
149-
block = &rpc.MockBlockInfo{Fee: FeeRewardLamports, Transactions: transactions}
152+
block = &rpc.MockBlockInfo{Fee: c.FeeRewardLamports, Transactions: transactions}
150153
}
151154
// add slot info:
152155
c.Server.SetOpt(rpc.SlotInfosOpt, slot, rpc.MockSlotInfo{Leader: leader, Block: block})

cmd/solana_exporter/slots_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func TestSlotWatcher_WatchSlots_Dynamic(t *testing.T) {
241241
// inflation rewards:
242242
votekey := simulator.Votekeys[i]
243243
assert.Equalf(t,
244-
float64(InflationRewardLamports)/rpc.LamportsInSol,
244+
float64(simulator.InflationRewardLamports)/rpc.LamportsInSol,
245245
testutil.ToFloat64(
246246
watcher.InflationRewardsMetric.WithLabelValues(votekey, toString(initial.EpochNumber)),
247247
),
@@ -251,7 +251,7 @@ func TestSlotWatcher_WatchSlots_Dynamic(t *testing.T) {
251251

252252
// fee rewards:
253253
assert.Equalf(t,
254-
float64(FeeRewardLamports*leaderSlotsPerEpoch*3/4)/rpc.LamportsInSol,
254+
float64(simulator.FeeRewardLamports*leaderSlotsPerEpoch*3/4)/rpc.LamportsInSol,
255255
testutil.ToFloat64(
256256
watcher.FeeRewardsMetric.WithLabelValues(nodekey, toString(initial.EpochNumber)),
257257
),

go.mod

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,18 @@ go 1.22
55
require (
66
github.com/prometheus/client_golang v1.19.1
77
github.com/stretchr/testify v1.9.0
8-
k8s.io/klog/v2 v2.120.1
8+
go.uber.org/zap v1.27.0
99
)
1010

1111
require (
1212
github.com/beorn7/perks v1.0.1 // indirect
1313
github.com/cespare/xxhash/v2 v2.2.0 // indirect
1414
github.com/davecgh/go-spew v1.1.1 // indirect
15-
github.com/go-logr/logr v1.4.1 // indirect
16-
github.com/kr/text v0.2.0 // indirect
1715
github.com/pmezard/go-difflib v1.0.0 // indirect
1816
github.com/prometheus/client_model v0.5.0 // indirect
1917
github.com/prometheus/common v0.48.0 // indirect
2018
github.com/prometheus/procfs v0.12.0 // indirect
2119
go.uber.org/multierr v1.10.0 // indirect
22-
go.uber.org/zap v1.27.0 // indirect
2320
golang.org/x/sys v0.17.0 // indirect
2421
google.golang.org/protobuf v1.33.0 // indirect
2522
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
22
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
33
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
44
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
5-
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
65
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
76
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8-
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
9-
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
107
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
118
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
129
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -27,6 +24,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
2724
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
2825
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
2926
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
27+
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
28+
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
3029
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
3130
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
3231
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
@@ -40,5 +39,3 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
4039
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
4140
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4241
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
43-
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
44-
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=

0 commit comments

Comments
 (0)