diff --git a/System.ServiceModel.sln b/System.ServiceModel.sln index 161e8472379..09459d5609d 100644 --- a/System.ServiceModel.sln +++ b/System.ServiceModel.sln @@ -49,8 +49,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Encoding.MessageVersion.Int EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensibility.MessageEncoder.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Extensibility\MessageEncoder\Extensibility.MessageEncoder.IntegrationTests.csproj", "{76361777-321D-4588-87F9-38992A758350}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensibility.MessageInterceptor.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Extensibility\MessageInterceptor\Extensibility.MessageInterceptor.IntegrationTests.csproj", "{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensibility.WebSockets.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Extensibility\WebSockets\Extensibility.WebSockets.IntegrationTests.csproj", "{C8CA16D3-5B1E-4EC0-A817-205A798DC272}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Infrastructure\Infrastructure.IntegrationTests.csproj", "{719E874A-AEFA-44D5-9530-9C41BD0FA4E8}" @@ -209,10 +207,6 @@ Global {76361777-321D-4588-87F9-38992A758350}.Debug|Any CPU.Build.0 = Debug|Any CPU {76361777-321D-4588-87F9-38992A758350}.Release|Any CPU.ActiveCfg = Release|Any CPU {76361777-321D-4588-87F9-38992A758350}.Release|Any CPU.Build.0 = Release|Any CPU - {ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Release|Any CPU.Build.0 = Release|Any CPU {C8CA16D3-5B1E-4EC0-A817-205A798DC272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C8CA16D3-5B1E-4EC0-A817-205A798DC272}.Debug|Any CPU.Build.0 = Debug|Any CPU {C8CA16D3-5B1E-4EC0-A817-205A798DC272}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -337,7 +331,6 @@ Global {48C41A27-631F-45FA-ACD5-7D7EDD4A4931} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} {36DD97F6-1F78-4843-A9C0-58C59D367603} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} {76361777-321D-4588-87F9-38992A758350} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} - {ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} {C8CA16D3-5B1E-4EC0-A817-205A798DC272} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} {719E874A-AEFA-44D5-9530-9C41BD0FA4E8} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} {E878E412-F0AB-4D87-8A7A-3114AAC48CD5} = {D6302510-AB10-4775-BCE9-98FA96FDEB76} diff --git a/azure-pipelines-arcade-PR.yml b/azure-pipelines-arcade-PR.yml index 75d0f693d55..869100a6d4d 100644 --- a/azure-pipelines-arcade-PR.yml +++ b/azure-pipelines-arcade-PR.yml @@ -200,7 +200,6 @@ stages: --projects $(Build.SourcesDirectory)/eng/SendToHelix.proj $(_TestArgs) /p:TestJob=Linux - /p:RunWithCoreWcfService=$($Env:_RunWithCoreWcfService) /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog displayName: Linux - Run Helix Tests env: @@ -208,11 +207,13 @@ stages: ServiceHost: $(_serviceUri) RunAsPublic: $(_RunAsPublic) RunAsInternal: $(_RunAsInternal) + RunWithCoreWcfService: $(_RunWithCoreWcfService) IsWindowsBuild: false # Only build and test MacOS in PR and CI builds. - ${{ if eq(variables._RunAsPublic, True) }}: - job: MacOS + condition: ne(variables._RunWithCoreWcfService, True) timeoutInMinutes: 90 pool: name: NetCore-Public diff --git a/eng/SendToHelix.proj b/eng/SendToHelix.proj index c07575f4bf7..b3628eb579b 100644 --- a/eng/SendToHelix.proj +++ b/eng/SendToHelix.proj @@ -1,20 +1,35 @@ - + pr/dotnet/wcf/$(BUILD_SOURCEBRANCH)/ official/dotnet/wcf/$(BUILD_SOURCEBRANCH)/ test/product/ $(BUILD_BUILDNUMBER) 123460.01 - sdk - 8.0.100 - true + + $([System.IO.File]::ReadAllText('$(RepoRoot)global.json')) + sdk + $([System.Text.RegularExpressions.Regex]::Match($(GlobalJsonContent), '(%3F<="dotnet": ").*(%3F=")')) + + true true $(AGENT_JOBNAME) - true - + + + + + aspnetcore-runtime + Current + + + + + + + + $(XUnitPublishTargetFramework) @@ -53,19 +68,46 @@ $(BUILD_SOURCEVERSIONAUTHOR) anon - - + + + false + + + $(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh $(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt - + + $(HelixPreCommands);set PATH=%HELIX_CORRELATION_PAYLOAD%\dotnet-cli%3B%PATH% + + $(HelixPreCommands);set DOTNET_ROOT=%HELIX_CORRELATION_PAYLOAD%\dotnet-cli;set DOTNET_CLI_TELEMETRY_OPTOUT=1 + $(HelixPreCommands);set DOTNET_CLI_HOME=%HELIX_WORKITEM_ROOT%\.dotnet + $(HelixPreCommands);set NUGET_PACKAGES=%HELIX_WORKITEM_ROOT%\.nuget + $(HelixPreCommands);set ServiceUri=localhost + $(HelixPreCommands);set RunWithCoreWCF=true + $(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net8.0\SelfHostedCoreWCFService bootstrap:true + + + + $(HelixPreCommands);export PATH=$HELIX_CORRELATION_PAYLOAD/dotnet-cli:$PATH + $(HelixPreCommands);export DOTNET_ROOT=$HELIX_CORRELATION_PAYLOAD/dotnet-cli;export DOTNET_CLI_TELEMETRY_OPTOUT=1 + $(HelixPreCommands);export DOTNET_CLI_HOME=$HELIX_WORKITEM_ROOT/.dotnet + $(HelixPreCommands);export NUGET_PACKAGES=$HELIX_WORKITEM_ROOT/.nuget + $(HelixPreCommands);export ServiceUri=localhost + $(HelixPreCommands);export RunWithCoreWCF=true + $(HelixPreCommands);dotnet exec --roll-forward Major $HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net8.0/SelfHostedCoreWCFService.dll bootstrap:true + %(Identity) + + + SelfHostedCoreWCFService + diff --git a/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalTestDetectors.cs b/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalTestDetectors.cs index 9c237866760..82b63a682b7 100644 --- a/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalTestDetectors.cs +++ b/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalTestDetectors.cs @@ -142,18 +142,17 @@ public static bool IsWindows() return OSID.AnyWindows.MatchesCurrent(); } - public static bool IsWindowsOrSelfHosted() + // Returns 'true' if the server is running with CoreWCF Service + public static bool IsRunWithCoreWCFService() { - if (IsWindows()) - { - return true; - } - else if (!IsIISHosted()) + string runWithCoreWCFService = TestProperties.GetProperty(TestProperties.RunWithCoreWCF_PropertyName); + + if (String.IsNullOrWhiteSpace(runWithCoreWCFService)) { - return true; + return false; } - return false; + return true; } // Returns 'true' if the server is running as localhost. diff --git a/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalWcfTest.cs b/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalWcfTest.cs index e46570bdc5f..f5f1f035095 100644 --- a/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalWcfTest.cs +++ b/src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalWcfTest.cs @@ -328,7 +328,7 @@ public static bool Windows_Authentication_Available() // Temporarily use the simple heuristic that if we are running the services locally, it is. // Refactor this after integration to address https://github.com/dotnet/wcf/issues/1024 return GetConditionValue(nameof(Windows_Authentication_Available), - Server_Is_LocalHost); + Server_Is_LocalHost) && Is_Windows(); } // Returns true if NTLM is available to use. @@ -351,11 +351,6 @@ public static bool SSL_Available() ConditionalTestDetectors.IsWindows); } - public static bool WindowsOrSelfHosted() - { - return GetConditionValue(nameof(WindowsOrSelfHosted), ConditionalTestDetectors.IsWindowsOrSelfHosted); - } - // Returns the Domain if available. // TestProperties takes precedence, but if it has not been specified // and this is a Windows client, we infer it. @@ -387,5 +382,13 @@ public static string GetSPN() { return ConditionalTestDetectors.GetSPN(); } + + // Returns 'false' if run with CoreWCF Service, + // skip failed test + public static bool Skip_CoreWCFService_FailedTest() + { + return !GetConditionValue(nameof(Skip_CoreWCFService_FailedTest), + ConditionalTestDetectors.IsRunWithCoreWCFService); + } } } diff --git a/src/System.Private.ServiceModel/tests/Common/Infrastructure/ServiceUtilHelper.cs b/src/System.Private.ServiceModel/tests/Common/Infrastructure/ServiceUtilHelper.cs index 99637924039..086e3157c66 100644 --- a/src/System.Private.ServiceModel/tests/Common/Infrastructure/ServiceUtilHelper.cs +++ b/src/System.Private.ServiceModel/tests/Common/Infrastructure/ServiceUtilHelper.cs @@ -530,8 +530,8 @@ public static string GetEndpointAddress(string endpoint, string protocol = "http private static string GetResourceAddress(string resource, string protocol = "http") { - string host = TestProperties.GetProperty(TestProperties.ServiceUri_PropertyName); - return string.Format(@"{0}://{1}/{2}/{3}", protocol, host, TestHostUtilitiesService, resource); + var baseUri = BuildBaseUri(protocol); + return new Uri(baseUri, $"{TestHostUtilitiesService}/{resource}").ToString(); } public static string GetResourceFromServiceAsString(string resource) @@ -542,7 +542,14 @@ public static string GetResourceFromServiceAsString(string resource) using (HttpClient httpClient = new HttpClient()) { HttpResponseMessage response = httpClient.GetAsync(requestUri).GetAwaiter().GetResult(); - return response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + if (response.IsSuccessStatusCode) + { + return response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + } + else + { + throw new Exception($"Got Status code {response.StatusCode} from {requestUri}."); + } } } @@ -554,7 +561,14 @@ public static byte[] GetResourceFromServiceAsByteArray(string resource) using (HttpClient httpClient = new HttpClient()) { HttpResponseMessage response = httpClient.GetAsync(requestUri).GetAwaiter().GetResult(); - return response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult(); + if (response.IsSuccessStatusCode) + { + return response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult(); + } + else + { + throw new Exception($"Got Status code {response.StatusCode} from {requestUri}."); + } } } @@ -566,7 +580,14 @@ public static async Task GetResourceFromServiceAsByteArrayAsync(string r using (HttpClient httpClient = new HttpClient()) { HttpResponseMessage response = await httpClient.GetAsync(requestUri); - return await response.Content.ReadAsByteArrayAsync(); + if (response.IsSuccessStatusCode) + { + return await response.Content.ReadAsByteArrayAsync(); + } + else + { + throw new Exception($"Got Status code {response.StatusCode} from {requestUri}."); + } } } } diff --git a/src/System.Private.ServiceModel/tests/Common/Infrastructure/testproperties.props b/src/System.Private.ServiceModel/tests/Common/Infrastructure/testproperties.props index 0fad0893561..67cd0d824a9 100644 --- a/src/System.Private.ServiceModel/tests/Common/Infrastructure/testproperties.props +++ b/src/System.Private.ServiceModel/tests/Common/Infrastructure/testproperties.props @@ -2,149 +2,152 @@ - - - 44283 - + + 44283 + - - 8081 - + + 8081 + - - 44285 - + + 44285 + - - 809 - + + 8808 + - - 8083 - + + 8083 + - - 8084 - + + 8084 + - - test - + + test + - - 7.00:00:00 - + + 7.00:00:00 + - - 00:01:00 - + + 00:01:00 + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - localhost - - - - - - - - - - - - - - - - - true - - + + true + + + + + Open