forked from Manuel/meeting-assistant
ci: consolidate platform pipelines and test prerequisites on macOS support
This commit is contained in:
1 parent
1b19b08f2e
commit
728e66dd72
76 files changed
+7477
-239
No files matched your search
@@ -0,0 +1,72 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Versioning;
|
||||
using MeetingAssistant.MacOs;
|
||||
using MeetingAssistant.Notifications;
|
||||
using MeetingAssistant.Recording;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace MeetingAssistant.Tests;
|
||||
|
||||
public sealed class TestTargetCompositionTests(ITestOutputHelper output)
|
||||
{
|
||||
[Fact]
|
||||
public async Task TestAndApplicationTargetsUseMatchingComposition()
|
||||
{
|
||||
var testAssembly = typeof(TestTargetCompositionTests).Assembly;
|
||||
var applicationAssembly = typeof(Program).Assembly;
|
||||
var testFramework = testAssembly.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName;
|
||||
var applicationFramework = applicationAssembly.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName;
|
||||
var testPlatform = testAssembly.GetCustomAttribute<TargetPlatformAttribute>()?.PlatformName;
|
||||
var applicationPlatform = applicationAssembly.GetCustomAttribute<TargetPlatformAttribute>()?.PlatformName;
|
||||
|
||||
output.WriteLine($"Test framework: {testFramework}; platform: {testPlatform ?? "portable"}");
|
||||
output.WriteLine($"Application framework: {applicationFramework}; platform: {applicationPlatform ?? "portable"}");
|
||||
Assert.Equal(".NETCoreApp,Version=v10.0", testFramework);
|
||||
Assert.Equal(testFramework, applicationFramework);
|
||||
Assert.Equal(testPlatform, applicationPlatform);
|
||||
#if WINDOWS
|
||||
Assert.Equal("Windows10.0.19041.0", testPlatform, ignoreCase: true);
|
||||
#else
|
||||
Assert.Null(testPlatform);
|
||||
#endif
|
||||
|
||||
await using var factory = new IsolatedApplicationFactory();
|
||||
using var client = factory.CreateClient();
|
||||
using var health = await client.GetAsync("/health");
|
||||
var capabilities = await client.GetFromJsonAsync<PlatformCapabilityReport>("/diagnostics/platform-capabilities");
|
||||
using var requests = await client.GetAsync("/desktop/requests");
|
||||
|
||||
Assert.Equal(HttpStatusCode.OK, health.StatusCode);
|
||||
Assert.NotNull(capabilities);
|
||||
#if WINDOWS
|
||||
Assert.Equal("OutlookClassicMeetingMetadataProvider", capabilities.MeetingMetadataProvider);
|
||||
Assert.Equal("WpfWorkflowRulesEditorWindowService", capabilities.WorkflowEditorProvider);
|
||||
Assert.IsType<WindowsAgentApprovalPromptService>(factory.Services.GetRequiredService<IAgentApprovalPromptService>());
|
||||
Assert.IsType<WindowsMeetingInactivityPromptService>(factory.Services.GetRequiredService<IMeetingInactivityPromptService>());
|
||||
Assert.Equal(HttpStatusCode.NotFound, requests.StatusCode);
|
||||
const string target = "windows";
|
||||
#else
|
||||
Assert.Equal("MacOsWorkflowRulesEditorWindowService", capabilities.WorkflowEditorProvider);
|
||||
Assert.Equal(HttpStatusCode.OK, requests.StatusCode);
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
Assert.Equal("MacOsMeetingMetadataProvider", capabilities.MeetingMetadataProvider);
|
||||
Assert.IsType<MacOsAgentApprovalPromptService>(factory.Services.GetRequiredService<IAgentApprovalPromptService>());
|
||||
Assert.IsType<MacOsMeetingInactivityPromptService>(factory.Services.GetRequiredService<IMeetingInactivityPromptService>());
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal("NoopMeetingMetadataProvider", capabilities.MeetingMetadataProvider);
|
||||
Assert.IsType<NoopAgentApprovalPromptService>(factory.Services.GetRequiredService<IAgentApprovalPromptService>());
|
||||
Assert.IsType<NoopMeetingInactivityPromptService>(factory.Services.GetRequiredService<IMeetingInactivityPromptService>());
|
||||
}
|
||||
const string target = "portable";
|
||||
#endif
|
||||
var host = OperatingSystem.IsWindows() ? "windows" :
|
||||
OperatingSystem.IsMacOS() ? "macos" : OperatingSystem.IsLinux() ? "linux" : "other";
|
||||
output.WriteLine($"platform-assurance: target={target}; host={host}");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user