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

Use redisFixture in all tests #244

Merged
merged 4 commits into from
Feb 13, 2024
Merged

Use redisFixture in all tests #244

merged 4 commits into from
Feb 13, 2024

Conversation

shacharPash
Copy link
Collaborator

Use redisFixture in all tests like this:

var db = redisFixture.Redis.GetDatabase();

instead of this:

var redis = ConnectionMultiplexer.Connect("localhost:6379");
var db = redis.GetDatabase();

This allows us more control over the tests, such as setting a default value for the connection and the ability to test on a variety of connections/ports

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (980a77c) 94.16% compared to head (ee4ec88) 94.16%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #244   +/-   ##
=======================================
  Coverage   94.16%   94.16%           
=======================================
  Files          85       85           
  Lines        5178     5178           
  Branches      487      487           
=======================================
  Hits         4876     4876           
  Misses        178      178           
  Partials      124      124           

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

[SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
var db = muxer.GetDatabase();
var db = redisFixture.Redis.GetDatabase();
Copy link
Contributor

Choose a reason for hiding this comment

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

I realized something: these tests inside Doc might be written in such a way that the source code can be used inside documentation. I see there are special comments, like // REMOVE_START and // REMOVE_END, it looks like the source code is processed via some tool.

In that case, we should not use the fixture for these Doc tests, because the sample code would not work if someone tries to use it as-such.

@shacharPash shacharPash merged commit 9a607e0 into master Feb 13, 2024
16 checks passed
@shacharPash shacharPash deleted the testViaRedisFixture branch February 13, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants