Skip to content

Commit 4049c03

Browse files
committed
update
1 parent 7fa1dad commit 4049c03

File tree

4 files changed

+122
-74
lines changed

4 files changed

+122
-74
lines changed

eng/SendToHelix.proj

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -24,74 +24,75 @@
2424
</ItemGroup>
2525
</Target>
2626

27-
<Target Name="RunTests" DependsOnTargets="InstallDotNet">
28-
<ItemGroup>
29-
<ProjectsToBuild Include="..\src\System.Private.ServiceModel\tools\SelfHostedCoreWcfService\SelfHostedCoreWCFService.csproj"/>
30-
</ItemGroup>
27+
<ItemGroup>
28+
<ProjectsToBuild Include="..\src\System.Private.ServiceModel\tools\SelfHostedCoreWcfService\SelfHostedCoreWCFService.csproj"/>
29+
</ItemGroup>
3130

32-
<ItemGroup>
33-
<XUnitProject Include="..\src\System.Private.ServiceModel\tests\Scenarios\**\*.IntegrationTests.csproj">
34-
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
35-
</XUnitProject>
36-
<XUnitProject Include="..\src\System.ServiceModel.*\tests\*.Tests.csproj">
37-
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
38-
</XUnitProject>
39-
</ItemGroup>
31+
<ItemGroup>
32+
<XUnitProject Include="..\src\System.Private.ServiceModel\tests\Scenarios\**\*.IntegrationTests.csproj">
33+
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
34+
</XUnitProject>
35+
<XUnitProject Include="..\src\System.ServiceModel.*\tests\*.Tests.csproj">
36+
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
37+
</XUnitProject>
38+
</ItemGroup>
4039

41-
<ItemGroup Condition="'$(TestJob)' == 'Windows' AND '$(RunAsPublic)' == 'true'" >
42-
<HelixTargetQueue Include="windows.11.amd64.client.open" />
43-
<HelixTargetQueue Include="windows.amd64.server2022.open" />
44-
</ItemGroup>
40+
<ItemGroup Condition="'$(TestJob)' == 'Windows' AND '$(RunAsPublic)' == 'true'" >
41+
<HelixTargetQueue Include="windows.11.amd64.client.open" />
42+
<HelixTargetQueue Include="windows.amd64.server2022.open" />
43+
</ItemGroup>
4544

46-
<ItemGroup Condition="'$(TestJob)' == 'Windows' AND '$(RunAsInternal)'" >
47-
<HelixTargetQueue Include="windows.11.amd64.client" />
48-
<HelixTargetQueue Include="(Debian.11.Amd64)[email protected]/dotnet-buildtools/prereqs:debian-11-helix-amd64" />
49-
<HelixTargetQueue Include="(Mariner.2.0.Amd64)[email protected]/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64" />
50-
</ItemGroup>
45+
<ItemGroup Condition="'$(TestJob)' == 'Windows' AND '$(RunAsInternal)'" >
46+
<HelixTargetQueue Include="windows.11.amd64.client" />
47+
<HelixTargetQueue Include="(Debian.11.Amd64)[email protected]/dotnet-buildtools/prereqs:debian-11-helix-amd64" />
48+
<HelixTargetQueue Include="(Mariner.2.0.Amd64)[email protected]/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64" />
49+
</ItemGroup>
5150

52-
<ItemGroup Condition="'$(TestJob)' == 'Linux'" >
53-
<HelixTargetQueue Include="SLES.15.Amd64.Open" />
54-
<HelixTargetQueue Include="(Fedora.38.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-38-helix" />
55-
<HelixTargetQueue Include="Ubuntu.2204.Amd64.Open" />
56-
<HelixTargetQueue Include="(Debian.11.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-11-helix-amd64" />
57-
<HelixTargetQueue Include="(Mariner.2.0.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64" />
58-
<HelixTargetQueue Include="(openSUSE.15.2.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64" />
59-
</ItemGroup>
51+
<ItemGroup Condition="'$(TestJob)' == 'Linux'" >
52+
<HelixTargetQueue Include="SLES.15.Amd64.Open" />
53+
<HelixTargetQueue Include="(Fedora.38.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-38-helix" />
54+
<HelixTargetQueue Include="Ubuntu.2204.Amd64.Open" />
55+
<HelixTargetQueue Include="(Debian.11.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-11-helix-amd64" />
56+
<HelixTargetQueue Include="(Mariner.2.0.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64" />
57+
<HelixTargetQueue Include="(openSUSE.15.2.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64" />
58+
</ItemGroup>
6059

61-
<ItemGroup Condition="'$(TestJob)' == 'MacOS'" >
62-
<HelixTargetQueue Include="OSX.1200.Amd64.Open" />
63-
<HelixTargetQueue Include="OSX.1200.Arm64.Open" />
64-
</ItemGroup>
60+
<ItemGroup Condition="'$(TestJob)' == 'MacOS'" >
61+
<HelixTargetQueue Include="OSX.1200.Amd64.Open" />
62+
<HelixTargetQueue Include="OSX.1200.Arm64.Open" />
63+
</ItemGroup>
6564

66-
<PropertyGroup Condition=" '$(RunAsPublic)' == 'true' ">
67-
<IsExternal>true</IsExternal>
68-
<Creator>$(BUILD_SOURCEVERSIONAUTHOR)</Creator>
69-
<Creator Condition=" '$(Creator)' == ''">anon</Creator>
70-
</PropertyGroup>
65+
<PropertyGroup Condition=" '$(RunAsPublic)' == 'true' ">
66+
<IsExternal>true</IsExternal>
67+
<Creator>$(BUILD_SOURCEVERSIONAUTHOR)</Creator>
68+
<Creator Condition=" '$(Creator)' == ''">anon</Creator>
69+
</PropertyGroup>
7170

72-
<!--<PropertyGroup Condition=" '$(RunWithCoreWcfService)' == 'true' AND '$(TestJob)' == 'Linux'" >
71+
<!--<PropertyGroup Condition=" '$(RunWithCoreWcfService)' == 'true' AND '$(TestJob)' == 'Linux'" >
7372
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
7473
</PropertyGroup>-->
7574

