Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Sep 17, 2024
1 parent 62e5440 commit efebbf1
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions pkg/rewards/operatorAvsRegistrationWindows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ func hydrateOperatorAvsStateChangesTable(grm *gorm.DB, l *zap.Logger) (int, erro
return 0, err
}

fmt.Printf("contents: %v", len(contents))

_, err = sqlite.WrapTxAndCommit[interface{}](func(tx *gorm.DB) (interface{}, error) {
for i, content := range contents {
res := grm.Exec(content)
Expand All @@ -69,8 +67,6 @@ func hydrateBlocksTable(grm *gorm.DB, l *zap.Logger) (int, error) {
return 0, err
}

fmt.Printf("contents: %v", len(contents))

_, err = sqlite.WrapTxAndCommit[interface{}](func(tx *gorm.DB) (interface{}, error) {
for i, content := range contents {
res := grm.Exec(content)
Expand Down Expand Up @@ -125,10 +121,7 @@ func Test_OperatorAvsRegistrationWindows(t *testing.T) {
expectedResults, err := tests.GetExpectedOperatorAvsRegistrationWindows()
assert.Nil(t, err)

fmt.Printf("Window: %+v\n", windows[0])
fmt.Printf("windows: %v\n", len(windows))

// assert.Equal(t, len(expectedResults), len(windows))
assert.Equal(t, len(expectedResults), len(windows))

// Sort expected
slices.SortFunc(expectedResults, func(i, j *tests.ExpectedOperatorAvsRegistrationWindows) int {
Expand All @@ -146,6 +139,8 @@ func Test_OperatorAvsRegistrationWindows(t *testing.T) {

lacksExpectedResult := make([]*OperatorAvsRegistrationWindow, 0)

// Go line-by-line in the window results and find the corresponding line in the expected results.
// If one doesnt exist, add it to the missing list.
for _, window := range windows {
match := utils.Find(expectedResults, func(expected *tests.ExpectedOperatorAvsRegistrationWindows) bool {
if expected.Operator == window.Operator && expected.Avs == window.Avs && expected.StartDate == window.StartTime && expected.EndDate == window.EndTime {
Expand All @@ -158,11 +153,12 @@ func Test_OperatorAvsRegistrationWindows(t *testing.T) {
lacksExpectedResult = append(lacksExpectedResult, window)
}
}
fmt.Printf("Errors: %+v\n", len(lacksExpectedResult))
fmt.Printf("Expected: %+v\n", expectedResults[0])
assert.Equal(t, 0, len(lacksExpectedResult))

for i, window := range lacksExpectedResult {
fmt.Printf("%d - Window: %+v\n", i, window)
if len(lacksExpectedResult) > 0 {
for i, window := range lacksExpectedResult {
fmt.Printf("%d - Window: %+v\n", i, window)
}
}

})
Expand Down

0 comments on commit efebbf1

Please sign in to comment.