Ready for test. Need new bot images
This commit is contained in:
parent
01d6b8f227
commit
b25c747522
@ -21,11 +21,11 @@ namespace DiscordRewards
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
// Finished a sizable slot
|
// Finished a sizable slot
|
||||||
new RewardConfig(1202286218738405418, $"{Tag} finished their first 1GB-24h slot!", new CheckConfig
|
new RewardConfig(1202286218738405418, $"{Tag} finished their first 1GB-24h slot! (10mb/5mins for test)", new CheckConfig
|
||||||
{
|
{
|
||||||
Type = CheckType.FinishedSlot,
|
Type = CheckType.FinishedSlot,
|
||||||
MinSlotSize = 1.GB(),
|
MinSlotSize = 10.MB(),
|
||||||
MinDuration = TimeSpan.FromHours(24.0),
|
MinDuration = TimeSpan.FromMinutes(5.0),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Posted any contract
|
// Posted any contract
|
||||||
@ -41,12 +41,12 @@ namespace DiscordRewards
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
// Started a sizable contract
|
// Started a sizable contract
|
||||||
new RewardConfig(1202286381670608909, $"A large contract created by {Tag} reached Started state for the first time!", new CheckConfig
|
new RewardConfig(1202286381670608909, $"A large contract created by {Tag} reached Started state for the first time! (10mb/5mins for test)", new CheckConfig
|
||||||
{
|
{
|
||||||
Type = CheckType.FinishedSlot,
|
Type = CheckType.StartedContract,
|
||||||
MinNumberOfHosts = 4,
|
MinNumberOfHosts = 4,
|
||||||
MinSlotSize = 1.GB(),
|
MinSlotSize = 10.MB(),
|
||||||
MinDuration = TimeSpan.FromHours(24.0),
|
MinDuration = TimeSpan.FromMinutes(5.0),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ using Request = CodexContractsPlugin.Marketplace.Request;
|
|||||||
namespace CodexTests.BasicTests
|
namespace CodexTests.BasicTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ExampleTests : CodexDistTest
|
public class ExampleTests : AutoBootstrapDistTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void BotRewardTest()
|
public void BotRewardTest()
|
||||||
@ -22,33 +22,39 @@ namespace CodexTests.BasicTests
|
|||||||
var geth = Ci.StartGethNode(s => s.IsMiner().WithName("disttest-geth"));
|
var geth = Ci.StartGethNode(s => s.IsMiner().WithName("disttest-geth"));
|
||||||
var contracts = Ci.StartCodexContracts(geth);
|
var contracts = Ci.StartCodexContracts(geth);
|
||||||
|
|
||||||
var seller = AddCodex(s => s
|
var myAccount = EthAccount.GenerateNew();
|
||||||
.WithName("Seller")
|
var numberOfHosts = 3;
|
||||||
.WithLogLevel(CodexLogLevel.Trace, new CodexLogCustomTopics(CodexLogLevel.Error, CodexLogLevel.Error, CodexLogLevel.Warn)
|
|
||||||
{
|
|
||||||
ContractClock = CodexLogLevel.Trace,
|
|
||||||
})
|
|
||||||
.WithStorageQuota(11.GB())
|
|
||||||
.EnableMarketplace(geth, contracts, m => m
|
|
||||||
.WithInitial(10.Eth(), sellerInitialBalance)
|
|
||||||
.AsStorageNode()
|
|
||||||
.AsValidator()));
|
|
||||||
|
|
||||||
AssertBalance(contracts, seller, Is.EqualTo(sellerInitialBalance));
|
for (var i = 0; i < numberOfHosts; i++)
|
||||||
|
{
|
||||||
|
var seller = AddCodex(s => s
|
||||||
|
.WithName("Seller")
|
||||||
|
.WithLogLevel(CodexLogLevel.Trace, new CodexLogCustomTopics(CodexLogLevel.Error, CodexLogLevel.Error, CodexLogLevel.Warn)
|
||||||
|
{
|
||||||
|
ContractClock = CodexLogLevel.Trace,
|
||||||
|
})
|
||||||
|
.WithStorageQuota(11.GB())
|
||||||
|
.EnableMarketplace(geth, contracts, m => m
|
||||||
|
.WithAccount(myAccount)
|
||||||
|
.WithInitial(10.Eth(), sellerInitialBalance)
|
||||||
|
.AsStorageNode()
|
||||||
|
.AsValidator()));
|
||||||
|
|
||||||
var availability = new StorageAvailability(
|
AssertBalance(contracts, seller, Is.EqualTo(sellerInitialBalance));
|
||||||
totalSpace: 10.GB(),
|
|
||||||
maxDuration: TimeSpan.FromMinutes(30),
|
var availability = new StorageAvailability(
|
||||||
minPriceForTotalSpace: 1.TestTokens(),
|
totalSpace: 10.GB(),
|
||||||
maxCollateral: 20.TestTokens()
|
maxDuration: TimeSpan.FromMinutes(30),
|
||||||
);
|
minPriceForTotalSpace: 1.TestTokens(),
|
||||||
seller.Marketplace.MakeStorageAvailable(availability);
|
maxCollateral: 20.TestTokens()
|
||||||
|
);
|
||||||
|
seller.Marketplace.MakeStorageAvailable(availability);
|
||||||
|
}
|
||||||
|
|
||||||
var testFile = GenerateTestFile(fileSize);
|
var testFile = GenerateTestFile(fileSize);
|
||||||
|
|
||||||
var buyer = AddCodex(s => s
|
var buyer = AddCodex(s => s
|
||||||
.WithName("Buyer")
|
.WithName("Buyer")
|
||||||
.WithBootstrapNode(seller)
|
|
||||||
.EnableMarketplace(geth, contracts, m => m
|
.EnableMarketplace(geth, contracts, m => m
|
||||||
.WithInitial(10.Eth(), buyerInitialBalance)));
|
.WithInitial(10.Eth(), buyerInitialBalance)));
|
||||||
|
|
||||||
@ -85,11 +91,6 @@ namespace CodexTests.BasicTests
|
|||||||
dataPath: null
|
dataPath: null
|
||||||
));
|
));
|
||||||
|
|
||||||
var sellerAddress = seller.EthAddress;
|
|
||||||
var buyerAddress = buyer.EthAddress;
|
|
||||||
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
var contentId = buyer.UploadFile(testFile);
|
var contentId = buyer.UploadFile(testFile);
|
||||||
|
|
||||||
var purchase = new StoragePurchaseRequest(contentId)
|
var purchase = new StoragePurchaseRequest(contentId)
|
||||||
@ -107,20 +108,22 @@ namespace CodexTests.BasicTests
|
|||||||
|
|
||||||
purchaseContract.WaitForStorageContractStarted();
|
purchaseContract.WaitForStorageContractStarted();
|
||||||
|
|
||||||
AssertBalance(contracts, seller, Is.LessThan(sellerInitialBalance), "Collateral was not placed.");
|
//AssertBalance(contracts, seller, Is.LessThan(sellerInitialBalance), "Collateral was not placed.");
|
||||||
|
|
||||||
var blockRange = geth.ConvertTimeRangeToBlockRange(GetTestRunTimeRange());
|
//var blockRange = geth.ConvertTimeRangeToBlockRange(GetTestRunTimeRange());
|
||||||
|
|
||||||
var request = GetOnChainStorageRequest(contracts, blockRange);
|
//var request = GetOnChainStorageRequest(contracts, blockRange);
|
||||||
AssertStorageRequest(request, purchase, contracts, buyer);
|
//AssertStorageRequest(request, purchase, contracts, buyer);
|
||||||
AssertSlotFilledEvents(contracts, purchase, request, seller, blockRange);
|
//AssertSlotFilledEvents(contracts, purchase, request, seller, blockRange);
|
||||||
AssertContractSlot(contracts, request, 0, seller);
|
//AssertContractSlot(contracts, request, 0, seller);
|
||||||
|
|
||||||
purchaseContract.WaitForStorageContractFinished();
|
purchaseContract.WaitForStorageContractFinished();
|
||||||
|
|
||||||
AssertBalance(contracts, seller, Is.GreaterThan(sellerInitialBalance), "Seller was not paid for storage.");
|
var hold = 0;
|
||||||
AssertBalance(contracts, buyer, Is.LessThan(buyerInitialBalance), "Buyer was not charged for storage.");
|
|
||||||
Assert.That(contracts.GetRequestState(request), Is.EqualTo(RequestState.Finished));
|
//AssertBalance(contracts, seller, Is.GreaterThan(sellerInitialBalance), "Seller was not paid for storage.");
|
||||||
|
//AssertBalance(contracts, buyer, Is.LessThan(buyerInitialBalance), "Buyer was not charged for storage.");
|
||||||
|
//Assert.That(contracts.GetRequestState(request), Is.EqualTo(RequestState.Finished));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user