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);
|
||||
|
||||
// testFile.AssertIsEqual(downloadedFile);
|
||||
|
||||
// // Test files are automatically deleted.
|
||||
// // Online nodes are automatically destroyed.
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,17 +9,32 @@ namespace CodexDistTests.TestCore
|
|||
|
||||
[SetUp]
|
||||
public void SetUpDistTest()
|
||||
{
|
||||
if (GlobalTestFailure.HasFailed)
|
||||
{
|
||||
Assert.Inconclusive("Skip test: Previous test failed during clean up.");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileManager = new FileManager();
|
||||
k8sManager = new K8sManager(fileManager);
|
||||
}
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDownDistTest()
|
||||
{
|
||||
try
|
||||
{
|
||||
k8sManager.DeleteAllResources();
|
||||
fileManager.DeleteAllTestFiles();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Cleanup has failed." + ex.Message);
|
||||
GlobalTestFailure.HasFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public TestFile GenerateTestFile(int size = 1024)
|
||||
{
|
||||
|
@ -31,4 +46,9 @@ namespace CodexDistTests.TestCore
|
|||
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)
|
||||
{
|
||||
if (activeNamespace == null) return;
|
||||
client.DeleteNamespace(activeNamespace.Name());
|
||||
client.DeleteNamespace(activeNamespace.Name(), null, null, gracePeriodSeconds: 0);
|
||||
activeNamespace = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue