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

feat: providertest #791

Merged
merged 11 commits into from
Oct 9, 2024
Merged

feat: providertest #791

merged 11 commits into from
Oct 9, 2024

Conversation

aljo242
Copy link
Contributor

@aljo242 aljo242 commented Oct 8, 2024

Closes CON-1811

Simple framework for spinning up a testing oracle and running:

  • full market map
  • single market
  • full markets filters to just have one provider

outputs logs to a file and to stdout for debugging purposes.

Fails if there is not an expected price update at every pollingInterval. Currently we do not check the price for any validity, but this could be extended to allow for that too.

func TestProvider(t *testing.T) {
	// take in a market map and filter it to output N market maps with only a single provider
	marketsPerProvider := providertest.FilterMarketMapToProviders(mm)

	// run this check for each provider (here only okx_ws)
	for provider, marketMap := range marketsPerProvider {
		ctx := context.Background()
		p, err := providertest.NewTestingOracle(ctx, provider)
		require.NoError(t, err)

		err = p.RunMarketMap(ctx, marketMap, providertest.DefaultProviderTestConfig())
		require.NoError(t, err)
	}
}```

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 15.07937% with 107 lines in your changes missing coverage. Please review.

Project coverage is 56.55%. Comparing base (d14ea9d) to head (5b4e2c7).

Files with missing lines Patch % Lines
providers/providertest/provider.go 0.00% 87 Missing ⚠️
providers/providertest/util.go 48.71% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
- Coverage   56.98%   56.55%   -0.43%     
==========================================
  Files         210      212       +2     
  Lines       11720    11846     +126     
==========================================
+ Hits         6679     6700      +21     
- Misses       4432     4537     +105     
  Partials      609      609              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aljo242 aljo242 marked this pull request as ready for review October 9, 2024 16:08
@aljo242 aljo242 merged commit 167f9ac into main Oct 9, 2024
12 checks passed
@aljo242 aljo242 deleted the feat/providertest branch October 9, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants