-
Notifications
You must be signed in to change notification settings - Fork 311
Adds hosting model as an extra deployment parameter #1261
Changes from 6 commits
d108d69
2a7433d
7a075d6
8f38fd0
44306e3
f0996f1
009b200
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.AspNetCore.Server.IntegrationTesting | ||
{ | ||
public enum HostingModel | ||
{ | ||
OutOfProcess, | ||
InProcess | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,13 @@ public override async Task<DeploymentResult> DeployAsync() | |
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig); | ||
} | ||
|
||
if (serverConfig.Contains("[HostingModel]")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed as string.Replace will no-op if the old value is not found. Also we should not change the config after the changes were logged in https://github.com/aspnet/Hosting/pull/1261/files#diff-727b9f7850879229f0c886f7448a0b04R149. I still think it's best to include these updates at https://github.com/aspnet/Hosting/pull/1261/files#diff-727b9f7850879229f0c886f7448a0b04R138 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is for logging. It doesn't make sense to say we are replacing the hostingModel if the hosting model isn't replaced. I do agree with moving it above the config file content though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are debug logs so there's no harm in saying we tried replacing the hosting model but didn't end up finding anything to replace. Then again, I don't feel too strongly about it either way. |
||
{ | ||
var hostingModel = DeploymentParameters.HostingModel.ToString(); | ||
serverConfig.Replace("[HostingModel]", hostingModel); | ||
Logger.LogDebug("Writing HostingModel '{hostingModel}' to config", hostingModel); | ||
} | ||
|
||
File.WriteAllText(DeploymentParameters.ServerConfigLocation, serverConfig); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set a default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other values don't have default values (including enums). See: https://github.com/aspnet/Hosting/pull/1261/files#diff-8478a3aebbec4604e8f2cf79bb152195R105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, it would take the first value as the default (or whatever is the enum equivalent of 0). Do we want to default all tests to InProcess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be out of process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with changing the order of the enums but personally I prefer the more explicit approach where we just set the default value. Takes out all ambiguity.