Skip to content

Commit

Permalink
Use TestCategory to mark compression test as Enterprise and MRT tests…
Browse files Browse the repository at this point in the history
… as SCMode
  • Loading branch information
shannonklaus committed Jan 8, 2025
1 parent a008a41 commit b5173c6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 48 deletions.
2 changes: 1 addition & 1 deletion AerospikeTest/Async/TestAsyncTxn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace Aerospike.Test
{
[TestClass]
[TestClass, TestCategory("SCMode")]
public class TestAsyncTxn : TestAsync
{
private static readonly string binName = "bin";
Expand Down
80 changes: 34 additions & 46 deletions AerospikeTest/Sync/Basic/TestPutGet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,56 +104,44 @@ public void PutGetGeoJson()
Assert.AreEqual(r.GetValue("geo").GetType(), geoBin.value.GetType());
}

[TestMethod]
[TestMethod, TestCategory("Enterprise")]
public void PutGetCompression()
{
Node node = client.Nodes[0];
IDictionary<string, string> map = Info.Request(null, node);
Assert.IsNotNull(map);
WritePolicy writePolicy = new()
{
compress = true
};

Policy policy = new()
{
compress = true
};

Key key = new(args.ns, args.set, "putgetc");
Record record;

List<string> list = new();
int[] iterator = Enumerable.Range(0, 2000).ToArray();
foreach (int i in iterator)
{
list.Add(i.ToString());
}

Bin bin1 = new("bin", list);

client.Put(writePolicy, key, bin1);
record = client.Get(policy, key);
var bin1List = bin1.value.Object;
record.bins.TryGetValue("bin", out object recordBin);
CollectionAssert.AreEquivalent((List<string>)bin1List, (List<object>)recordBin);

record = client.GetHeader(policy, key);
AssertRecordFound(key, record);

foreach (KeyValuePair<string, string> entry in map)
// Generation should be greater than zero. Make sure it's populated.
if (record.generation == 0)
{
string kvp = entry.Key;

if (kvp.Equals("build_ee_sha")) // Compression only available in EE
{
Client.WritePolicy writePolicy = new()
{
compress = true
};

Policy policy = new()
{
compress = true
};

Key key = new(args.ns, args.set, "putgetc");
Record record;

List<string> list = new();
int[] iterator = Enumerable.Range(0, 2000).ToArray();
foreach (int i in iterator)
{
list.Add(i.ToString());
}

Bin bin1 = new("bin", list);

client.Put(writePolicy, key, bin1);
record = client.Get(policy, key);
var bin1List = bin1.value.Object;
record.bins.TryGetValue("bin", out object recordBin);
CollectionAssert.AreEquivalent((List<string>)bin1List, (List<object>)recordBin);

record = client.GetHeader(policy, key);
AssertRecordFound(key, record);

// Generation should be greater than zero. Make sure it's populated.
if (record.generation == 0)
{
Assert.Fail("Invalid record header: generation=" + record.generation + " expiration=" + record.expiration);
}
}
Assert.Fail("Invalid record header: generation=" + record.generation + " expiration=" + record.expiration);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion AerospikeTest/Sync/Basic/TestTxn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Aerospike.Test
{
[TestClass]
[TestClass, TestCategory("SCMode")]
public class TestTxn : TestSync
{
private static readonly string binName = "bin";
Expand Down

0 comments on commit b5173c6

Please sign in to comment.