debugging image

This commit is contained in:
Ben 2024-03-29 12:07:48 +01:00
parent 8bc63c1fdb
commit 376fd60974
No known key found for this signature in database
GPG Key ID: 541B9D8C9F1426A1
2 changed files with 35 additions and 34 deletions

View File

@ -7,7 +7,7 @@ namespace CodexDiscordBotPlugin
public class DiscordBotContainerRecipe : ContainerRecipeFactory public class DiscordBotContainerRecipe : ContainerRecipeFactory
{ {
public override string AppName => "discordbot-bibliotech"; public override string AppName => "discordbot-bibliotech";
public override string Image => "codexstorage/codex-discordbot:sha-b25c747"; public override string Image => "codexstorage/codex-discordbot:sha-8bc63c1";
public static string RewardsPort = "bot_rewards_port"; public static string RewardsPort = "bot_rewards_port";

View File

@ -10,11 +10,13 @@ using Request = CodexContractsPlugin.Marketplace.Request;
namespace CodexTests.BasicTests namespace CodexTests.BasicTests
{ {
[TestFixture] [TestFixture]
public class ExampleTests : AutoBootstrapDistTest public class ExampleTests : CodexDistTest
{ {
[Test] [Test]
public void BotRewardTest() public void BotRewardTest()
{ {
var myAccount = EthAccount.GenerateNew();
var sellerInitialBalance = 234.TestTokens(); var sellerInitialBalance = 234.TestTokens();
var buyerInitialBalance = 100000.TestTokens(); var buyerInitialBalance = 100000.TestTokens();
var fileSize = 10.MB(); var fileSize = 10.MB();
@ -22,7 +24,37 @@ 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 myAccount = EthAccount.GenerateNew(); // start bot and rewarder
var gethInfo = new DiscordBotGethInfo(
host: geth.Container.GetInternalAddress(GethContainerRecipe.HttpPortTag).Host,
port: geth.Container.GetInternalAddress(GethContainerRecipe.HttpPortTag).Port,
privKey: geth.StartResult.Account.PrivateKey,
marketplaceAddress: contracts.Deployment.MarketplaceAddress,
tokenAddress: contracts.Deployment.TokenAddress,
abi: contracts.Deployment.Abi
);
var bot = Ci.DeployCodexDiscordBot(new DiscordBotStartupConfig(
name: "bot",
token: "aaa",
serverName: "ThatBen's server",
adminRoleName: "bottest-admins",
adminChannelName: "admin-channel",
rewardChannelName: "rewards-channel",
kubeNamespace: "notneeded",
gethInfo: gethInfo
));
var botContainer = bot.Containers.Single();
Ci.DeployRewarderBot(new RewarderBotStartupConfig(
//discordBotHost: "http://" + botContainer.GetAddress(GetTestLog(), DiscordBotContainerRecipe.RewardsPort).Host,
//discordBotPort: botContainer.GetAddress(GetTestLog(), DiscordBotContainerRecipe.RewardsPort).Port,
discordBotHost: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Host,
discordBotPort: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Port,
interval: "60",
historyStartUtc: DateTime.UtcNow.AddHours(-1),
gethInfo: gethInfo,
dataPath: null
));
var numberOfHosts = 3; var numberOfHosts = 3;
for (var i = 0; i < numberOfHosts; i++) for (var i = 0; i < numberOfHosts; i++)
@ -60,37 +92,6 @@ namespace CodexTests.BasicTests
AssertBalance(contracts, buyer, Is.EqualTo(buyerInitialBalance)); AssertBalance(contracts, buyer, Is.EqualTo(buyerInitialBalance));
// start bot and rewarder
var gethInfo = new DiscordBotGethInfo(
host: geth.Container.GetInternalAddress(GethContainerRecipe.HttpPortTag).Host,
port: geth.Container.GetInternalAddress(GethContainerRecipe.HttpPortTag).Port,
privKey: geth.StartResult.Account.PrivateKey,
marketplaceAddress: contracts.Deployment.MarketplaceAddress,
tokenAddress: contracts.Deployment.TokenAddress,
abi: contracts.Deployment.Abi
);
var bot = Ci.DeployCodexDiscordBot(new DiscordBotStartupConfig(
name: "bot",
token: "MTE2NDEyNzk3MDU4NDE3NDU5Mw.GTpoV6.aDR7zxMNf7vDgMjKASJBQs-RtNP_lYJEY-OglI",
serverName: "ThatBen's server",
adminRoleName: "bottest-admins",
adminChannelName: "admin-channel",
rewardChannelName: "rewards-channel",
kubeNamespace: "notneeded",
gethInfo: gethInfo
));
var botContainer = bot.Containers.Single();
Ci.DeployRewarderBot(new RewarderBotStartupConfig(
//discordBotHost: "http://" + botContainer.GetAddress(GetTestLog(), DiscordBotContainerRecipe.RewardsPort).Host,
//discordBotPort: botContainer.GetAddress(GetTestLog(), DiscordBotContainerRecipe.RewardsPort).Port,
discordBotHost: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Host,
discordBotPort: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Port,
interval: "60",
historyStartUtc: DateTime.UtcNow.AddHours(-1),
gethInfo: gethInfo,
dataPath: null
));
var contentId = buyer.UploadFile(testFile); var contentId = buyer.UploadFile(testFile);
var purchase = new StoragePurchaseRequest(contentId) var purchase = new StoragePurchaseRequest(contentId)