Skip to content

Commit

Permalink
services/ticker: add test logs to identify inputs that make test flaky (
Browse files Browse the repository at this point in the history
#2064)

Add logs to the `TestInsertOrUpdateAsset` that print out the exact times that are being used.

The test has been reported as flaky a couple times, first in #1733 then in #2063. There was an imperfect fix put in place in 3e23070 but we've seen another test failure. Previously when I debugged this I wrote some test cases to try long series of inputs to find an input that caused a failure. This time I think it will be a better use of our time if we improve the test logs in this test so that the next time it fails we know exactly what inputs are being used for time and then we can address the continued flakyness.

This doesn't fix the issue reported, just gives us more visibility into a set of inputs we can reproduce with so that when we spend time fixing it we can be confident if we have fixed it or not.
  • Loading branch information
leighmcculloch authored Dec 16, 2019
1 parent aa0f37c commit 86f2db7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions services/ticker/internal/tickerdb/queries_asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestInsertOrUpdateAsset(t *testing.T) {

// Creating first asset:
firstTime := time.Now()
t.Log("firstTime:", firstTime)
a := Asset{
Code: code,
IssuerAccount: issuerAccount,
Expand Down Expand Up @@ -88,6 +89,7 @@ func TestInsertOrUpdateAsset(t *testing.T) {

// Creating Seconde Asset:
secondTime := time.Now()
t.Log("secondTime:", secondTime)
a.LastValid = secondTime
a.LastChecked = secondTime
err = session.InsertOrUpdateAsset(&a, []string{"code", "issuer_account", "issuer_id"})
Expand Down Expand Up @@ -122,6 +124,7 @@ func TestInsertOrUpdateAsset(t *testing.T) {

// Creating Third Asset:
thirdTime := time.Now()
t.Log("thirdTime:", thirdTime)
a.LastValid = thirdTime
a.LastChecked = thirdTime
err = session.InsertOrUpdateAsset(&a, []string{"code", "issuer_id", "last_valid", "last_checked", "issuer_account"})
Expand Down

0 comments on commit 86f2db7

Please sign in to comment.