Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Nov 19, 2024
1 parent e8d91fb commit 391b3b6
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions core/services/ocrcommon/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,18 +659,15 @@ func TestGetPricesFromBridgeTaskByOrder(t *testing.T) {
require.Equal(t, float64(0), benchmarkPrice)
require.Equal(t, float64(0), bid)
require.Equal(t, float64(0), ask)
require.Equal(t, 1, logs.Len())
require.Contains(t, logs.All()[0].Message, "cannot parse enhanced EA telemetry")
require.Equal(t, 0, logs.Len())

tt := trrsMercuryV1[:2]
getPricesFromBridgeTask(lggr, trrsMercuryV1[0], tt, 1)
require.Equal(t, 2, logs.Len())
require.Contains(t, logs.All()[1].Message, "cannot parse enhanced EA telemetry bid price, task is nil")
require.Equal(t, 0, logs.Len())

tt = trrsMercuryV1[:3]
getPricesFromBridgeTask(lggr, trrsMercuryV1[0], tt, 1)
require.Equal(t, 3, logs.Len())
require.Contains(t, logs.All()[2].Message, "cannot parse enhanced EA telemetry ask price, task is nil")
require.Equal(t, 0, logs.Len())

trrs2 := pipeline.TaskRunResults{
pipeline.TaskRunResult{
Expand Down Expand Up @@ -710,10 +707,10 @@ func TestGetPricesFromBridgeTaskByOrder(t *testing.T) {
require.Equal(t, benchmarkPrice, float64(0))
require.Equal(t, bid, float64(0))
require.Equal(t, ask, float64(0))
require.Equal(t, logs.Len(), 6)
require.Contains(t, logs.All()[3].Message, "cannot parse EA telemetry price to float64, DOT id ds1_benchmark")
require.Contains(t, logs.All()[4].Message, "cannot parse EA telemetry price to float64, DOT id ds2_bid")
require.Contains(t, logs.All()[5].Message, "cannot parse EA telemetry price to float64, DOT id ds3_ask")
require.Equal(t, logs.Len(), 3)

Check failure on line 710 in core/services/ocrcommon/telemetry_test.go

View workflow job for this annotation

GitHub Actions / lint

expected-actual: need to reverse actual and expected values (testifylint)
require.Contains(t, logs.All()[0].Message, "cannot parse EA telemetry price to float64, DOT id ds1_benchmark")
require.Contains(t, logs.All()[1].Message, "cannot parse EA telemetry price to float64, DOT id ds2_bid")
require.Contains(t, logs.All()[2].Message, "cannot parse EA telemetry price to float64, DOT id ds3_ask")

benchmarkPrice, bid, ask = getPricesFromBridgeTask(lggr, trrsMercuryV1[0], trrsMercuryV2, 2)
require.Equal(t, 123456.123456, benchmarkPrice)
Expand Down Expand Up @@ -1140,11 +1137,9 @@ func TestCollectMercuryEnhancedTelemetryV2(t *testing.T) {
}

wg.Wait()
require.Equal(t, 3, logs.Len())
require.Equal(t, 1, logs.Len())
fmt.Println(logs.All())
require.Contains(t, logs.All()[0].Message, "cannot parse enhanced EA telemetry bid price")
require.Contains(t, logs.All()[1].Message, "cannot parse EA telemetry")
require.Contains(t, logs.All()[2].Message, "cannot parse enhanced EA telemetry bid price")
require.Contains(t, logs.All()[0].Message, "cannot parse EA telemetry")
chDone <- struct{}{}
}

Expand Down

0 comments on commit 391b3b6

Please sign in to comment.