Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider: start log poller in tests #11336

Closed
wants to merge 1 commit into from

Conversation

jmank88
Copy link
Contributor

@jmank88 jmank88 commented Nov 18, 2023

Another PR exposed that TestIntegration_LogEventProvider was not starting its log poller instance. However, with the log poller actually Started and running, TestIntegration_LogEventProvider does not pass. It seems like there is a timing assumption baked in. Should it pass? Or does it depend on the log poller not running? If so, that is a bit unusual, since we don't normally interact with unstarted services.

Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

@@ -660,6 +653,7 @@ func setupDependencies(t *testing.T, db *sqlx.DB, backend *backends.SimulatedBac
pollerLggr.SetLogLevel(zapcore.WarnLevel)
lorm := logpoller.NewORM(big.NewInt(1337), db, pollerLggr, pgtest.NewQConfig(false))
lp := logpoller.NewLogPoller(lorm, ethClient, pollerLggr, 100*time.Millisecond, false, 1, 2, 2, 1000)
require.NoError(t, lp.Start(testutils.Context(t)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the tests calling this setupDependencies helper had a running log poller. Was that intentional?

@@ -534,7 +527,7 @@ func collectPayloads(ctx context.Context, t *testing.T, logProvider logprovider.
for ctx.Err() == nil && len(allPayloads) < n && rounds > 0 {
logs, err := logProvider.GetLatestPayloads(ctx)
require.NoError(t, err)
require.LessOrEqual(t, len(logs), logprovider.AllowedLogsPerUpkeep, "failed to get all logs")
require.LessOrEqual(t, len(logs), logprovider.AllowedLogsPerUpkeep)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where TestIntegration_LogEventProvider fails. Is this a per-round assumption? Meaning if this loop went fast enough, then the test would pass?

Comment on lines 65 to 66
if err := logProvider.Start(ctx); err != nil {
t.Logf("error starting log provider: %s", err)
t.Fail()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't need to be called from separate goroutines, and it was actually a problem since the call to Fail could race with the end of the test.

@jmank88 jmank88 force-pushed the logpoller-ctx branch 3 times, most recently from 2cef51d to d0a87f4 Compare November 21, 2023 20:34
@jmank88 jmank88 force-pushed the logpoller-ctx branch 2 times, most recently from 821bb80 to 3713078 Compare November 27, 2023 21:21
@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 27, 2024
@github-actions github-actions bot closed this Feb 3, 2024
@jmank88 jmank88 reopened this Feb 5, 2024
@jmank88 jmank88 changed the title core/chains/evm/logpoller: fix context wiring core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider: start log poller in tests Feb 5, 2024
@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions github-actions bot removed the Stale label Feb 6, 2024
Copy link
Contributor

github-actions bot commented Apr 7, 2024

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 7, 2024
@github-actions github-actions bot closed this Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant