mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-19 20:13:45 +01:00
Improve usage of Assert.Inconclusive
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Tgstation.Server.Host.IO.Tests
|
||||
public async Task TestFileWorks()
|
||||
{
|
||||
if (!HasPermissionToMakeSymlinks())
|
||||
Assert.Inconclusive();
|
||||
Assert.Inconclusive("Current user does not have permission to create symlinks!");
|
||||
const string Text = "Hello world";
|
||||
string f2 = null;
|
||||
var f1 = Path.GetTempFileName();
|
||||
@@ -63,7 +63,7 @@ namespace Tgstation.Server.Host.IO.Tests
|
||||
public async Task TestDirectoryWorks()
|
||||
{
|
||||
if (!HasPermissionToMakeSymlinks())
|
||||
Assert.Inconclusive();
|
||||
Assert.Inconclusive("Current user does not have permission to create symlinks!");
|
||||
const string FileName = "TestFile.txt";
|
||||
const string Text = "Hello world";
|
||||
string f2 = null;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Client;
|
||||
|
||||
namespace Tgstation.Server.Tests
|
||||
@@ -23,10 +24,20 @@ namespace Tgstation.Server.Tests
|
||||
|
||||
async Task TestRead(CancellationToken cancellationToken)
|
||||
{
|
||||
var model = await client.Read(cancellationToken).ConfigureAwait(false);
|
||||
Administration model;
|
||||
try
|
||||
{
|
||||
model = await client.Read(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (RateLimitException)
|
||||
{
|
||||
Assert.Inconclusive("GitHub rate limit hit while testing administration endpoint. Set environment variable TGS4_TEST_GITHUB_TOKEN to fix this!");
|
||||
return; //c# needs the equivalent of [noreturn]
|
||||
}
|
||||
Assert.AreEqual(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), model.WindowsHost);
|
||||
|
||||
//uhh not much else to do
|
||||
//we've released a few 4.x versions now, check the release checker is at least somewhat functional
|
||||
Assert.AreEqual(4, model.LatestVersion.Major);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ namespace Tgstation.Server.Tests
|
||||
var gitHubAccessToken = Environment.GetEnvironmentVariable("TGS4_TEST_GITHUB_TOKEN");
|
||||
|
||||
if (String.IsNullOrEmpty(databaseType))
|
||||
Assert.Fail("No database type configured in env var TGS4_TEST_DATABASE_TYPE!");
|
||||
Assert.Inconclusive("No database type configured in env var TGS4_TEST_DATABASE_TYPE!");
|
||||
|
||||
if (String.IsNullOrEmpty(connectionString))
|
||||
Assert.Fail("No connection string configured in env var TGS4_TEST_CONNECTION_STRING!");
|
||||
Assert.Inconclusive("No connection string configured in env var TGS4_TEST_CONNECTION_STRING!");
|
||||
|
||||
if (String.IsNullOrEmpty(gitHubAccessToken))
|
||||
Console.WriteLine("WARNING: No GitHub access token configured, test may fail due to rate limits!");
|
||||
|
||||
Reference in New Issue
Block a user