mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-04-18 08:43:07 +00:00
Test for partial dataset encoding
This commit is contained in:
parent
c12132d408
commit
fbb8db2a03
@ -43,5 +43,54 @@ namespace CodexReleaseTests.DataTests
|
||||
|
||||
file.AssertIsEqual(decoded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Crashes node attempting encoding. Issue: https://github.com/codex-storage/nim-codex/issues/1185")]
|
||||
public void PartiallyDeletedDatasets()
|
||||
{
|
||||
var clients = StartClients(s => s
|
||||
.WithBlockMaintenanceNumber(1)
|
||||
.WithBlockMaintenanceInterval(TimeSpan.FromSeconds(10.0))
|
||||
.WithBlockTTL(TimeSpan.FromSeconds(30.0)));
|
||||
|
||||
|
||||
var file = GenerateTestFile(2.MB());
|
||||
var bCid = clients[0].UploadFile(file);
|
||||
|
||||
var space = clients[0].Space();
|
||||
var update = space;
|
||||
while (space.QuotaUsedBytes == update.QuotaUsedBytes)
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(3.0));
|
||||
update = clients[0].Space();
|
||||
}
|
||||
|
||||
Assert.That(update.QuotaUsedBytes, Is.LessThan(space.QuotaUsedBytes));
|
||||
// The dataset is partially deleted.
|
||||
|
||||
// What happens when we request storage for it?
|
||||
var request = clients[0].Marketplace.RequestStorage(new CodexClient.StoragePurchaseRequest(bCid)
|
||||
{
|
||||
Expiry = TimeSpan.FromMinutes(5.0),
|
||||
Duration = TimeSpan.FromMinutes(100.0),
|
||||
CollateralPerByte = 100.Tst(),
|
||||
MinRequiredNumberOfNodes = 6,
|
||||
NodeFailureTolerance = 3,
|
||||
PricePerBytePerSecond = 100.Tst(),
|
||||
ProofProbability = 20
|
||||
});
|
||||
var eCid = request.ContentId;
|
||||
|
||||
Assert.That(bCid.Id, Is.Not.EqualTo(eCid.Id));
|
||||
|
||||
var basic = clients[0].DownloadManifestOnly(bCid);
|
||||
var encoded = clients[0].DownloadManifestOnly(eCid);
|
||||
Assert.That(basic.Manifest.Protected, Is.False);
|
||||
Assert.That(encoded.Manifest.Protected, Is.True);
|
||||
|
||||
var decoded = clients[1].DownloadContent(eCid);
|
||||
|
||||
file.AssertIsEqual(decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,12 +143,19 @@ namespace CodexReleaseTests.MarketTests
|
||||
|
||||
public ICodexNodeGroup StartClients()
|
||||
{
|
||||
return StartCodex(NumberOfClients, s => s
|
||||
.WithName("client")
|
||||
.EnableMarketplace(GetGeth(), GetContracts(), m => m
|
||||
.WithInitial(StartingBalanceEth.Eth(), StartingBalanceTST.Tst())
|
||||
)
|
||||
);
|
||||
return StartClients(s => { });
|
||||
}
|
||||
|
||||
public ICodexNodeGroup StartClients(Action<ICodexSetup> additional)
|
||||
{
|
||||
return StartCodex(NumberOfClients, s =>
|
||||
{
|
||||
s.WithName("client")
|
||||
.EnableMarketplace(GetGeth(), GetContracts(), m => m
|
||||
.WithInitial(StartingBalanceEth.Eth(), StartingBalanceTST.Tst()));
|
||||
|
||||
additional(s);
|
||||
});
|
||||
}
|
||||
|
||||
public ICodexNode StartValidator()
|
||||
|
||||
@ -187,7 +187,7 @@ namespace AutoClient.Modes.FolderStore
|
||||
try
|
||||
{
|
||||
var request = instance.RequestStorage(new ContentId(entry.BasicCid));
|
||||
entry.EncodedCid = request.Purchase.ContentId.Id;
|
||||
entry.EncodedCid = request.ContentId.Id;
|
||||
entry.PurchaseId = request.PurchaseId;
|
||||
entry.PurchaseFinishedUtc = DateTime.UtcNow + request.Purchase.Duration;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user