Skip to content

Commit b8432ac

Browse files
twsouthwickgithub-actions
authored andcommitted
add properties to deployer
1 parent 8031e6e commit b8432ac

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/Servers/IIS/IIS/test/Common.FunctionalTests/RequestResponseTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,16 +616,18 @@ public async Task HostingEnvironmentIsCorrect()
616616
[InlineData("IIISEnvironmentFeatureConfig")]
617617
public async Task IISEnvironmentFeatureIsAvailable(string endpoint)
618618
{
619+
var siteName = _fixture.DeploymentResult.DeploymentParameters.SiteName.ToUpperInvariant();
620+
619621
var expected = $"""
620622
IIS Version: 10.0
621623
ApplicationId: /LM/W3SVC/1/ROOT
622624
Application Path: {_fixture.DeploymentResult.ContentRoot}\
623625
Application Virtual Path: /
624-
Application Config Path: MACHINE/WEBROOT/APPHOST/HTTPTESTSITE
625-
AppPool ID: IISExpressAppPool
626+
Application Config Path: MACHINE/WEBROOT/APPHOST/{siteName}
627+
AppPool ID: {_fixture.DeploymentResult.AppPoolName}
626628
AppPool Config File: {_fixture.DeploymentResult.DeploymentParameters.ServerConfigLocation}
627629
Site ID: 1
628-
Site Name: {_fixture.DeploymentResult.DeploymentParameters.SiteName.ToUpperInvariant()}
630+
Site Name: {siteName}
629631
""";
630632

631633
Assert.Equal(expected, await _fixture.Client.GetStringAsync($"/{endpoint}"));

src/Servers/IIS/IntegrationTesting.IIS/src/IISDeployer.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class IISDeployer : IISDeployerBase
2828
private string _configPath;
2929
private string _applicationHostConfig;
3030
private string _debugLogFile;
31+
private string _appPoolName;
3132
private bool _disposed;
3233

3334
public Process HostProcess { get; set; }
@@ -109,6 +110,8 @@ public override Task<DeploymentResult> DeployAsync()
109110
var uri = TestUriHelper.BuildTestUri(ServerType.IIS, DeploymentParameters.ApplicationBaseUriHint);
110111
StartIIS(uri, contentRoot);
111112

113+
IISDeploymentParameters.ServerConfigLocation = Path.Combine(@"C:\inetpub\temp\apppools", _appPoolName, $"{_appPoolName}.config");
114+
112115
// Warm up time for IIS setup.
113116
Logger.LogInformation("Successfully finished IIS application directory setup.");
114117
return Task.FromResult<DeploymentResult>(new IISDeploymentResult(
@@ -117,7 +120,8 @@ public override Task<DeploymentResult> DeployAsync()
117120
applicationBaseUri: uri.ToString(),
118121
contentRoot: contentRoot,
119122
hostShutdownToken: _hostShutdownToken.Token,
120-
hostProcess: HostProcess
123+
hostProcess: HostProcess,
124+
appPoolName: _appPoolName
121125
));
122126
}
123127
}
@@ -239,13 +243,16 @@ private void WaitUntilSiteStarted(string contentRoot)
239243
RetryServerManagerAction(serverManager =>
240244
{
241245
var site = FindSite(serverManager, contentRoot);
246+
IISDeploymentParameters.SiteName = site.Name;
247+
242248
if (site == null)
243249
{
244250
PreserveConfigFiles("nositetostart");
245251
throw new InvalidOperationException($"Can't find site for: {contentRoot} to start.");
246252
}
247253

248254
var appPool = serverManager.ApplicationPools.Single();
255+
_appPoolName = appPool.Name;
249256
if (appPool.State != ObjectState.Started && appPool.State != ObjectState.Starting)
250257
{
251258
var state = appPool.Start();
@@ -500,7 +507,7 @@ private void RetryServerManagerAction(Action<ServerManager> action)
500507

501508
private void PreserveConfigFiles(string fileNamePrefix)
502509
{
503-
HelixHelper.PreserveFile(Path.Combine(DeploymentParameters.PublishedApplicationRootPath, "web.config"), fileNamePrefix+".web.config");
510+
HelixHelper.PreserveFile(Path.Combine(DeploymentParameters.PublishedApplicationRootPath, "web.config"), fileNamePrefix + ".web.config");
504511
HelixHelper.PreserveFile(Path.Combine(_configPath, "applicationHost.config"), fileNamePrefix + ".applicationHost.config");
505512
HelixHelper.PreserveFile(Path.Combine(Environment.SystemDirectory, @"inetsrv\config\ApplicationHost.config"), fileNamePrefix + ".inetsrv.applicationHost.config");
506513
HelixHelper.PreserveFile(Path.Combine(Environment.SystemDirectory, @"inetsrv\config\redirection.config"), fileNamePrefix + ".inetsrv.redirection.config");

src/Servers/IIS/IntegrationTesting.IIS/src/IISDeploymentResult.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
1010
public class IISDeploymentResult : DeploymentResult
1111
{
1212
public ILogger Logger { get; set; }
13+
1314
public Process HostProcess { get; }
1415

16+
public string AppPoolName { get; }
17+
1518
public IISDeploymentResult(ILoggerFactory loggerFactory,
1619
IISDeploymentParameters deploymentParameters,
1720
string applicationBaseUri,
1821
string contentRoot,
22+
string appPoolName,
1923
CancellationToken hostShutdownToken,
2024
Process hostProcess)
2125
: base(loggerFactory,
@@ -24,6 +28,7 @@ public IISDeploymentResult(ILoggerFactory loggerFactory,
2428
contentRoot,
2529
hostShutdownToken)
2630
{
31+
AppPoolName = appPoolName;
2732
HostProcess = hostProcess;
2833
Logger = loggerFactory.CreateLogger(deploymentParameters.SiteName);
2934
HttpClient = CreateClient(new HttpClientHandler());

src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public override async Task<DeploymentResult> DeployAsync()
105105
applicationBaseUri: actualUri.ToString(),
106106
contentRoot: contentRoot,
107107
hostShutdownToken: hostExitToken,
108+
appPoolName: "IISExpressAppPool",
108109
hostProcess: _hostProcess);
109110
}
110111
}

0 commit comments

Comments
 (0)