diff --git a/CodexDistTestCore/CodexNodeContainer.cs b/CodexDistTestCore/CodexNodeContainer.cs index d9a87be..915a2b4 100644 --- a/CodexDistTestCore/CodexNodeContainer.cs +++ b/CodexDistTestCore/CodexNodeContainer.cs @@ -96,6 +96,7 @@ namespace CodexDistTestCore servicePort: groupContainerFactory.GetNextServicePort(), servicePortName: groupContainerFactory.GetNextServicePortName(), apiPort: codexPortSource.GetNextNumber(), + rpcPort: codexPortSource.GetNextNumber(), containerPortName: $"geth-{n}" ); } diff --git a/CodexDistTestCore/Marketplace/GethCompanionNodeContainer.cs b/CodexDistTestCore/Marketplace/GethCompanionNodeContainer.cs index eeb84ca..a4b452b 100644 --- a/CodexDistTestCore/Marketplace/GethCompanionNodeContainer.cs +++ b/CodexDistTestCore/Marketplace/GethCompanionNodeContainer.cs @@ -4,12 +4,13 @@ namespace CodexDistTestCore.Marketplace { public class GethCompanionNodeContainer { - public GethCompanionNodeContainer(string name, int servicePort, string servicePortName, int apiPort, string containerPortName) + public GethCompanionNodeContainer(string name, int servicePort, string servicePortName, int apiPort, int rpcPort, string containerPortName) { Name = name; ServicePort = servicePort; ServicePortName = servicePortName; ApiPort = apiPort; + RpcPort = rpcPort; ContainerPortName = containerPortName; } @@ -17,6 +18,7 @@ namespace CodexDistTestCore.Marketplace public int ServicePort { get; } public string ServicePortName { get; } public int ApiPort { get; } + public int RpcPort { get; } public string ContainerPortName { get; } public V1Container CreateDeploymentContainer(GethInfo gethInfo) @@ -34,7 +36,19 @@ namespace CodexDistTestCore.Marketplace } }, // todo: use env vars to connect this node to the bootstrap node provided by gethInfo.podInfo & gethInfo.servicePort & gethInfo.genesisJsonBase64 - //Env = dockerImage.CreateEnvironmentVariables(offline, container) + Env = new List + { + new V1EnvVar + { + Name = "GETH_ARGS", + Value = $"--port {ApiPort} --discovery.port {ApiPort} --authrpc.port {RpcPort}" + }, + new V1EnvVar + { + Name = "GENESIS_JSON", + Value = gethInfo.GenesisJsonBase64 + } + } }; } diff --git a/CodexDistTestCore/Marketplace/MarketplaceController.cs b/CodexDistTestCore/Marketplace/MarketplaceController.cs index fd68ade..e832335 100644 --- a/CodexDistTestCore/Marketplace/MarketplaceController.cs +++ b/CodexDistTestCore/Marketplace/MarketplaceController.cs @@ -31,8 +31,12 @@ namespace CodexDistTestCore.Marketplace private void ExtractAccountAndGenesisJson() { - bootstrapAccount = ExecuteCommand("cat", "account_string.txt"); - bootstrapGenesisJson = ExecuteCommand("cat", "genesis.json"); + FetchAccountAndGenesisJson(); + if (string.IsNullOrEmpty(bootstrapAccount) || string.IsNullOrEmpty(bootstrapGenesisJson)) + { + Thread.Sleep(TimeSpan.FromSeconds(15)); + FetchAccountAndGenesisJson(); + } Assert.That(bootstrapAccount, Is.Not.Empty, "Unable to fetch account for bootstrap geth node. Test infra failure."); Assert.That(bootstrapGenesisJson, Is.Not.Empty, "Unable to fetch genesis-json for bootstrap geth node. Test infra failure."); @@ -40,6 +44,12 @@ namespace CodexDistTestCore.Marketplace gethBootstrapNode!.GenesisJsonBase64 = Convert.ToBase64String(Encoding.ASCII.GetBytes(bootstrapGenesisJson)); } + private void FetchAccountAndGenesisJson() + { + bootstrapAccount = ExecuteCommand("cat", "account_string.txt"); + bootstrapGenesisJson = ExecuteCommand("cat", "genesis.json"); + } + private string ExecuteCommand(string command, params string[] arguments) { return k8sManager.ExecuteCommand(gethBootstrapNode!.Pod, K8sGethBoostrapSpecs.ContainerName, command, arguments); diff --git a/Tests/BasicTests/SimpleTests.cs b/Tests/BasicTests/SimpleTests.cs index 0812b78..7763876 100644 --- a/Tests/BasicTests/SimpleTests.cs +++ b/Tests/BasicTests/SimpleTests.cs @@ -34,7 +34,7 @@ namespace Tests.BasicTests [Test] public void MarketplaceExample() { - var primary = SetupCodexNodes(1) + var primary = SetupCodexNodes(4) .WithStorageQuota(10.GB()) .EnableMarketplace(initialBalance: 20) .BringOnline()[0];