diff --git a/playground/dapr/Dapr.AppHost/Dapr.AppHost.csproj b/playground/dapr/Dapr.AppHost/Dapr.AppHost.csproj index a1e326c62ec..79727e337e8 100644 --- a/playground/dapr/Dapr.AppHost/Dapr.AppHost.csproj +++ b/playground/dapr/Dapr.AppHost/Dapr.AppHost.csproj @@ -15,6 +15,7 @@ + diff --git a/playground/dapr/Dapr.AppHost/Program.cs b/playground/dapr/Dapr.AppHost/Program.cs index 32216d54c0b..d87860fcc85 100644 --- a/playground/dapr/Dapr.AppHost/Program.cs +++ b/playground/dapr/Dapr.AppHost/Program.cs @@ -1,5 +1,6 @@ var builder = DistributedApplication.CreateBuilder(args); +var redis = builder.AddRedis("redis", 6379); var stateStore = builder.AddDaprStateStore("statestore"); var pubSub = builder.AddDaprPubSub("pubsub"); diff --git a/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj b/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj index e9c3d39719d..8fff8882667 100644 --- a/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj +++ b/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj @@ -17,6 +17,7 @@ + diff --git a/src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs b/src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs index 30bf2cfc608..436564b3ba7 100644 --- a/src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs +++ b/src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs @@ -123,7 +123,7 @@ await notificationService.PublishUpdateAsync(resource, state => state with PopulateWellKnownParameters(resource, context); - if (FindFullPathFromPath("az") is not { } azPath) + if (FileUtil.FindFullPathFromPath("az") is not { } azPath) { throw new AzureCliNotOnPathException(); } @@ -395,30 +395,6 @@ private static async Task ExecuteCommand(ProcessSpec processSpec) } } - private static string? FindFullPathFromPath(string command) => FindFullPathFromPath(command, Environment.GetEnvironmentVariable("PATH"), Path.PathSeparator, File.Exists); - - private static string? FindFullPathFromPath(string command, string? pathVariable, char pathSeparator, Func fileExists) - { - Debug.Assert(!string.IsNullOrWhiteSpace(command)); - - if (OperatingSystem.IsWindows()) - { - command += ".cmd"; - } - - foreach (var directory in (pathVariable ?? string.Empty).Split(pathSeparator)) - { - var fullPath = Path.Combine(directory, command); - - if (fileExists(fullPath)) - { - return fullPath; - } - } - - return null; - } - internal static string GetChecksum(AzureBicepResource resource, JsonObject parameters) { // TODO: PERF Inefficient diff --git a/src/Aspire.Hosting.Dapr/Aspire.Hosting.Dapr.csproj b/src/Aspire.Hosting.Dapr/Aspire.Hosting.Dapr.csproj index b406de77120..1214100b794 100644 --- a/src/Aspire.Hosting.Dapr/Aspire.Hosting.Dapr.csproj +++ b/src/Aspire.Hosting.Dapr/Aspire.Hosting.Dapr.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Aspire.Hosting.Dapr/DaprDistributedApplicationLifecycleHook.cs b/src/Aspire.Hosting.Dapr/DaprDistributedApplicationLifecycleHook.cs index 9e7c7ef4d05..2ff021867df 100644 --- a/src/Aspire.Hosting.Dapr/DaprDistributedApplicationLifecycleHook.cs +++ b/src/Aspire.Hosting.Dapr/DaprDistributedApplicationLifecycleHook.cs @@ -41,7 +41,7 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell var sideCars = new List(); var fileName = this._options.DaprPath - ?? GetDefaultDaprPath() + ?? FileUtil.FindFullPathFromPath("dapr") ?? throw new DistributedApplicationException("Unable to locate the Dapr CLI."); foreach (var resource in appModel.Resources) @@ -282,49 +282,6 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell return null; } - /// - /// Return the first verified dapr path - /// - static string? GetDefaultDaprPath() - { - foreach (var path in GetAvailablePaths()) - { - if (File.Exists(path)) - { - return path; - } - } - - return default; - - // Return all the possible paths for dapr - static IEnumerable GetAvailablePaths() - { - if (OperatingSystem.IsWindows()) - { - var pathRoot = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.Windows)) ?? "C:"; - - // Installed windows paths: - yield return Path.Combine(pathRoot, "dapr", "dapr.exe"); - - yield break; - } - - // Add $HOME/dapr path: - var homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - yield return Path.Combine(homePath, "dapr", "dapr"); - - // Linux & MacOS path: - yield return Path.Combine("/usr", "local", "bin", "dapr"); - - // MacOS Homebrew path: - if (OperatingSystem.IsMacOS() && Environment.GetEnvironmentVariable("HOMEBREW_PREFIX") is string homebrewPrefix) - { - yield return Path.Combine(homebrewPrefix, "bin", "dapr"); - } - } - } - public void Dispose() { if (_onDemandResourcesRootPath is not null) diff --git a/tests/Aspire.Components.Common.Tests/FileUtil.cs b/src/Shared/FileUtil.cs similarity index 97% rename from tests/Aspire.Components.Common.Tests/FileUtil.cs rename to src/Shared/FileUtil.cs index de2052565ff..25dc92b1041 100644 --- a/tests/Aspire.Components.Common.Tests/FileUtil.cs +++ b/src/Shared/FileUtil.cs @@ -3,7 +3,7 @@ using System.Diagnostics; -namespace Aspire.Components.Common.Tests; +namespace Aspire; internal static class FileUtil { diff --git a/tests/Aspire.Components.Common.Tests/Aspire.Components.Common.Tests.csproj b/tests/Aspire.Components.Common.Tests/Aspire.Components.Common.Tests.csproj index 3302f811074..cdc62af78b7 100644 --- a/tests/Aspire.Components.Common.Tests/Aspire.Components.Common.Tests.csproj +++ b/tests/Aspire.Components.Common.Tests/Aspire.Components.Common.Tests.csproj @@ -6,6 +6,8 @@ + + diff --git a/tests/Aspire.Playground.Tests/AppHostTests.cs b/tests/Aspire.Playground.Tests/AppHostTests.cs index c612c6c6288..e5af3c065fe 100644 --- a/tests/Aspire.Playground.Tests/AppHostTests.cs +++ b/tests/Aspire.Playground.Tests/AppHostTests.cs @@ -185,6 +185,11 @@ public static IList GetAllTestEndpoints() waitForTexts: [ new ("storage", "Azurite Table service is successfully listening") ]), + new TestEndpoints("Dapr.AppHost", + resourceEndpoints: new() { + { "servicea", ["/alive", "/health", "/weatherforecast"] }, + { "serviceb", ["/alive", "/health", "/weatherforecast"] }, + }), new TestEndpoints("MilvusPlayground.AppHost", resourceEndpoints: new() { { "apiservice", ["/alive", "/health", "/create", "/search"] } }, waitForTexts: [ diff --git a/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj b/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj index 67930e243a9..4bf056f7958 100644 --- a/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj +++ b/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj @@ -49,6 +49,7 @@ + diff --git a/tests/helix/send-to-helix-basictests.targets b/tests/helix/send-to-helix-basictests.targets index 1d060ef1265..d6baf07e8fc 100644 --- a/tests/helix/send-to-helix-basictests.targets +++ b/tests/helix/send-to-helix-basictests.targets @@ -4,6 +4,7 @@ $(TestArchiveTestsDir)**/*.zip $(BuildHelixWorkItemsDependsOn);BuildHelixWorkItemsForDefaultTests true + true diff --git a/tests/helix/send-to-helix-buildonhelixtests.targets b/tests/helix/send-to-helix-buildonhelixtests.targets index 1488f77ecb9..f41b3cd9dc9 100644 --- a/tests/helix/send-to-helix-buildonhelixtests.targets +++ b/tests/helix/send-to-helix-buildonhelixtests.targets @@ -4,6 +4,7 @@ $(BuildHelixWorkItemsDependsOn);BuildHelixWorkItemsForBuildOnHelixTests true true + true $(TestArchiveTestsDirForBuildOnHelixTests)**/*.zip diff --git a/tests/helix/send-to-helix-inner.proj b/tests/helix/send-to-helix-inner.proj index ebcc638a185..1af5afc9e45 100644 --- a/tests/helix/send-to-helix-inner.proj +++ b/tests/helix/send-to-helix-inner.proj @@ -89,6 +89,18 @@ + + + + + + + + + + + +