Skip to content

Commit

Permalink
Remove stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zentron committed Aug 19, 2024
1 parent fb025d1 commit d96800f
Showing 1 changed file with 0 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,87 +121,6 @@ protected override async Task<Dictionary<string, string>> GetEnvironmentVars(Can
};
}

/*
[Test]
public void DeployRawYaml_WithMultipleYamlFilesGlobPatterns_YamlFilesAppliedInCorrectBatches()
{
SetVariablesToAuthoriseWithAmazonAccount();
SetVariablesForKubernetesResourceStatusCheck(30);
SetVariablesForRawYamlCommand($@"deployments/**/*
services/{ServiceFileName}
configmaps/*.yml");
string CreatePackageWithMultipleYamlFiles(string directory)
{
var packageToPackage = CreatePackageWithFiles(ResourcePackageFileName, directory,
("deployments", DeploymentFileName, SimpleDeploymentResource),
(Path.Combine("deployments", "subfolder"), DeploymentFileName2, SimpleDeploymentResource2),
("services", ServiceFileName, SimpleService),
("services", "EmptyYamlFile.yml", ""),
("configmaps", ConfigMapFileName, SimpleConfigMap),
("configmaps", ConfigMapFileName2, SimpleConfigMap2),
(Path.Combine("configmaps","subfolder"), "InvalidJSONNotUsed.yml", InvalidDeploymentResource));
return packageToPackage;
}
ExecuteCommandAndVerifyResult(KubernetesApplyRawYamlCommand.Name, CreatePackageWithMultipleYamlFiles);
var rawLogs = Log.Messages.Select(m => m.FormattedMessage).Where(l => !l.StartsWith("##octopus")).ToArray();
// We take the logs starting from when Calamari starts applying batches
// to when the last k8s resource is created and compare them in an assent test.
var startIndex = Array.FindIndex(rawLogs, l => l.StartsWith("Applying Batch #1"));
var endIndex =
Array.FindLastIndex(rawLogs, l => l == "Resource Status Check: 2 new resources have been added:") + 2;
var assentLogs = rawLogs.Skip(startIndex)
.Take(endIndex + 1 - startIndex)
.Where(l => !l.StartsWith("##octopus")).ToArray();
var batch3Index = Array.FindIndex(assentLogs, l => l.StartsWith("Applying Batch #3"));
// In this case the two config maps have been loaded in reverse order
// This can happen as Directory.EnumerateFiles() does not behave the
// same on all platforms.
// We'll flip them back the right way before performing the Assent Test.
if (assentLogs[batch3Index + 1].Contains("myapp-configmap1.yml"))
{
var configMap1Idx = batch3Index + 1;
var configMap2Idx = Array.FindIndex(assentLogs, l => l.Contains("myapp-configmap2.yml"));
var endIdx = Array.FindLastIndex(assentLogs, l => l == "Created Resources:") - 1;
InPlaceSwap(assentLogs, configMap1Idx, configMap2Idx, endIdx);
}
// We need to replace the backslash with forward slash because
// the slash comes out differently on windows machines.
var assentString = string.Join('\n', assentLogs).Replace("\\", "/");
this.Assent(assentString, configuration: AssentConfiguration.DefaultWithPostfix("ApplyingBatches"));
var resources = new[]
{
(Name: SimpleDeploymentResourceName, Label: "Deployment1"),
(Name: SimpleDeployment2ResourceName,Label: "Deployment2"),
(Name: SimpleServiceResourceName, Label: "Service1"),
(Name: SimpleConfigMapResourceName, Label: "ConfigMap1"),
(Name: SimpleConfigMap2ResourceName, Label: "ConfigMap3")
};
var statusMessages = Log.Messages.GetServiceMessagesOfType("k8s-status");
foreach (var (name, label) in resources)
{
// Check that each resource was created and the appropriate setvariable service message was created.
var resource = AssertResourceCreatedAndGetJson(name);
this.Assent(resource, configuration: AssentConfiguration.DefaultWithPostfix(label));
// Check that each deployed resource has a "Successful" status reported.
statusMessages.Should().Contain(m => m.Properties["name"] == name && m.Properties["status"] == "Successful");
}
rawLogs.Should().ContainSingle(m =>
m.Contains("Resource status check completed successfully because all resources are deployed successfully"));
}*/

[Test]
[TestCase(true)]
[TestCase(false)]
Expand Down

0 comments on commit d96800f

Please sign in to comment.