Skip to content

Commit 05e3b8a

Browse files
Moved Managed Dependencies is not supported on Legion test case to DependencyManagement
1 parent 007c595 commit 05e3b8a

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

test/Unit/DependencyManagement/DependencyManagerTests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,38 @@ public void Initialize_ReturnsNewSnapshotPath_WhenNoAcceptableDependencyVersions
5050
}
5151
}
5252

53+
[Fact]
54+
public void Initialize_Throws_WhenDependenciesAreDefinedInRequirementsPsd1_OnLegion()
55+
{
56+
const string ContainerName = "CONTAINER_NAME";
57+
const string LegionServiceHost = "LEGION_SERVICE_HOST";
58+
const string AzureWebsiteInstanceId = "WEBSITE_INSTANCE_ID";
59+
60+
try
61+
{
62+
Environment.SetEnvironmentVariable(AzureWebsiteInstanceId, null);
63+
Environment.SetEnvironmentVariable(ContainerName, "MY_CONTAINER_NAME");
64+
Environment.SetEnvironmentVariable(LegionServiceHost, "MY_LEGION_SERVICE_HOST");
65+
66+
_mockStorage.Setup(_ => _.GetDependencies()).Returns(GetAnyNonEmptyDependencyManifestEntries());
67+
68+
using (var dependencyManager = CreateDependencyManagerWithMocks())
69+
{
70+
var caughtException = Assert.Throws<DependencyInstallationException>(
71+
() => dependencyManager.Initialize(_mockLogger.Object));
72+
73+
Assert.Contains("Managed Dependencies is not supported in Linux Consumption on Legion.", caughtException.Message);
74+
Assert.Contains("https://aka.ms/functions-powershell-include-modules", caughtException.Message);
75+
}
76+
}
77+
78+
finally
79+
{
80+
Environment.SetEnvironmentVariable(ContainerName, null);
81+
Environment.SetEnvironmentVariable(LegionServiceHost, null);
82+
}
83+
}
84+
5385
[Fact]
5486
public void Initialize_ReturnsExistingSnapshotPath_WhenAcceptableDependencyVersionsAlreadyInstalled()
5587
{

test/Unit/DependencyManagement/ManagedDependenciesPathDetectorTests.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -62,36 +62,5 @@ public void ValidateManagedDependenciesPath(string name, string value, bool setE
6262
}
6363
}
6464
}
65-
66-
[Fact]
67-
public void ManagedDependenciesIsNotSupportedOnLegion()
68-
{
69-
const string ContainerName = "CONTAINER_NAME";
70-
const string LegionServiceHost = "LEGION_SERVICE_HOST";
71-
const string AzureWebsiteInstanceId = "WEBSITE_INSTANCE_ID";
72-
73-
var functionAppRoot = Path.Join(Path.GetTempPath(), "MyFunction");
74-
75-
try
76-
{
77-
Environment.SetEnvironmentVariable(AzureWebsiteInstanceId, null);
78-
Environment.SetEnvironmentVariable(ContainerName, "MY_CONTAINER_NAME");
79-
Environment.SetEnvironmentVariable(LegionServiceHost, "MY_LEGION_SERVICE_HOST");
80-
81-
var exception = Assert.Throws<NotSupportedException>(() => ManagedDependenciesPathDetector.GetManagedDependenciesPath(functionAppRoot));
82-
Assert.Contains("Managed Dependencies is not supported in Linux Consumption on Legion.", exception.Message);
83-
Assert.Contains("https://aka.ms/functions-powershell-include-modules-with-app-content", exception.Message);
84-
}
85-
finally
86-
{
87-
Environment.SetEnvironmentVariable(ContainerName, null);
88-
Environment.SetEnvironmentVariable(LegionServiceHost, null);
89-
90-
if (Directory.Exists(functionAppRoot))
91-
{
92-
Directory.Delete(functionAppRoot);
93-
}
94-
}
95-
}
9665
}
9766
}

0 commit comments

Comments
 (0)