76-
<PropertyGroup Condition="'$(TestJob)' == 'Windows'">
77-
<HelixPreCommands>$(HelixPreCommands);dir C:\ /s /b /o:gn | find "SelfHostedCoreWCFService"</HelixPreCommands>
78-
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\Release\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
79-
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
80-
</PropertyGroup>
81-
82-
<PropertyGroup Condition="'$(TestJob)' != 'Windows'">
83-
<HelixPreCommands>$(HelixPreCommands);find / -type d -name 'SelfHostedCoreWCFService'</HelixPreCommands>
84-
<HelixPreCommands>$(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh</HelixPreCommands>
85-
<HelixPreCommands>$(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt</HelixPreCommands>
86-
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/Release/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
87-
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
88-
</PropertyGroup>
89-
</Target>
75+
<PropertyGroup Condition="'$(TestJob)' == 'Windows'">
76+
<HelixPreCommands>$(HelixPreCommands);dir C:\ /s /b /o:gn | find "SelfHostedCoreWCFService"</HelixPreCommands>
77+
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\Release\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
78+
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
79+
</PropertyGroup>
80+
81+
<PropertyGroup Condition="'$(TestJob)' != 'Windows'">
82+
<HelixPreCommands>$(HelixPreCommands);find / -type d -name 'SelfHostedCoreWCFService'</HelixPreCommands>
83+
<HelixPreCommands>$(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh</HelixPreCommands>
84+
<HelixPreCommands>$(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt</HelixPreCommands>
85+
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/Release/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
86+
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
87+
</PropertyGroup>
88+
89+
<!--<Target Name="RunTests" DependsOnTargets="InstallDotNet">
90+
</Target>-->
9091

9192
<Target Name="Pack"/>
9293

9394
<Target Name="BuildProjects">
94-
<MSBuild Projects="@(ProjectsToBuild)" Properties="Configuration=Release;PublishDir='$(MSBuildThisFileDirectory)\..\artifacts\bin\SelfHostedCoreWCFService'" Targets="Publish" />
95+
<MSBuild Targets="Publish" Projects="@(ProjectsToBuild)" Properties="Configuration=Release;PublishDir='$(MSBuildThisFileDirectory)\..\artifacts\bin\SelfHostedCoreWCFService'" />
9596
</Target>
9697

9798
<ItemGroup>
@@ -103,7 +104,7 @@
103104
<!--<HelixContent Include="$(RepoRoot)src\Project\**" LinkBase="$(MSBuildThisFileDirectory)\myassets"/>-->
104105

105106
<HelixCorrelationPayload Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\artifacts\bin\SelfHostedCoreWCFService'))" >
106-
<Destination>SelfHostedCoreWCFService</Destination>
107+
<Destination>%(Identity)</Destination>
107108
</HelixCorrelationPayload>
108109
</ItemGroup>
109110

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"runtimes": {
55
"aspnetcore": [
66
"3.1.5",
7-
"6.0.15",
7+
"6.0.30",
88
"7.0.4",
99
"8.0.0"
1010
]

src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestDefinitionHelper.cs

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
// See the LICENSE file in the project root for more information.
44

55
#if NET
6+
using System.Diagnostics;
7+
using System.Linq;
8+
using System.Net;
69
using System.Security.Claims;
10+
using System.Security.Cryptography.X509Certificates;
711
using CoreWCF.Configuration;
812
using CoreWCF.Description;
913
using idunno.Authentication.Basic;
@@ -26,7 +30,7 @@ internal class TestDefinitionHelper
2630
private const int DefaultWebSocketPort = 8083;
2731
private const int DefaultWebSocketSPort = 8084;
2832

29-
private static IDictionary<ServiceSchema, string> BaseAddresses
33+
internal static IDictionary<ServiceSchema, string> BaseAddresses
3034
{
3135
get
3236
{
@@ -57,10 +61,47 @@ private static IDictionary<ServiceSchema, string> BaseAddresses
5761
}
5862

5963
#if NET
64+
internal class ServiceTestHostOptions
65+
{
66+
public List<Uri> serviceBaseAddresses = new List<Uri>();
67+
public Dictionary<Enum, string> endpointBasePath = new Dictionary<Enum, string>();
68+
}
69+
6070
internal static async Task StartHosts()
6171
{
6272
bool success = true;
63-
var webHost = WebHost.CreateDefaultBuilder()
73+
var serviceTestHostOptionsDict = new Dictionary<string, ServiceTestHostOptions>();
74+
75+
var webHost = new WebHostBuilder()
76+
.UseKestrel(options => {
77+
options.Listen(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.HTTP]).Port);
78+
options.Listen(address: IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.HTTPS]).Port, listenOptions =>
79+
{
80+
listenOptions.UseHttps(httpsOptions =>
81+
{
82+
X509Certificate2 cert = TestHost.CertificateFromFriendlyName(StoreName.My, StoreLocation.LocalMachine, "WCF Bridge - Machine certificate generated by the CertificateManager");
83+
httpsOptions.ServerCertificate = cert;
84+
});
85+
if (Debugger.IsAttached)
86+
{
87+
listenOptions.UseConnectionLogging();
88+
}
89+
});
90+
options.Listen(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.WS]).Port);
91+
options.Listen(address: IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.WSS]).Port, listenOptions =>
92+
{
93+
listenOptions.UseHttps(httpsOptions =>
94+
{
95+
X509Certificate2 cert = TestHost.CertificateFromFriendlyName(StoreName.My, StoreLocation.LocalMachine, "WCF Bridge - Machine certificate generated by the CertificateManager");
96+
httpsOptions.ServerCertificate = cert;
97+
});
98+
if (Debugger.IsAttached)
99+
{
100+
listenOptions.UseConnectionLogging();
101+
}
102+
});
103+
})
104+
.UseNetTcp(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.NETTCP]).Port)
64105
.ConfigureServices(services =>
65106
{
66107
services.AddAuthentication(BasicAuthenticationDefaults.AuthenticationScheme)
@@ -100,8 +141,7 @@ internal static async Task StartHosts()
100141
{
101142
foreach (var serviceTestHost in GetAttributedServiceHostTypes())
102143
{
103-
var serviceBaseAddresses = new List<Uri>();
104-
var endpointBasePath = new Dictionary<Enum, string>();
144+
var serviceTestHostOptions = new ServiceTestHostOptions();
105145
foreach (TestServiceDefinitionAttribute attr in serviceTestHost.GetCustomAttributes(typeof(TestServiceDefinitionAttribute), false))
106146
{
107147
Uri serviceBaseAddress = null;
@@ -111,9 +151,9 @@ internal static async Task StartHosts()
111151
{
112152
if (attr.Schema.HasFlag(schema))
113153
{
114-
endpointBasePath.Add(schema, attr.BasePath);
154+
serviceTestHostOptions.endpointBasePath.Add(schema, attr.BasePath);
115155
serviceBaseAddress = new Uri(BaseAddresses[(ServiceSchema)schema]);
116-
serviceBaseAddresses.Add(serviceBaseAddress);
156+
serviceTestHostOptions.serviceBaseAddresses.Add(serviceBaseAddress);
117157
}
118158
}
119159
}
@@ -132,30 +172,37 @@ internal static async Task StartHosts()
132172
}
133173
}
134174

175+
serviceTestHostOptionsDict.Add(serviceTestHost.Name, serviceTestHostOptions);
135176
try
136177
{
137178
if (success)
138179
{
139-
var serviceHost = (ServiceHost)Activator.CreateInstance(serviceTestHost, serviceBaseAddresses.ToArray());
180+
string serviceHostTypeName = serviceTestHost.Name;
181+
var serviceHost = (ServiceHost)Activator.CreateInstance(serviceTestHost, serviceTestHostOptionsDict[serviceHostTypeName].serviceBaseAddresses.ToArray());
140182
serviceBuilder.AddService(serviceHost.ServiceType, options =>
141183
{
142-
foreach (var baseAddress in serviceBaseAddresses)
184+
var localHostTypeName = serviceHostTypeName;
185+
//options.BaseAddresses.Clear();
186+
foreach (var baseAddress in serviceTestHostOptionsDict[localHostTypeName].serviceBaseAddresses)
143187
{
144188
if (!options.BaseAddresses.Contains(baseAddress))
145189
options.BaseAddresses.Add(baseAddress);
146190
}
191+
192+
foreach (var endpoint in serviceHost.Endpoints)
193+
{
194+
Enum schema = ServiceHostHelper.ToServiceSchema(endpoint.Binding.Scheme);
195+
string basePath = serviceTestHostOptionsDict[localHostTypeName].endpointBasePath[schema];
196+
string endpointAddress = string.Format("{0}/{1}", basePath, endpoint.Address);
197+
serviceBuilder.AddServiceEndpoint(serviceHost.ServiceType, endpoint.ContractType, endpoint.Binding, new Uri(endpointAddress, UriKind.RelativeOrAbsolute), null);
198+
}
147199
});
148-
foreach (var endpoint in serviceHost.Endpoints)
149-
{
150-
Enum schema = ServiceHostHelper.ToServiceSchema(endpoint.Binding.Scheme);
151-
string basePath = endpointBasePath[schema];
152-
string endpointAddress = string.Format("{0}/{1}", basePath, endpoint.Address);
153-
serviceBuilder.AddServiceEndpoint(serviceHost.ServiceType, endpoint.ContractType, endpoint.Binding, new Uri(endpointAddress, UriKind.RelativeOrAbsolute), null);
154-
}
200+
155201
serviceBuilder.ConfigureServiceHostBase(serviceHost.ServiceType, serviceHostBase =>
156202
{
203+
var localHostTypeName = serviceHostTypeName;
157204
var smb = serviceHostBase.Description.Behaviors.Find<ServiceMetadataBehavior>();
158-
if (serviceBaseAddresses.Where(uri => uri.Scheme == Uri.UriSchemeHttps).Any())
205+
if (serviceTestHostOptionsDict[localHostTypeName].serviceBaseAddresses.Where(uri => uri.Scheme == Uri.UriSchemeHttps).Any())
159206
{
160207
smb.HttpsGetEnabled = true;
161208
}

src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public static async Task Main(string[] args)
3030
TimeSpan validatePeriod = TimeSpan.FromDays(1);
3131
string crlFileLocation = "c:\\WCFTest\\test.crl";
3232

33-
CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation);
34-
33+
//CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation);
34+
//System.Diagnostics.Debugger.Launch();
3535
Console.WriteLine("Starting services...");
3636
await TestDefinitionHelper.StartHosts();
3737

0 commit comments

Comments
 (0)