Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
afifi-ins committed Jun 6, 2024
1 parent 7fa1dad commit 4049c03
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 74 deletions.
111 changes: 56 additions & 55 deletions eng/SendToHelix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -24,74 +24,75 @@
</ItemGroup>
</Target>

<Target Name="RunTests" DependsOnTargets="InstallDotNet">
<ItemGroup>
<ProjectsToBuild Include="..\src\System.Private.ServiceModel\tools\SelfHostedCoreWcfService\SelfHostedCoreWCFService.csproj"/>
</ItemGroup>
<ItemGroup>
<ProjectsToBuild Include="..\src\System.Private.ServiceModel\tools\SelfHostedCoreWcfService\SelfHostedCoreWCFService.csproj"/>
</ItemGroup>

<ItemGroup>
<XUnitProject Include="..\src\System.Private.ServiceModel\tests\Scenarios\**\*.IntegrationTests.csproj">
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
</XUnitProject>
<XUnitProject Include="..\src\System.ServiceModel.*\tests\*.Tests.csproj">
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
</XUnitProject>
</ItemGroup>
<ItemGroup>
<XUnitProject Include="..\src\System.Private.ServiceModel\tests\Scenarios\**\*.IntegrationTests.csproj">
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
</XUnitProject>
<XUnitProject Include="..\src\System.ServiceModel.*\tests\*.Tests.csproj">
<TargetFramework>$(XUnitPublishTargetFramework)</TargetFramework>
</XUnitProject>
</ItemGroup>

<ItemGroup Condition="'$(TestJob)' == 'Windows' AND '$(RunAsPublic)' == 'true'" >
<HelixTargetQueue Include="windows.11.amd64.client.open" />
<HelixTargetQueue Include="windows.amd64.server2022.open" />
</ItemGroup>
<ItemGroup Condition="'$(TestJob)' == 'Windows' AND '$(RunAsPublic)' == 'true'" >
<HelixTargetQueue Include="windows.11.amd64.client.open" />
<HelixTargetQueue Include="windows.amd64.server2022.open" />
</ItemGroup>

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

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

<ItemGroup Condition="'$(TestJob)' == 'MacOS'" >
<HelixTargetQueue Include="OSX.1200.Amd64.Open" />
<HelixTargetQueue Include="OSX.1200.Arm64.Open" />
</ItemGroup>
<ItemGroup Condition="'$(TestJob)' == 'MacOS'" >
<HelixTargetQueue Include="OSX.1200.Amd64.Open" />
<HelixTargetQueue Include="OSX.1200.Arm64.Open" />
</ItemGroup>

<PropertyGroup Condition=" '$(RunAsPublic)' == 'true' ">
<IsExternal>true</IsExternal>
<Creator>$(BUILD_SOURCEVERSIONAUTHOR)</Creator>
<Creator Condition=" '$(Creator)' == ''">anon</Creator>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunAsPublic)' == 'true' ">
<IsExternal>true</IsExternal>
<Creator>$(BUILD_SOURCEVERSIONAUTHOR)</Creator>
<Creator Condition=" '$(Creator)' == ''">anon</Creator>
</PropertyGroup>

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

<PropertyGroup Condition="'$(TestJob)' == 'Windows'">
<HelixPreCommands>$(HelixPreCommands);dir C:\ /s /b /o:gn | find "SelfHostedCoreWCFService"</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\Release\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
</PropertyGroup>

<PropertyGroup Condition="'$(TestJob)' != 'Windows'">
<HelixPreCommands>$(HelixPreCommands);find / -type d -name 'SelfHostedCoreWCFService'</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/Release/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
</PropertyGroup>
</Target>
<PropertyGroup Condition="'$(TestJob)' == 'Windows'">
<HelixPreCommands>$(HelixPreCommands);dir C:\ /s /b /o:gn | find "SelfHostedCoreWCFService"</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\Release\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net6.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
</PropertyGroup>

<PropertyGroup Condition="'$(TestJob)' != 'Windows'">
<HelixPreCommands>$(HelixPreCommands);find / -type d -name 'SelfHostedCoreWCFService'</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/Release/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net6.0/SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
</PropertyGroup>

<!--<Target Name="RunTests" DependsOnTargets="InstallDotNet">
</Target>-->

<Target Name="Pack"/>

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

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

<HelixCorrelationPayload Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\artifacts\bin\SelfHostedCoreWCFService'))" >
<Destination>SelfHostedCoreWCFService</Destination>
<Destination>%(Identity)</Destination>
</HelixCorrelationPayload>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"runtimes": {
"aspnetcore": [
"3.1.5",
"6.0.15",
"6.0.30",
"7.0.4",
"8.0.0"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
// See the LICENSE file in the project root for more information.

#if NET
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Security.Claims;
using System.Security.Cryptography.X509Certificates;
using CoreWCF.Configuration;
using CoreWCF.Description;
using idunno.Authentication.Basic;
Expand All @@ -26,7 +30,7 @@ internal class TestDefinitionHelper
private const int DefaultWebSocketPort = 8083;
private const int DefaultWebSocketSPort = 8084;

private static IDictionary<ServiceSchema, string> BaseAddresses
internal static IDictionary<ServiceSchema, string> BaseAddresses
{
get
{
Expand Down Expand Up @@ -57,10 +61,47 @@ private static IDictionary<ServiceSchema, string> BaseAddresses
}

#if NET
internal class ServiceTestHostOptions
{
public List<Uri> serviceBaseAddresses = new List<Uri>();
public Dictionary<Enum, string> endpointBasePath = new Dictionary<Enum, string>();
}

internal static async Task StartHosts()
{
bool success = true;
var webHost = WebHost.CreateDefaultBuilder()
var serviceTestHostOptionsDict = new Dictionary<string, ServiceTestHostOptions>();

var webHost = new WebHostBuilder()
.UseKestrel(options => {
options.Listen(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.HTTP]).Port);
options.Listen(address: IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.HTTPS]).Port, listenOptions =>
{
listenOptions.UseHttps(httpsOptions =>
{
X509Certificate2 cert = TestHost.CertificateFromFriendlyName(StoreName.My, StoreLocation.LocalMachine, "WCF Bridge - Machine certificate generated by the CertificateManager");
httpsOptions.ServerCertificate = cert;
});
if (Debugger.IsAttached)
{
listenOptions.UseConnectionLogging();
}
});
options.Listen(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.WS]).Port);
options.Listen(address: IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.WSS]).Port, listenOptions =>
{
listenOptions.UseHttps(httpsOptions =>
{
X509Certificate2 cert = TestHost.CertificateFromFriendlyName(StoreName.My, StoreLocation.LocalMachine, "WCF Bridge - Machine certificate generated by the CertificateManager");
httpsOptions.ServerCertificate = cert;
});
if (Debugger.IsAttached)
{
listenOptions.UseConnectionLogging();
}
});
})
.UseNetTcp(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.NETTCP]).Port)
.ConfigureServices(services =>
{
services.AddAuthentication(BasicAuthenticationDefaults.AuthenticationScheme)
Expand Down Expand Up @@ -100,8 +141,7 @@ internal static async Task StartHosts()
{
foreach (var serviceTestHost in GetAttributedServiceHostTypes())
{
var serviceBaseAddresses = new List<Uri>();
var endpointBasePath = new Dictionary<Enum, string>();
var serviceTestHostOptions = new ServiceTestHostOptions();
foreach (TestServiceDefinitionAttribute attr in serviceTestHost.GetCustomAttributes(typeof(TestServiceDefinitionAttribute), false))
{
Uri serviceBaseAddress = null;
Expand All @@ -111,9 +151,9 @@ internal static async Task StartHosts()
{
if (attr.Schema.HasFlag(schema))
{
endpointBasePath.Add(schema, attr.BasePath);
serviceTestHostOptions.endpointBasePath.Add(schema, attr.BasePath);
serviceBaseAddress = new Uri(BaseAddresses[(ServiceSchema)schema]);
serviceBaseAddresses.Add(serviceBaseAddress);
serviceTestHostOptions.serviceBaseAddresses.Add(serviceBaseAddress);
}
}
}
Expand All @@ -132,30 +172,37 @@ internal static async Task StartHosts()
}
}
serviceTestHostOptionsDict.Add(serviceTestHost.Name, serviceTestHostOptions);
try
{
if (success)
{
var serviceHost = (ServiceHost)Activator.CreateInstance(serviceTestHost, serviceBaseAddresses.ToArray());
string serviceHostTypeName = serviceTestHost.Name;
var serviceHost = (ServiceHost)Activator.CreateInstance(serviceTestHost, serviceTestHostOptionsDict[serviceHostTypeName].serviceBaseAddresses.ToArray());
serviceBuilder.AddService(serviceHost.ServiceType, options =>
{
foreach (var baseAddress in serviceBaseAddresses)
var localHostTypeName = serviceHostTypeName;
//options.BaseAddresses.Clear();
foreach (var baseAddress in serviceTestHostOptionsDict[localHostTypeName].serviceBaseAddresses)
{
if (!options.BaseAddresses.Contains(baseAddress))
options.BaseAddresses.Add(baseAddress);
}
foreach (var endpoint in serviceHost.Endpoints)
{
Enum schema = ServiceHostHelper.ToServiceSchema(endpoint.Binding.Scheme);
string basePath = serviceTestHostOptionsDict[localHostTypeName].endpointBasePath[schema];
string endpointAddress = string.Format("{0}/{1}", basePath, endpoint.Address);
serviceBuilder.AddServiceEndpoint(serviceHost.ServiceType, endpoint.ContractType, endpoint.Binding, new Uri(endpointAddress, UriKind.RelativeOrAbsolute), null);
}
});
foreach (var endpoint in serviceHost.Endpoints)
{
Enum schema = ServiceHostHelper.ToServiceSchema(endpoint.Binding.Scheme);
string basePath = endpointBasePath[schema];
string endpointAddress = string.Format("{0}/{1}", basePath, endpoint.Address);
serviceBuilder.AddServiceEndpoint(serviceHost.ServiceType, endpoint.ContractType, endpoint.Binding, new Uri(endpointAddress, UriKind.RelativeOrAbsolute), null);
}
serviceBuilder.ConfigureServiceHostBase(serviceHost.ServiceType, serviceHostBase =>
{
var localHostTypeName = serviceHostTypeName;
var smb = serviceHostBase.Description.Behaviors.Find<ServiceMetadataBehavior>();
if (serviceBaseAddresses.Where(uri => uri.Scheme == Uri.UriSchemeHttps).Any())
if (serviceTestHostOptionsDict[localHostTypeName].serviceBaseAddresses.Where(uri => uri.Scheme == Uri.UriSchemeHttps).Any())
{
smb.HttpsGetEnabled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static async Task Main(string[] args)
TimeSpan validatePeriod = TimeSpan.FromDays(1);
string crlFileLocation = "c:\\WCFTest\\test.crl";

Check failure on line 31 in src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs

View check run for this annotation

Azure Pipelines / dotnet-wcf-ci (Build Linux Debug)

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

src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs(31,20): error CS0219: (NETCORE_ENGINEERING_TELEMETRY=Build) The variable 'crlFileLocation' is assigned but its value is never used

Check failure on line 31 in src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs

View check run for this annotation

Azure Pipelines / dotnet-wcf-ci

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

src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs(31,20): error CS0219: (NETCORE_ENGINEERING_TELEMETRY=Build) The variable 'crlFileLocation' is assigned but its value is never used

CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation);

//CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation);
//System.Diagnostics.Debugger.Launch();
Console.WriteLine("Starting services...");
await TestDefinitionHelper.StartHosts();

Expand Down

0 comments on commit 4049c03

Please sign in to comment.