Stops test run when cleanup fails
This commit is contained in:
parent
f64fd79b23
commit
3b782d0e37
|
@ -53,9 +53,6 @@ namespace CodexDistTests.BasicTests
|
||||||
// var downloadedFile = secondary.DownloadContent(contentId);
|
// var downloadedFile = secondary.DownloadContent(contentId);
|
||||||
|
|
||||||
// testFile.AssertIsEqual(downloadedFile);
|
// testFile.AssertIsEqual(downloadedFile);
|
||||||
|
|
||||||
// // Test files are automatically deleted.
|
|
||||||
// // Online nodes are automatically destroyed.
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,30 @@ namespace CodexDistTests.TestCore
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUpDistTest()
|
public void SetUpDistTest()
|
||||||
{
|
{
|
||||||
fileManager = new FileManager();
|
if (GlobalTestFailure.HasFailed)
|
||||||
k8sManager = new K8sManager(fileManager);
|
{
|
||||||
|
Assert.Inconclusive("Skip test: Previous test failed during clean up.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileManager = new FileManager();
|
||||||
|
k8sManager = new K8sManager(fileManager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDownDistTest()
|
public void TearDownDistTest()
|
||||||
{
|
{
|
||||||
k8sManager.DeleteAllResources();
|
try
|
||||||
fileManager.DeleteAllTestFiles();
|
{
|
||||||
|
k8sManager.DeleteAllResources();
|
||||||
|
fileManager.DeleteAllTestFiles();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Cleanup has failed." + ex.Message);
|
||||||
|
GlobalTestFailure.HasFailed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestFile GenerateTestFile(int size = 1024)
|
public TestFile GenerateTestFile(int size = 1024)
|
||||||
|
@ -31,4 +46,9 @@ namespace CodexDistTests.TestCore
|
||||||
return new OfflineCodexNode(k8sManager);
|
return new OfflineCodexNode(k8sManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class GlobalTestFailure
|
||||||
|
{
|
||||||
|
public static bool HasFailed { get; set; } = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ namespace CodexDistTests.TestCore
|
||||||
private void DeleteNamespace(Kubernetes client)
|
private void DeleteNamespace(Kubernetes client)
|
||||||
{
|
{
|
||||||
if (activeNamespace == null) return;
|
if (activeNamespace == null) return;
|
||||||
client.DeleteNamespace(activeNamespace.Name());
|
client.DeleteNamespace(activeNamespace.Name(), null, null, gracePeriodSeconds: 0);
|
||||||
activeNamespace = null;
|
activeNamespace = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue