diff --git a/eng/pipelines/live-test-cleanup-template.yml b/eng/pipelines/live-test-cleanup-template.yml index b4348bc36df7..263d23f2c4a9 100644 --- a/eng/pipelines/live-test-cleanup-template.yml +++ b/eng/pipelines/live-test-cleanup-template.yml @@ -45,3 +45,19 @@ steps: env: PoolSubnet: $(PoolSubnet) + - task: AzurePowerShell@5 + displayName: ${{ parameters.DisplayName }} + inputs: + azureSubscription: ${{ parameters.CloudConfig.ServiceConnection }} + azurePowerShellVersion: LatestVersion + pwsh: true + ScriptType: InlineScript + Inline: >- + . ./eng/common/TestResources/SubConfig-Helpers.ps1 + $serviceDirectoryPrefix = BuildServiceDirectoryPrefix ${{ parameters.ServiceDirectory }}; + $account = (Get-AzContext).Account; + $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id; + $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants; + [Environment]::SetEnvironmentVariable("${serviceDirectoryPrefix}CLIENT_ID", $account.Id); + [Environment]::SetEnvironmentVariable("${serviceDirectoryPrefix}TENANT_ID", $account.Tenants); + diff --git a/tools/stress-cluster/chaos/README.md b/tools/stress-cluster/chaos/README.md index 521cadd22b79..b58eb3601694 100644 --- a/tools/stress-cluster/chaos/README.md +++ b/tools/stress-cluster/chaos/README.md @@ -147,8 +147,6 @@ The usage of helm charts allows for two primary scenarios: - Stress tests can easily take dependencies on core configuration and templates required to interact with the cluster - Stress tests can easily be deployed and removed via the `helm` command line tool. -**To quickly bootstrap a stress test package configuration, see the [stress test generator](https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/cluster/kubernetes/generator/README.md)** - ### Layout The basic layout for a stress test is the following (see [`examples/stress_deployment_example`](https://github.com/Azure/azure-sdk-tools/tree/main/tools/stress-cluster/chaos/examples/stress-deployment-example) for an example): diff --git a/tools/stress-cluster/cluster/kubernetes/generator/README.md b/tools/stress-cluster/cluster/kubernetes/generator/README.md deleted file mode 100644 index 06bb945c3293..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/README.md +++ /dev/null @@ -1,8 +0,0 @@ -This is a stress test package, used for deploying and testing Azure SDKs in real world scenarios. -Docs: https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/chaos/README.md - -Examples: - - https://github.com/Azure/azure-sdk-tools/tree/main/tools/stress-cluster/chaos/examples - - https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub/stress - - https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus/test/stress - - https://github.com/Azure/azure-sdk-for-net/tree/feature/storage/chaos-testing-prototype/sdk/storage/chaos diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/GeneratorTest.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/GeneratorTest.cs deleted file mode 100644 index a039d3c16c75..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/GeneratorTest.cs +++ /dev/null @@ -1,301 +0,0 @@ -using System; -using System.Collections.Generic; -using Xunit; -using FluentAssertions; - -namespace Stress.Generator.Tests -{ - public class TestPrompter : IPrompter - { - public Queue PromptValues; - - public TestPrompter() - { - PromptValues = new Queue(); - } - - public void SetResponse(List promptValues) - { - PromptValues = new Queue(); - AddResponse(promptValues); - } - - public void AddResponse(List promptValues) - { - for (var i = 0; i < promptValues.Count; i++) - { - PromptValues.Enqueue(promptValues[i]); - if (i == promptValues.Count - 1) - { - PromptValues.Enqueue("n"); - } - else - { - PromptValues.Enqueue("y"); - } - } - } - - public void SetResponse(string promptValue) - { - PromptValues = new Queue(); - AddResponse(promptValue); - } - - public void AddResponse(string promptValue) - { - PromptValues.Enqueue(promptValue); - } - - public string Prompt() - { - var response = PromptValues.Dequeue(); - Console.WriteLine($"{response} <-- test prompter"); - return response; - } - } - - public class GeneratorTests - { - [Fact] - public void TestPrompt() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.SetResponse("stringvalue"); - generator.Prompt().Should().Be("stringvalue"); - - prompter.SetResponse("1.5"); - generator.Prompt().Should().Be(1.5); - prompter.SetResponse("1"); - generator.Prompt().Should().Be(1); - - prompter.SetResponse("true"); - generator.Prompt().Should().Be(true); - prompter.SetResponse("false"); - generator.Prompt().Should().Be(false); - - prompter.SetResponse("itemvalue1 itemvalue2 itemvalue3"); - List list = generator.PromptList(); - list.Count.Should().Be(3); - list[0].Should().Be("itemvalue1"); - list[1].Should().Be("itemvalue2"); - list[2].Should().Be("itemvalue3"); - } - - [Fact] - public void TestGenerateResource() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - // Test resource name selection - prompter.AddResponse("bash -c sleep 3600"); - prompter.AddResponse("true"); - - var resource = generator.GenerateResource(); - resource.Command.Should().Equal(new List{"bash", "-c", "sleep", "3600"}); - resource.ChaosEnabled.Should().Be(true); - } - - [Fact] - public void TestGenerateOptionalResource() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.AddResponse("bing.com"); - prompter.AddResponse("to"); - prompter.AddResponse("n"); - prompter.AddResponse("n"); - prompter.AddResponse("LossAction"); - prompter.AddResponse("0.5"); - prompter.AddResponse("y"); - prompter.AddResponse("0.2"); - prompter.AddResponse("n"); - - NetworkChaos resource = generator.GenerateResource(); - resource.ExternalTargets.Should().Equal(new List{"bing.com"}); - resource.Action.Should().BeAssignableTo(); - var loss = resource.Action as NetworkChaos.LossAction; - loss.Loss.Should().Be(0.5); - loss.Correlation.Should().Be(0.2); - } - - [Fact] - public void TestMultipleChoiceWithIntSelection() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.AddResponse("TestStressPackage"); - prompter.AddResponse("TestStressNamespace"); - prompter.AddResponse("0"); - prompter.AddResponse("bash -c sleep 3600"); - prompter.AddResponse("true"); - prompter.AddResponse("n"); - - var package = generator.GenerateResource(); - package.Resources.Count.Should().Be(1); - - var job = package.Resources[0] as JobWithoutAzureResourceDeployment; - job.Name.Should().Be("TestStressPackage"); - job.Command.Should().Equal(new List{"bash", "-c", "sleep", "3600"}); - job.ChaosEnabled.Should().Be(true); - } - - [Fact] - public void TestGenerateInvalidValueRetry() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.AddResponse("bing.com"); - prompter.AddResponse("to"); - prompter.AddResponse("n"); - prompter.AddResponse("n"); - prompter.AddResponse("LossAction"); - prompter.AddResponse("invalid1"); - prompter.AddResponse("invalid2"); - prompter.AddResponse("0.5"); - prompter.AddResponse("invalidOptional1"); - prompter.AddResponse("invalidOptional2"); - prompter.AddResponse("y"); - prompter.AddResponse("0.2"); - prompter.AddResponse("n"); - - NetworkChaos resource = generator.GenerateResource(); - resource.ExternalTargets.Should().Equal(new List{"bing.com"}); - resource.Action.Should().BeAssignableTo(); - var loss = resource.Action as NetworkChaos.LossAction; - loss.Loss.Should().Be(0.5); - loss.Correlation.Should().Be(0.2); - } - - [Fact] - public void TestGenerateInvalidMultipleChoiceRetry() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.AddResponse("TestStressPackage"); - prompter.AddResponse("TestStressNamespace"); - prompter.AddResponse("invalid1"); - prompter.AddResponse("invalid2"); - prompter.AddResponse("999"); - prompter.AddResponse("-1"); - prompter.AddResponse(nameof(JobWithoutAzureResourceDeployment)); - prompter.AddResponse("bash -c sleep 3600"); - prompter.AddResponse("invalidBool1"); - prompter.AddResponse("invalidBool2"); - prompter.AddResponse("true"); - prompter.AddResponse("invalidOptional1"); - prompter.AddResponse("n"); - - var package = generator.GenerateResource(); - package.Resources.Count.Should().Be(1); - package.Name.Should().Be("TestStressPackage"); - package.Namespace.Should().Be("TestStressNamespace"); - - var job = package.Resources[0] as JobWithoutAzureResourceDeployment; - job.Name.Should().Be("TestStressPackage"); - job.Command.Should().Equal(new List{"bash", "-c", "sleep", "3600"}); - job.ChaosEnabled.Should().Be(true); - } - - [Fact] - public void TestGeneratePackage() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.AddResponse("TestStressPackage"); - prompter.AddResponse("TestStressNamespace"); - prompter.AddResponse(nameof(JobWithoutAzureResourceDeployment)); - // Command - prompter.AddResponse("bash -c sleep 3600"); - // Enable chaos - prompter.AddResponse("true"); - // Another resource - prompter.AddResponse("y"); - prompter.AddResponse(nameof(NetworkChaos)); - // External target - prompter.AddResponse("bing.com"); - // Packet Direction - prompter.AddResponse("to"); - // Schedule - prompter.AddResponse("y"); - prompter.AddResponse("@every 30s"); - // Duration - prompter.AddResponse("y"); - prompter.AddResponse("12s"); - // Network Action Type - prompter.AddResponse("LossAction"); - prompter.AddResponse("0.5"); - prompter.AddResponse("n"); - prompter.AddResponse("n"); - - var package = generator.GenerateResource(); - package.Resources.Count.Should().Be(2); - package.Name.Should().Be("TestStressPackage"); - package.Namespace.Should().Be("TestStressNamespace"); - - var job = package.Resources[0] as JobWithoutAzureResourceDeployment; - job.Name.Should().Be("TestStressPackage"); - job.Command.Should().Equal(new List{"bash", "-c", "sleep", "3600"}); - job.ChaosEnabled.Should().Be(true); - - var chaos = package.Resources[1] as NetworkChaos; - chaos.Name.Should().Be("TestStressPackage"); - chaos.ExternalTargets.Should().Equal(new List{"bing.com"}); - chaos.Action.Should().BeAssignableTo(); - - var loss = chaos.Action as NetworkChaos.LossAction; - loss.Loss.Should().Be(0.5); - loss.Correlation.Should().BeNull(); - } - - [Fact] - public void TestGenerateNestedResources() - { - var prompter = new TestPrompter(); - var generator = new Generator(prompter); - - prompter.AddResponse("TestStressPackage"); - prompter.AddResponse("TestStressNamespace"); - prompter.AddResponse(nameof(NetworkChaos)); - prompter.AddResponse("bing.com"); - prompter.AddResponse("to"); - prompter.AddResponse("n"); - prompter.AddResponse("n"); - prompter.AddResponse("DelayAction"); - prompter.AddResponse("50ms"); - prompter.AddResponse("n"); - prompter.AddResponse("n"); - prompter.AddResponse("y"); - prompter.AddResponse("2"); - prompter.AddResponse("0.5"); - prompter.AddResponse("n"); - prompter.AddResponse("n"); - - var package = generator.GenerateResource(); - - var chaos = package.Resources[0] as NetworkChaos; - chaos.Name.Should().Be("TestStressPackage"); - chaos.ExternalTargets.Should().Equal(new List{"bing.com"}); - chaos.Action.Should().BeAssignableTo(); - - var delay = chaos.Action as NetworkChaos.DelayAction; - - delay.Latency.Should().Be("50ms"); - delay.Correlation.Should().BeNull(); - delay.Jitter.Should().BeNull(); - - delay.Reorder.Should().BeAssignableTo(); - delay.Reorder.Gap.Should().Be(2); - delay.Reorder.Reorder.Should().Be(0.5); - delay.Reorder.Correlation.Should().BeNull(); - } - } -} diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/ResourceTest.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/ResourceTest.cs deleted file mode 100644 index 968c35271eb3..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/ResourceTest.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Xunit; -using FluentAssertions; - -namespace Stress.Generator.Tests -{ - public class ResourceTests - { - [Fact] - public void TestRender() - { - var template = -@"name: (( Name )) -command: (( Command )) -chaos: (( ChaosEnabled ))"; - - var job = new JobWithoutAzureResourceDeployment{ - Name = "TestJob", - Command = new List{"sleep", "infinity"}, - ChaosEnabled = true, - Template = template - }; - - job.Render(); - var lines = job.Rendered.ToList(); - lines.Count().Should().Be(3); - lines[0].Should().Be("name: TestJob"); - lines[1].Should().Be("command: [\"sleep\",\"infinity\"]"); - lines[2].Should().Be("chaos: true"); - } - - [Fact] - public void TestRenderUnsetProperty() - { - var template = -@"name: (( Name )) -command: (( Command )) -chaos: (( ChaosEnabled ))"; - - var job = new JobWithoutAzureResourceDeployment{ - Name = "TestJob", - ChaosEnabled = true, - Template = template - }; - - Action act = () => job.Render(); - - job.Render(); - var lines = job.Rendered.ToList(); - lines.Count().Should().Be(2); - lines[0].Should().Be("name: TestJob"); - lines[1].Should().Be("chaos: true"); - } - - [Fact] - public void TestRenderMissingPropertyShouldFail() - { - var template = -@"name: (( Name )) -na: (( DoesNotExist ))"; - - var job = new JobWithoutAzureResourceDeployment{ - Name = "TestJob", - Template = template - }; - - Action act = () => job.Render(); - act.Should().Throw(); - } - - - [Fact] - public void TestRenderMultiplePropertiesSameLine() - { - var template = -@"name: (( TemplateInclude )).(( Name )) -chaos: (( ChaosEnabled ))"; - - var job = new JobWithoutAzureResourceDeployment{ - Name = "TestJob", - ChaosEnabled = true, - Template = template - }; - - job.Render(); - var lines = job.Rendered.ToList(); - lines.Count().Should().Be(2); - lines[0].Should().Be("name: env-job-template.TestJob"); - lines[1].Should().Be("chaos: true"); - } - - [Fact] - public void TestRenderNestedProperties() - { - var template = -@"name: (( Name )) -(( Action )) -"; - var net = new NetworkChaos{ - Name = "TestNetworkChaos", - Action = new NetworkChaos.DelayAction{ - Latency = "50ms", - Reorder = new NetworkChaos.ReorderSpec{ - Gap = 1, - Reorder = 0.2, - } - }, - Template = template - }; - - net.Render(); - var lines = net.Rendered.ToList(); - lines.Count().Should().Be(2); - lines[0].Should().Be("name: TestNetworkChaos"); - - var delayRender = lines[1].Split('\n'); - delayRender.Count().Should().Be(8); - delayRender[0].Should().StartWith(" #"); - delayRender[1].Should().Be(" action: delay"); - delayRender[2].Should().Be(" delay:"); - delayRender[3].Should().Be(" latency: 50ms"); - delayRender[4].Should().StartWith(" #"); - delayRender[5].Should().Be(" reorder:"); - delayRender[6].Should().Be(" gap: 1"); - delayRender[7].Should().Be(" reorder: 0.2"); - } - } -} \ No newline at end of file diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/Stress.Generator.Tests.csproj b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/Stress.Generator.Tests.csproj deleted file mode 100644 index 6d7a3740c2ef..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator.Tests/Stress.Generator.Tests.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - net6.0 - - false - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Generator.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Generator.cs deleted file mode 100644 index 8f77afadb214..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Generator.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace Stress.Generator -{ - public class Generator - { - public IPrompter Prompter; - - public Generator() - { - Prompter = new Prompter(); - } - - public Generator(IPrompter prompter) - { - Prompter = prompter; - } - - public T GenerateResource() - where T : IResource - { - var resource = PrompSetResourceProperties(typeof(T)); - resource.Render(); - return (T)resource; - } - - public IResource PrompSetResourceProperties(Type resourceType) - { - var resource = Activator.CreateInstance(resourceType) as IResource; - if (resource == null) - { - throw new NullReferenceException(); - } - - foreach (var prop in resource.Properties()) - { - PromptSetProperty(resource, prop.Info, prop.Property.Help); - } - - foreach (var prop in resource.OptionalProperties()) - { - PromptSetOptionalProperty(resource, prop); - } - - foreach (var prop in resource.NestedProperties()) - { - PromptSetNestedProperties(resource, prop); - } - - foreach (var prop in resource.OptionalNestedProperties()) - { - PromptSetOptionalNestedProperty(resource, prop); - } - - return resource; - } - - public void PromptSetOptionalProperty(IResource resource, ResourcePropertyInfo prop) - { - var set = ""; - while (set != "y" && set != "n") - { - set = Prompt($"Set a value for optional property {prop.Info.Name}? (y/n): "); - } - if (set == "y") - { - PromptSetProperty(resource, prop.Info, prop.Property.Help); - } - } - - public void PromptSetProperty(IResource resource, PropertyInfo prop, string help) - { - Console.WriteLine($"--> {prop.Name} ({help})"); - - var propType = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType; - - if (propType == typeof(string)) - { - resource.SetProperty(prop, Prompt($"(string): ")); - } - else if (propType == typeof(double)) - { - resource.SetProperty(prop, Prompt($"(number): ")); - } - else if (propType == typeof(int)) - { - resource.SetProperty(prop, Prompt($"(number): ")); - } - else if (propType == typeof(bool)) - { - resource.SetProperty(prop, Prompt($"(true/false): ")); - } - else if (propType == typeof(List)) - { - resource.SetProperty(prop, PromptList($"(list item string): ")); - } - else - { - throw new Exception($"Unsupported value type: {prop.PropertyType.Name}"); - } - } - - public void PromptSetNestedProperties( - IResource resource, - ResourcePropertyInfo prop - ) { - if (prop.Info.PropertyType.IsAssignableTo(typeof(IList))) - { - var nestedList = new List(); - Action action = () => nestedList.Add(PromptGetNestedProperty(resource, prop)); - PromptMultiple(action, "Enter another resource?"); - resource.SetProperty(prop.Info, nestedList); - } else { - var nested = PromptGetNestedProperty(resource, prop); - resource.SetProperty(prop.Info, nested); - } - } - - public IResource PromptGetNestedProperty( - IResource resource, - ResourcePropertyInfo prop - ) { - var resourceTypeMap = prop.Property.Types.ToDictionary(t => t.Name, t => t); - var resourceTypeHelp = prop.Property.Types.Select(t => - { - var r = Activator.CreateInstance(t) as IResource; - return r?.Help ?? ""; - }).ToList(); - - Type? resourceType = null; - while (resourceType == null) - { - var selection = ""; - if (resourceTypeMap.Count == 1) - { - selection = resourceTypeMap.Keys.First(); - } - else - { - selection = PromptMultipleChoice(resourceTypeMap.Keys.ToList(), resourceTypeHelp, prop.Property.Help); - } - resourceTypeMap.TryGetValue(selection, out resourceType); - } - - var nestedResource = PrompSetResourceProperties(resourceType); - return nestedResource; - } - - public void PromptSetOptionalNestedProperty( - IResource resource, - ResourcePropertyInfo prop - ) { - var set = ""; - while (set != "y" && set != "n") - { - set = Prompt($"Set a value for optional property {prop.Info.Name}? (y/n): "); - } - if (set == "y") - { - var nestedProp = new ResourcePropertyInfo( - prop.Info, prop.Property.AsNestedResourceProperty()); - PromptSetNestedProperties(resource, nestedProp); - } - } - - private List PadStrings(IEnumerable left) - { - var leftSize = left.OrderBy(s => s.Length).Last().Length; - return left.Select(s => s + new string(' ', leftSize - s.Length)).ToList(); - } - - public string PromptMultipleChoice(List options, List help, string promptMessage) - { - if (options.Count != help.Count) - { - throw new Exception("Expected multiple choice options to be the same length as options help."); - } - - var padded = PadStrings(options); - var selected = ""; - - while (string.IsNullOrEmpty(selected)) - { - Console.WriteLine(promptMessage); - for (int i = 0; i < padded.Count; i++) - { - Console.WriteLine($" ({i}) {padded[i]} - {help[i]}"); - } - - var optionSelection = Prompt(); - if (uint.TryParse(optionSelection, out var idx) && idx < options.Count) - { - optionSelection = options[(int)idx]; - } - selected = options.Find(o => o == optionSelection); - } - - return selected; - } - - public List PromptList(string promptMessage = "(list item value):") - { - return Prompt("(space separated list): ").Split(' ').ToList(); - } - - public T Prompt(string promptMessage = "(value): ") - { - var retryMessage = $"Invalid value, expected {typeof(T)}: "; - Console.Write(promptMessage); - var value = Prompter.Prompt(); - - if (typeof(T) == typeof(string)) - { - return (T)(object)value; - } - - if (typeof(T) == typeof(double)) - { - if (!double.TryParse(value, out double parsed)) - { - return Prompt(retryMessage); - } - return (T)(object)parsed; - } - - if (typeof(T) == typeof(int)) - { - if (!int.TryParse(value, out int parsed)) - { - return Prompt(retryMessage); - } - return (T)(object)parsed; - } - - if (typeof(T) == typeof(bool)) - { - if (!bool.TryParse(value, out bool parsed)) - { - return Prompt(retryMessage); - } - return (T)(object)parsed; - } - - throw new Exception($"Unsupported value {typeof(T)}"); - } - - public void PromptMultiple(Action promptAction, string message) - { - var another = "y"; - while (true) - { - if (another == "n") - { - break; - } - else if (another == "y") - { - promptAction(); - } - - Console.Write(message + " (y/n): "); - another = Prompter.Prompt(); - } - } - } -} diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Program.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Program.cs deleted file mode 100644 index dc2f26cc529d..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Program.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using CommandLine; - -namespace Stress.Generator -{ - public class Program - { - public class Options - { - [Option('d', "directory", Required = false, HelpText = "Output directory for stress test.")] - public string OutputDirectory { get; set; } = Directory.GetCurrentDirectory(); - } - - public static void Main(string[] args) - { - Parser.Default.ParseArguments(args).WithParsed(o => - { - Console.WriteLine("This program will help generate a stress test package."); - Console.WriteLine("CAUTION: This program may overwrite existing files."); - - var outdir = Path.GetFullPath(o.OutputDirectory); - - var generator = new Generator(); - var package = generator.GenerateResource(); - - if (!Directory.Exists(outdir)) - { - Directory.CreateDirectory(outdir); - } - Directory.SetCurrentDirectory(outdir); - - foreach (var f in Directory.GetFiles(outdir)) - { - Console.WriteLine(f); - } - - package.Write(); - - Console.WriteLine($"********************************************************************************"); - Console.WriteLine($"Stress test package created at {outdir}. See README.md in that directory for more help."); - Console.WriteLine($"Next steps:"); - Console.WriteLine($"1. Install stress test development tools: https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/chaos/README.md#installation"); - Console.WriteLine($"2. Add test code to ./src/"); - Console.WriteLine($"3. Update 'Dockerfile' (see contents for help)."); - Console.WriteLine($"4. Run the following command from within your language repository to deploy the package:"); - Console.WriteLine($" pwsh -c $(git rev-parse --show-toplevel)/eng/common/scripts/stress-testing/deploy-stress-tests.ps1"); - Console.WriteLine($"********************************************************************************"); - }); - } - } -} diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Prompter.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Prompter.cs deleted file mode 100644 index c6d35ddcbbeb..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Prompter.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Stress.Generator -{ - public interface IPrompter - { - public string Prompt(); - } - - public class Prompter : IPrompter - { - public string Prompt() - { - return Console.ReadLine() ?? ""; - } - } -} \ No newline at end of file diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/ResourceProperty.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/ResourceProperty.cs deleted file mode 100644 index e0a46352559a..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/ResourceProperty.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Reflection; - -namespace Stress.Generator -{ - public interface IResourceProperty - { - public string Help { get; set; } - } - - public abstract class BaseResourceProperty : Attribute, IResourceProperty - { - public string Help { get; set; } - - public BaseResourceProperty(string help) - { - this.Help = help; - } - } - - public class ResourceProperty : BaseResourceProperty - { - public ResourceProperty(string help) : base(help) {} - } - - public class OptionalResourceProperty : BaseResourceProperty - { - public OptionalResourceProperty(string help) : base(help) {} - } - - public class NestedResourceProperty : BaseResourceProperty - { - public Type[] Types { get; set; } - - public bool Multiple = false; - - public NestedResourceProperty(string help, Type[] types) : base(help) - { - Types = types; - foreach (var t in Types) - { - // TODO: is there a way to compile check for this? - if (!t.IsAssignableTo(typeof(IResource))) - { - throw new Exception("NestedResourceProperty type array items must implement IResource"); - } - } - } - } - - public class OptionalNestedResourceProperty : BaseResourceProperty - { - public Type[] Types { get; set; } - - public NestedResourceProperty AsNestedResourceProperty() - { - return new NestedResourceProperty(Help, Types); - } - - public OptionalNestedResourceProperty(string help, Type[] types) : base(help) - { - Types = types; - } - } -} \ No newline at end of file diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/ResourcePropertyInfo.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/ResourcePropertyInfo.cs deleted file mode 100644 index c11f521fc1c4..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/ResourcePropertyInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Reflection; - -namespace Stress.Generator -{ - public class ResourcePropertyInfo - { - public PropertyInfo Info; - public T Property; - - public ResourcePropertyInfo(PropertyInfo info, T property) - { - Info = info; - Property = property; - } - } -} \ No newline at end of file diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Chaos/NetworkChaos.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Chaos/NetworkChaos.cs deleted file mode 100644 index 8cf2b0b9b747..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Chaos/NetworkChaos.cs +++ /dev/null @@ -1,211 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace Stress.Generator -{ - // This class is a type wrapper around the chaos-mesh networkchaos type: - // https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes - // https://github.com/chaos-mesh/chaos-mesh/blob/master/api/v1alpha1/networkchaos_types.go - public class NetworkChaos : Resource, IResource - { - public const string NetworkChaosDocSite = "https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes"; - - public abstract class NetworkChaosAction : Resource, IResource - { - public override string ToString() - { - return GetType().Name.Replace("Action", "").ToLower(); - } - } - - public class LossAction : NetworkChaosAction - { - public override string Help { get; set; } = $"Configuration for network loss. See {NetworkChaosDocSite}/#loss"; - - public override string Template { get; set; } = @" - # (( Help )) - action: loss - loss: - loss: (( Loss )) - correlation: (( Correlation )) -"; - - [ResourceProperty("Probability of packet loss, e.g. '0.5'.")] - public double Loss { get; set; } - - [OptionalResourceProperty("Correlation between the current loss and the previous one, e.g. '0.5'.")] - public double? Correlation { get; set; } - } - - public class DelayAction : NetworkChaosAction { - public override string Help { get; set; } = $"Configuration for packet delay. See {NetworkChaosDocSite}/#delay"; - - public override string Template { get; set; } = @" - # (( Help )) - action: delay - delay: - latency: (( Latency )) - correlation: (( Correlation )) - jitter: (( Jitter )) -(( Reorder )) -"; - - [ResourceProperty("Network latency, e.g. '50ms'")] - public string? Latency { get; set; } - - [OptionalResourceProperty("Correlation between the current latency and the previous one, e.g. '0.5'.")] - public double? Correlation { get; set; } - - [OptionalResourceProperty("Range of the network latency.")] - public double? Jitter { get; set; } - - [OptionalNestedResourceProperty("Network packet reordering.", new Type[]{typeof(ReorderSpec)})] - public ReorderSpec? Reorder { get; set; } - } - - public class ReorderSpec : Resource, IResource - { - public override string Help { get; set; } = $"Configuration for packet reordering. See {NetworkChaosDocSite}/#reorder"; - - public override string Template { get; set; } = @" - # (( Help )) - reorder: - gap: (( Gap )) - reorder: (( Reorder )) - correlation: (( Correlation )) -"; - - [ResourceProperty("Gap before and after packet reordering.")] - public int Gap { get; set; } - - [ResourceProperty("Probability of packet re-ordering.")] - public double Reorder { get; set; } - - [OptionalResourceProperty("Correlation between the current re-order and the previous one, e.g. '0.5'.")] - public double? Correlation { get; set; } - } - - public class DuplicateAction : NetworkChaosAction { - public override string Help { get; set; } = $"Configuration for packet duplication. See {NetworkChaosDocSite}/#duplicate"; - - public override string Template { get; set; } = @" - # (( Help )) - action: duplicate - duplicate: - duplicate: (( Duplicate )) - correlation: (( Correlation )) -"; - - [ResourceProperty("Probability of packet duplication, e.g. '0.5'.")] - public string? Duplicate { get; set; } - - [OptionalResourceProperty("Correlation between the current duplication and the previous one, e.g. '0.5'.")] - public string? Correlation { get; set; } - } - - public class CorruptAction : NetworkChaosAction { - public override string Help { get; set; } = $"Configuration for packet corruption. See {NetworkChaosDocSite}/#corrupt"; - - public override string Template { get; set; } = @" - # (( Help )) - action: corrupt - corrupt: - corrupt: (( Corrupt )) - correlation: (( Correlation )) -"; - - [ResourceProperty("Probability of packet corruption, e.g. '0.5'.")] - public string? Corrupt { get; set; } - - [OptionalResourceProperty("Correlation between the current corruption and the previous one, e.g. '0.5'.")] - public string? Correlation { get; set; } - } - - public class BandwidthAction : NetworkChaosAction { - public override string Help { get; set; } = $"Configuration for bandwidth restriction. See {NetworkChaosDocSite}/#bandwidth"; - - public override string Template { get; set; } = @" - # (( Help )) - action: bandwidth - bandwidth: - rate: (( Rate )) - limit: (( Limit )) - peakrate: (( PeakRate )) - minburst: (( MinBurst )) -"; - - [ResourceProperty("Rate of bandwidth limit, e.g. '1mbps'. Available units: bps, kbps, mbps, gpbs, tpbs (bytes per second).")] - public string? Rate { get; set; } - - [ResourceProperty("Number of bytes that can be queued (minimum 1).")] - public int Limit { get; set; } - - [ResourceProperty("Max bytes that can be sent simultaneously (minimum 1).")] - public int Buffer { get; set; } - - [OptionalResourceProperty("Max consumption of bucket. set if perfect millescond timescale shaping is needed.")] - public int? PeakRate { get; set; } - - [OptionalResourceProperty("Size of peakrate bucket.")] - public int? MinBurst { get; set; } - } - - public static Dictionary DD { get; set; } = new Dictionary(); - - public override string Template { get; set; } = @" -# (( Help )) -apiVersion: chaos-mesh.org/v1alpha1 -kind: NetworkChaos -metadata: - name: '(( Name ))-{{ .Release.Name }}-{{ .Release.Revision }}' - namespace: {{ .Release.Namespace }} -spec: - scheduler: - cron: '(( Schedule ))' - duration: '(( Duration ))' - selector: - labelSelectors: - # This label must match the testInstance label of the pod(s) to target chaos against. - testInstance: '(( Name ))-{{ .Release.Name }}-{{ .Release.Revision }}' - chaos: 'true' - namespaces: - - {{ .Release.Namespace }} - direction: (( Direction )) - externalTargets: (( ExternalTargets )) - mode: all # target all matching pods -(( Action )) -"; - - public override string Help { get; set; } = "Configuration for network chaos. See https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/"; - - public string? Name { get; set; } - - [ResourceProperty("A list of domains/CNAME records to apply network chaos to/from, for example 'servicebus.windows.net'")] - public List? ExternalTargets { get; set; } - - [ResourceProperty("Packet direction. Options: 'to', 'from', 'both'")] - public string? Direction { get; set; } - - [OptionalResourceProperty("Frequency with which the network chaos should run, e.g. '@every 30s' or a valid cron expression. See also https://chaos-mesh.org/docs/define-scheduling-rules/#schedule-field")] - public string? Schedule { get; set; } - - [OptionalResourceProperty("Duration of the network chaos, e.g. '12s'. Set this if a cron schedule has been set")] - public string? Duration { get; set; } - - [NestedResourceProperty( - "Type of network chaos.", - new Type[]{typeof(LossAction), typeof(DelayAction), typeof(DuplicateAction), typeof(CorruptAction), typeof(BandwidthAction)} - )] - public NetworkChaosAction? Action { get; set; } - - public override void Write() - { - Write(Path.Join("templates", $"{Name}-network-{Action}.yaml")); - } - - public NetworkChaos() : base() - { - } - } -} diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Job.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Job.cs deleted file mode 100644 index 2f3e1aab4678..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Job.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace Stress.Generator -{ - public abstract class BaseJob : Resource - { - public override string Template { get; set; } = @" -# This template includes the `metadata` and `spec` fields from the kubernetes Pod schema: -# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#pod-v1-core -# When rendered by helm, the values here will be embedded within a kubernetes Job manifest. -# https://kubernetes.io/docs/concepts/workloads/controllers/job/ -{{- include 'stress-test-addons.(( TemplateInclude )).from-pod' (list . 'stress.(( Name ))') -}} -{{- define 'stress.(( Name ))' -}} -metadata: - labels: - # Only pods with a `chaos` label will work with chaos resources and services that require this selector. - chaos: (( ChaosEnabled )) - # The testInstance label should also be defined for any chaos resources that need to target this pod. - testInstance: '(( Name ))-{{ .Release.Name }}-{{ .Release.Revision }}' - # testName allows for consistent querying across test instances via - # kubectl commands (e.g. `kubectl logs -l testName=(( Name )) -n ) - testName: (( Name )) -spec: - containers: - - name: (( Name )) - command: (( Command )) - imagePullPolicy: Always - # Only override this if needed for local development, otherwise it will be calculated by deployment scripts. - image: {{ default '' .Values.repository }}/(( ImageName )):{{ default 'v1' .Values.tag }} - {{- include 'stress-test-addons.container-env' . | nindent 6 }} -{{- end -}} -"; - - public string ImageName { get; set; } - - public string? Name { get; set; } - - [ResourceProperty("Container command. If using multiple scenarios, use a template like `node dist/{{ .Scenario }}.js`")] - public List? Command { get; set; } - - [ResourceProperty("Set if job should support chaos")] - public bool? ChaosEnabled { get; set; } - - public override void Write() - { - Write(Path.Join("templates", $"{Name}-job.yaml")); - } - - public BaseJob() : base() - { - // Default image name to stress test directory. The deploy-stress-tests.ps1 script also defaults - // the image name in docker build/push to this. - ImageName = new DirectoryInfo(Directory.GetCurrentDirectory()).Name; - } - } - - public class JobWithoutAzureResourceDeployment : BaseJob - { - public override string Help { get; set; } = "A stress test job that does not require an ARM deployment"; - - public string TemplateInclude { get; set; } = "env-job-template"; - } - - public class JobWithAzureResourceDeployment : BaseJob - { - public override string Help { get; set; } = "A stress test job that requires test resources created via an ARM deployment"; - - public string TemplateInclude { get; set; } = "deploy-job-template"; - - private string BicepContents = @" -// Add Bicep file contents here. -// [Overview] https://docs.microsoft.com/azure/azure-resource-manager/bicep/overview -// [Examples] https://github.com/Azure/bicep/tree/main/docs/examples -"; - - public override void Write() - { - base.Write(); - WriteAllText("test-resources.bicep", BicepContents); - } - } -} diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Resource.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Resource.cs deleted file mode 100644 index 7efcfda8ca9e..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/Resource.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.IO; - -namespace Stress.Generator -{ - public interface IResource - { - string Template { get; set; } - string Help { get; set; } - List Rendered { get; set; } - IEnumerable> Properties(); - IEnumerable> OptionalProperties(); - IEnumerable> NestedProperties(); - IEnumerable> OptionalNestedProperties(); - void Render(); - void SetProperty(PropertyInfo prop, object value); - void Write(string outputPath); - void Write(); - } - - public abstract class Resource : IResource - { - public List Rendered { get; set; } - public bool IsRendered = false; - public abstract string Template { get; set; } - public abstract string Help { get; set; } - - public Resource() - { - Rendered = new List(); - } - - public IEnumerable> TProperties() - where T : BaseResourceProperty - { - return this.GetType().GetProperties() - .Where(p => p.GetCustomAttribute() != null) -#nullable disable - .Select(p => new ResourcePropertyInfo(p, p.GetCustomAttribute())); -#nullable enable - } - - public IEnumerable> Properties() => TProperties(); - - public IEnumerable> OptionalProperties() => TProperties(); - - public IEnumerable> NestedProperties() => TProperties(); - - public IEnumerable> OptionalNestedProperties() => TProperties(); - - public void SetProperty(PropertyInfo prop, object value) - { - if (value == null) - { - throw new NullReferenceException($"Cannot set property {this.GetType().Name}.{prop.PropertyType.Name} to null"); - } - var source = this.GetType().Name; - var dest = value.GetType().Name; - var t = prop.PropertyType.Name; - prop.SetValue(this, value); - } - - // Pulling in a large templating library like Razor is more trouble than it's worth - // and other popular mustache-style templating libraries don't have great support - // for overridding the delimeters from curly braces, in order to not overlap - // with helm. It ends up being simpler to handle it ourselves :/ - public virtual void Render() - { - // match '((propertyName))', '(( propertyName ))', etc. - var re = new Regex(@"\(\(\s*(\w*)\s*\)\)"); - var hasError = false; - var _template = Template.Trim('\n').Split('\n').ToList(); - var lineNumber = 0; - var sentinel = ";;EXCLUDE;;"; - - while (lineNumber < _template.Count) - { - var line = _template[lineNumber]; - var match = re.Match(line); - - // Done matching current line, move to next. This approach is easier to understand than - // a regex statement for capturing repeated groups and parsing a nested capture. - if (!match.Success) - { - lineNumber++; - continue; - } - - var propName = match.Groups[1].Value; - var prop = this.GetType().GetProperty(propName); - - // NOTE: This will skip over any missing properties declared after the first missing property on a line. - if (prop == null) - { - Console.WriteLine($"Error rendering template for {this.GetType().Name}: Missing property {prop} on line {lineNumber}"); - Console.WriteLine($">>> {line}"); - hasError = true; - lineNumber++; - continue; - } - - var val = prop.GetValue(this); - - // Exclude lines with optional/nullable properties that aren't set - if (val == null) - { - _template[lineNumber] = sentinel; - lineNumber++; - continue; - } - - var resourceVal = val as IResource; - if (resourceVal != null) - { - try - { - resourceVal.Render(); - } - catch (Exception) - { - hasError = true; - } - val = string.Join('\n', resourceVal.Rendered); - } - else - { - val = JsonSerializer.Serialize(val).Trim('"'); - } - - var matchString = match.Groups[0].Value; - var matchPos = line.IndexOf(matchString); - // matchPos should never be -1 (indexOf fail to find). If it is, then fail catastrophically trying to Substring with -1. - _template[lineNumber] = line.Substring(0, matchPos) + val + line.Substring(matchPos + matchString.Length); - } - - if (hasError) - { - throw new Exception("Error rendering template, see details above."); - } - - Rendered = _template.Where(l => l != sentinel).ToList(); - IsRendered = true; - } - - public void WriteAllText(string outputPath, string text) - { - Console.WriteLine($"Writing {outputPath}"); - File.WriteAllText(outputPath, text.TrimStart('\n')); - } - - public void Write(string outputPath) - { - if (!IsRendered) - { - throw new Exception($"Render() must be called before Write() for {GetType().Name}."); - } - - var dirs = Path.GetDirectoryName(outputPath); - if (!string.IsNullOrEmpty(dirs)) - { - Directory.CreateDirectory(dirs); - } - Console.WriteLine($"Writing {outputPath}"); - File.WriteAllLines(outputPath, Rendered); - } - - public virtual void Write() - { - throw new NotImplementedException(); - } - } -} diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/StressTestPackage.cs b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/StressTestPackage.cs deleted file mode 100644 index 54779f74a676..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Resources/StressTestPackage.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.IO; - -namespace Stress.Generator -{ - public class StressTestPackage : Resource - { - public override string Template { get; set; } = @" -apiVersion: v2 -name: (( Name )) -description: (( Name )) stress test package -version: 0.1.1 -appVersion: v0.1 -annotations: - namespace: (( Namespace )) - stressTest: 'true' # do not change, required for deployment auto-discovery - -dependencies: -- name: stress-test-addons - version: 0.1.8 - repository: https://stresstestcharts.blob.core.windows.net/helm/ -"; - - public override string Help { get; set; } = "Top level information for the stress test package."; - - private string SrcReadmeContents = @" -Place files relevant to your application code within this directory -"; - - private string DockerfileContents = @" -# Build your Dockerfile here -# Reference docs: https://docs.docker.com/engine/reference/builder/ -# Best practices docs: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ - -FROM - -RUN mkdir /src -ADD ./src /src - -WORKDIR /src -RUN - -CMD [""your"", ""app"", ""command""]; -"; - - private string HelmIgnoreContents = @" -# Add files that should not be included in the stress test helm package. -# The package should consist mainly of yaml manifests and bicep/arm templates. -# Docs: https://helm.sh/docs/chart_template_guide/helm_ignore_file/ - -src/ -.env -"; - - private string ValuesContents = @" -# Leave this file empty unless you plan to support multiple test cases and want to avoid duplicating yaml. -# See https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/chaos/README.md#scenarios-and-valuesyaml - -# scenarios: -# - myScenarioA -# - myScenarioB -# - myScenarioC -"; - - private string ReadmeContents = @" -This is a stress test package, used for deploying and testing Azure SDKs in real world scenarios. -Docs: https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/chaos/README.md - -Examples: - - https://github.com/Azure/azure-sdk-tools/tree/main/tools/stress-cluster/chaos/examples - - https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub/stress - - https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus/test/stress - - https://github.com/Azure/azure-sdk-for-net/tree/feature/storage/chaos-testing-prototype/sdk/storage/chaos -"; - - [ResourceProperty("Stress Test Name")] - public string? Name { get; set; } - - [ResourceProperty("Stress Test Namespace (e.g. language name or alias for development)")] - public string? Namespace { get; set; } - - [NestedResourceProperty( - "Which resource(s) would you like to generate? Available resources are:", - new Type[]{ - typeof(JobWithoutAzureResourceDeployment), - typeof(JobWithAzureResourceDeployment), - typeof(NetworkChaos), - } - )] - public List? Resources { get; set; } - - public override void Render() - { - if (string.IsNullOrEmpty(Name)) - { - throw new Exception($"Property {this.GetType().Name}{nameof(Name)} cannot be empty."); - } - - foreach (var resource in Resources ?? Enumerable.Empty()) - { - var prop = resource.GetType().GetProperty(nameof(Name)); - if (prop != null) - { - resource.SetProperty(prop, Name); - } - - resource.Render(); - } - - base.Render(); - } - - public override void Write() - { - Write("Chart.yaml"); - - Directory.CreateDirectory("src"); - WriteAllText(Path.Join("src", "README.md"), SrcReadmeContents); - WriteAllText("Dockerfile", DockerfileContents); - WriteAllText(".helmignore", HelmIgnoreContents); - WriteAllText("values.yaml", ValuesContents); - WriteAllText("README.md", ReadmeContents); - - foreach (var resource in Resources ?? Enumerable.Empty()) - { - resource.Write(); - } - } - } -} \ No newline at end of file diff --git a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Stress.Generator.csproj b/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Stress.Generator.csproj deleted file mode 100644 index afaae469ac1f..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/Stress.Generator/Stress.Generator.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - Exe - net6.0 - true - stress-test-generator - Stress.Generator - enable - CS8600;CS8602;CS8603 - - - - - - - diff --git a/tools/stress-cluster/cluster/kubernetes/generator/ci.yml b/tools/stress-cluster/cluster/kubernetes/generator/ci.yml deleted file mode 100644 index 5b8a8f52c012..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/ci.yml +++ /dev/null @@ -1,21 +0,0 @@ -# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. -trigger: - branches: - include: - - main - paths: - include: - - tools/stress-cluster/cluster/kubernetes/generator - -pr: - branches: - include: - - main - paths: - include: - - tools/stress-cluster/cluster/kubernetes/generator - -extends: - template: /eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml - parameters: - ToolDirectory: tools/stress-cluster/cluster/kubernetes/generator diff --git a/tools/stress-cluster/cluster/kubernetes/generator/generator.sln b/tools/stress-cluster/cluster/kubernetes/generator/generator.sln deleted file mode 100644 index 9fca21a041f3..000000000000 --- a/tools/stress-cluster/cluster/kubernetes/generator/generator.sln +++ /dev/null @@ -1,53 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.33103.201 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stress.Generator", "Stress.Generator\Stress.Generator.csproj", "{DC8650BF-ACF0-4B82-BF15-B782331AAAD1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stress.Generator.Tests", "Stress.Generator.Tests\Stress.Generator.Tests.csproj", "{98254509-20FD-4CAC-91D4-F880C6C50300}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6870591F-AB47-4A08-B367-B3ECAC4C0CA7}" - ProjectSection(SolutionItems) = preProject - ci.yml = ci.yml - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Debug|x64.ActiveCfg = Debug|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Debug|x64.Build.0 = Debug|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Debug|x86.ActiveCfg = Debug|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Debug|x86.Build.0 = Debug|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Release|Any CPU.Build.0 = Release|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Release|x64.ActiveCfg = Release|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Release|x64.Build.0 = Release|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Release|x86.ActiveCfg = Release|Any CPU - {DC8650BF-ACF0-4B82-BF15-B782331AAAD1}.Release|x86.Build.0 = Release|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Debug|Any CPU.Build.0 = Debug|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Debug|x64.ActiveCfg = Debug|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Debug|x64.Build.0 = Debug|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Debug|x86.ActiveCfg = Debug|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Debug|x86.Build.0 = Debug|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Release|Any CPU.ActiveCfg = Release|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Release|Any CPU.Build.0 = Release|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Release|x64.ActiveCfg = Release|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Release|x64.Build.0 = Release|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Release|x86.ActiveCfg = Release|Any CPU - {98254509-20FD-4CAC-91D4-F880C6C50300}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal