Skip to content

Commit

Permalink
make more test use the GarnetApplication
Browse files Browse the repository at this point in the history
  • Loading branch information
s3w3nofficial committed Jan 23, 2025
1 parent c9f752a commit 24a075f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
12 changes: 6 additions & 6 deletions test/Garnet.test/RespSetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ namespace Garnet.test
[TestFixture]
public class RespSetTest
{
GarnetServer server;
GarnetApplication server;

[SetUp]
public void Setup()
public async Task Setup()
{
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, lowMemory: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, lowMemory: true);
await server.RunAsync();
}

[TearDown]
public void TearDown()
public async Task TearDown()
{
server.Dispose();
await server.StopAsync();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir);
}

Expand Down
54 changes: 27 additions & 27 deletions test/Garnet.test/RespTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ namespace Garnet.test
[TestFixture]
public class RespTests
{
GarnetServer server;
GarnetApplication server;
Random r;

[SetUp]
public void Setup()
public async Task Setup()
{
r = new Random(674386);
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, disablePubSub: false);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, disablePubSub: false);
await server.RunAsync();
}

[TearDown]
public void TearDown()
public async Task TearDown()
{
server.Dispose();
await server.StopAsync();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir);
}

Expand Down Expand Up @@ -1359,13 +1359,13 @@ public void SingleDelete()
}

[Test]
public void SingleDeleteWithObjectStoreDisabled()
public async Task SingleDeleteWithObjectStoreDisabled()
{
TearDown();

TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, DisableObjects: true);
await server.RunAsync();

var key = "delKey";
var value = "1234";
Expand All @@ -1391,13 +1391,13 @@ private string GetRandomString(int len)
}

[Test]
public void SingleDeleteWithObjectStoreDisable_LTM()
public async Task SingleDeleteWithObjectStoreDisable_LTM()
{
TearDown();

TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, lowMemory: true, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, lowMemory: true, DisableObjects: true);
await server.RunAsync();
using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
var db = redis.GetDatabase(0);

Expand Down Expand Up @@ -1431,14 +1431,14 @@ public void SingleDeleteWithObjectStoreDisable_LTM()
}

[Test]
public void MultiKeyDelete([Values] bool withoutObjectStore)
public async Task MultiKeyDelete([Values] bool withoutObjectStore)
{
if (withoutObjectStore)
{
TearDown();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, DisableObjects: true);
await server.RunAsync();
}

using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
Expand Down Expand Up @@ -1499,14 +1499,14 @@ public void MultiKeyDeleteObjectStore()
}

[Test]
public void MultiKeyUnlink([Values] bool withoutObjectStore)
public async Task MultiKeyUnlink([Values] bool withoutObjectStore)
{
if (withoutObjectStore)
{
TearDown();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, DisableObjects: true);
await server.RunAsync();
}

using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
Expand Down Expand Up @@ -1565,14 +1565,14 @@ public void MultiKeyUnlinkObjectStore()
}

[Test]
public void SingleExists([Values] bool withoutObjectStore)
public async Task SingleExists([Values] bool withoutObjectStore)
{
if (withoutObjectStore)
{
TearDown();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, DisableObjects: true);
await server.RunAsync();
}
using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
var db = redis.GetDatabase(0);
Expand Down Expand Up @@ -1830,14 +1830,14 @@ public void SingleRenameWithExpiry()
}

[Test]
public void SingleRenameKeyEdgeCase([Values] bool withoutObjectStore)
public async Task SingleRenameKeyEdgeCase([Values] bool withoutObjectStore)
{
if (withoutObjectStore)
{
TearDown();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, DisableObjects: true);
await server.RunAsync();
}
using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig());
var db = redis.GetDatabase(0);
Expand Down Expand Up @@ -3730,13 +3730,13 @@ public void HelloTest1()
}

[Test]
public void AsyncTest1()
public async Task AsyncTest1()
{
// Set up low-memory database
TearDown();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, lowMemory: true, DisableObjects: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, lowMemory: true, DisableObjects: true);
await server.RunAsync();

string firstKey = null, firstValue = null, lastKey = null, lastValue = null;

Expand Down
12 changes: 6 additions & 6 deletions test/Garnet.test/RespTlsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ namespace Garnet.test
[TestFixture]
public class RespTlsTests
{
GarnetServer server;
GarnetApplication server;

[SetUp]
public void Setup()
public async Task Setup()
{
TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true);
server = TestUtils.CreateGarnetServer(TestUtils.MethodTestDir, EnableTLS: true);
server.Start();
server = TestUtils.CreateGarnetApplication(TestUtils.MethodTestDir, EnableTLS: true);
await server.RunAsync();
}

[TearDown]
public void TearDown()
public async Task TearDown()
{
server.Dispose();
await server.StopAsync();
TestUtils.DeleteDirectory(TestUtils.MethodTestDir);
}

Expand Down

0 comments on commit 24a075f

Please sign in to comment.