Skip to content

Commit af14463

Browse files
committed
Clean up WindowsOrSelfHosted condition
Update linux test condition and MacOS pipeline Skip CoreWCF Failed Tests
1 parent 1af2b0f commit af14463

File tree

49 files changed

+372
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+372
-242
lines changed

azure-pipelines-arcade-PR.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ stages:
213213
# Only build and test MacOS in PR and CI builds.
214214
- ${{ if eq(variables._RunAsPublic, True) }}:
215215
- job: MacOS
216+
condition: ne(variables._RunWithCoreWcfService, True)
216217
timeoutInMinutes: 90
217218
pool:
218219
name: NetCore-Public

eng/SendToHelix.proj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<HelixPreCommands>$(HelixPreCommands);set DOTNET_CLI_HOME=%HELIX_WORKITEM_ROOT%\.dotnet</HelixPreCommands>
8686
<HelixPreCommands>$(HelixPreCommands);set NUGET_PACKAGES=%HELIX_WORKITEM_ROOT%\.nuget</HelixPreCommands>
8787
<HelixPreCommands>$(HelixPreCommands);set ServiceUri=localhost</HelixPreCommands>
88+
<HelixPreCommands>$(HelixPreCommands);set RunWithCoreWCF=true</HelixPreCommands>
8889
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net8.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
8990
</PropertyGroup>
9091

@@ -94,6 +95,7 @@
9495
<HelixPreCommands>$(HelixPreCommands);export DOTNET_CLI_HOME=$HELIX_WORKITEM_ROOT/.dotnet</HelixPreCommands>
9596
<HelixPreCommands>$(HelixPreCommands);export NUGET_PACKAGES=$HELIX_WORKITEM_ROOT/.nuget</HelixPreCommands>
9697
<HelixPreCommands>$(HelixPreCommands);export ServiceUri=localhost</HelixPreCommands>
98+
<HelixPreCommands>$(HelixPreCommands);export RunWithCoreWCF=true</HelixPreCommands>
9799
<HelixPreCommands>$(HelixPreCommands);dotnet exec --roll-forward Major $HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net8.0/SelfHostedCoreWCFService.dll bootstrap:true</HelixPreCommands>
98100
</PropertyGroup>
99101

src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalTestDetectors.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,17 @@ public static bool IsWindows()
142142
return OSID.AnyWindows.MatchesCurrent();
143143
}
144144

145-
public static bool IsWindowsOrSelfHosted()
145+
// Returns 'true' if the server is running with CoreWCF Service
146+
public static bool IsRunWithCoreWCFService()
146147
{
147-
if (IsWindows())
148-
{
149-
return true;
150-
}
151-
else if (!IsIISHosted())
148+
string runWithCoreWCFService = TestProperties.GetProperty(TestProperties.RunWithCoreWCF_PropertyName);
149+
150+
if (String.IsNullOrWhiteSpace(runWithCoreWCFService))
152151
{
153-
return true;
152+
return false;
154153
}
155154

156-
return false;
155+
return true;
157156
}
158157

159158
// Returns 'true' if the server is running as localhost.

src/System.Private.ServiceModel/tests/Common/Infrastructure/ConditionalWcfTest.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public static bool Windows_Authentication_Available()
328328
// Temporarily use the simple heuristic that if we are running the services locally, it is.
329329
// Refactor this after integration to address https://github.com/dotnet/wcf/issues/1024
330330
return GetConditionValue(nameof(Windows_Authentication_Available),
331-
Server_Is_LocalHost);
331+
Server_Is_LocalHost) && Is_Windows();
332332
}
333333

334334
// Returns true if NTLM is available to use.
@@ -351,11 +351,6 @@ public static bool SSL_Available()
351351
ConditionalTestDetectors.IsWindows);
352352
}
353353

354-
public static bool WindowsOrSelfHosted()
355-
{
356-
return GetConditionValue(nameof(WindowsOrSelfHosted), ConditionalTestDetectors.IsWindowsOrSelfHosted);
357-
}
358-
359354
// Returns the Domain if available.
360355
// TestProperties takes precedence, but if it has not been specified
361356
// and this is a Windows client, we infer it.
@@ -387,5 +382,13 @@ public static string GetSPN()
387382
{
388383
return ConditionalTestDetectors.GetSPN();
389384
}
385+
386+
// Returns 'false' if run with CoreWCF Service,
387+
// skip failed test
388+
public static bool Skip_CoreWCFService_FailedTest()
389+
{
390+
return !GetConditionValue(nameof(Skip_CoreWCFService_FailedTest),
391+
ConditionalTestDetectors.IsRunWithCoreWCFService);
392+
}
390393
}
391394
}

src/System.Private.ServiceModel/tests/Common/Infrastructure/testproperties.props

Lines changed: 121 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -2,149 +2,152 @@
22
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

44

5-
<!-- Set default values for any TestProperties not already specified.
5+
<!-- Set default values for any TestProperties not already specified.
66
When adding or removing TestProperties, update testproperties.targets
77
to generate code at build time.
88
-->
9-
<PropertyGroup Condition="'$(ServicePort)' == ''">
10-
<ServicePort>44283</ServicePort>
11-
</PropertyGroup>
9+
<PropertyGroup Condition="'$(ServicePort)' == ''">
10+
<ServicePort>44283</ServicePort>
11+
</PropertyGroup>
1212

13-
<PropertyGroup Condition="'$(ServiceHttpPort)' == ''">
14-
<ServiceHttpPort>8081</ServiceHttpPort>
15-
</PropertyGroup>
13+
<PropertyGroup Condition="'$(ServiceHttpPort)' == ''">
14+
<ServiceHttpPort>8081</ServiceHttpPort>
15+
</PropertyGroup>
1616

17-
<PropertyGroup Condition="'$(ServiceHttpsPort)' == ''">
18-
<ServiceHttpsPort>44285</ServiceHttpsPort>
19-
</PropertyGroup>
17+
<PropertyGroup Condition="'$(ServiceHttpsPort)' == ''">
18+
<ServiceHttpsPort>44285</ServiceHttpsPort>
19+
</PropertyGroup>
2020

21-
<PropertyGroup Condition="'$(ServiceTcpPort)' == ''">
22-
<ServiceTcpPort>8808</ServiceTcpPort>
23-
</PropertyGroup>
21+
<PropertyGroup Condition="'$(ServiceTcpPort)' == ''">
22+
<ServiceTcpPort>8808</ServiceTcpPort>
23+
</PropertyGroup>
2424

25-
<PropertyGroup Condition="'$(ServiceWebSocketPort)' == ''">
26-
<ServiceWebSocketPort>8083</ServiceWebSocketPort>
27-
</PropertyGroup>
25+
<PropertyGroup Condition="'$(ServiceWebSocketPort)' == ''">
26+
<ServiceWebSocketPort>8083</ServiceWebSocketPort>
27+
</PropertyGroup>
2828

29-
<PropertyGroup Condition="'$(ServiceSecureWebSocketPort)' == ''">
30-
<ServiceSecureWebSocketPort>8084</ServiceSecureWebSocketPort>
31-
</PropertyGroup>
29+
<PropertyGroup Condition="'$(ServiceSecureWebSocketPort)' == ''">
30+
<ServiceSecureWebSocketPort>8084</ServiceSecureWebSocketPort>
31+
</PropertyGroup>
3232

33-
<PropertyGroup Condition="'$(TestRootCertificatePassword)' == ''">
34-
<TestRootCertificatePassword>test</TestRootCertificatePassword>
35-
</PropertyGroup>
33+
<PropertyGroup Condition="'$(TestRootCertificatePassword)' == ''">
34+
<TestRootCertificatePassword>test</TestRootCertificatePassword>
35+
</PropertyGroup>
3636

37-
<PropertyGroup Condition="'$(TestRootCertificateValidityPeriod)' == ''">
38-
<TestRootCertificateValidityPeriod>7.00:00:00</TestRootCertificateValidityPeriod>
39-
</PropertyGroup>
37+
<PropertyGroup Condition="'$(TestRootCertificateValidityPeriod)' == ''">
38+
<TestRootCertificateValidityPeriod>7.00:00:00</TestRootCertificateValidityPeriod>
39+
</PropertyGroup>
4040

41-
<PropertyGroup Condition="'$(MaxTestTimeSpan)' == ''">
42-
<MaxTestTimeSpan>00:01:00</MaxTestTimeSpan>
43-
</PropertyGroup>
41+
<PropertyGroup Condition="'$(MaxTestTimeSpan)' == ''">
42+
<MaxTestTimeSpan>00:01:00</MaxTestTimeSpan>
43+
</PropertyGroup>
4444

45-
<PropertyGroup Condition="'$(NegotiateTestRealm)' == ''">
46-
<NegotiateTestRealm></NegotiateTestRealm>
47-
</PropertyGroup>
45+
<PropertyGroup Condition="'$(NegotiateTestRealm)' == ''">
46+
<NegotiateTestRealm></NegotiateTestRealm>
47+
</PropertyGroup>
4848

49-
<PropertyGroup Condition="'$(NegotiateTestDomain)' == ''">
50-
<NegotiateTestDomain></NegotiateTestDomain>
51-
</PropertyGroup>
49+
<PropertyGroup Condition="'$(NegotiateTestDomain)' == ''">
50+
<NegotiateTestDomain></NegotiateTestDomain>
51+
</PropertyGroup>
5252

53-
<PropertyGroup Condition="'$(NegotiateTestSpn)' == ''">
54-
<NegotiateTestSpn></NegotiateTestSpn>
55-
</PropertyGroup>
53+
<PropertyGroup Condition="'$(NegotiateTestSpn)' == ''">
54+
<NegotiateTestSpn></NegotiateTestSpn>
55+
</PropertyGroup>
5656

57-
<PropertyGroup Condition="'$(NegotiateTestUpn)' == ''">
58-
<NegotiateTestUpn></NegotiateTestUpn>
59-
</PropertyGroup>
57+
<PropertyGroup Condition="'$(NegotiateTestUpn)' == ''">
58+
<NegotiateTestUpn></NegotiateTestUpn>
59+
</PropertyGroup>
6060

61-
<!-- Convention for TestProperties values to use by [ConditionalFact]:
61+
<!-- Convention for TestProperties values to use by [ConditionalFact]:
6262
'true' = yes, the condition is satisfied
6363
'false' = no, the condition is not satisfied
6464
empty string = self-detect at runtime if possible, else assume 'false'
6565
-->
66-
<PropertyGroup Condition="'$(Domain_Joined)' == ''">
67-
<Domain_Joined></Domain_Joined>
68-
</PropertyGroup>
69-
70-
<PropertyGroup Condition="'$(Server_Domain_Joined)' == ''">
71-
<Server_Domain_Joined></Server_Domain_Joined>
72-
</PropertyGroup>
73-
74-
<PropertyGroup Condition="'$(Root_Certificate_Installed)' == ''">
75-
<Root_Certificate_Installed></Root_Certificate_Installed>
76-
</PropertyGroup>
77-
78-
<PropertyGroup Condition="'$(Client_Certificate_Installed)' == ''">
79-
<Client_Certificate_Installed></Client_Certificate_Installed>
80-
</PropertyGroup>
81-
82-
<PropertyGroup Condition="'$(Peer_Certificate_Installed)' == ''">
83-
<Peer_Certificate_Installed></Peer_Certificate_Installed>
84-
</PropertyGroup>
85-
86-
<PropertyGroup Condition="'$(OSXPeer_Certificate_Installed)' == ''">
87-
<OSXPeer_Certificate_Installed></OSXPeer_Certificate_Installed>
88-
</PropertyGroup>
89-
90-
<PropertyGroup Condition="'$(SPN_Available)' == ''">
91-
<SPN_Available></SPN_Available>
92-
</PropertyGroup>
93-
94-
<PropertyGroup Condition="'$(NTLM_Available)' == ''">
95-
<NTLM_Available></NTLM_Available>
96-
</PropertyGroup>
97-
98-
<PropertyGroup Condition="'$(Ambient_Credentials_Available)' == ''">
99-
<Ambient_Credentials_Available></Ambient_Credentials_Available>
100-
</PropertyGroup>
101-
102-
<PropertyGroup Condition="'$(Explicit_Credentials_Available)' == ''">
103-
<Explicit_Credentials_Available></Explicit_Credentials_Available>
104-
</PropertyGroup>
105-
106-
<PropertyGroup Condition="'$(Server_Accepts_Certificates)' == ''">
107-
<Server_Accepts_Certificates></Server_Accepts_Certificates>
108-
</PropertyGroup>
109-
110-
<PropertyGroup Condition="'$(Basic_Authentication_Available)' == ''">
111-
<Basic_Authentication_Available></Basic_Authentication_Available>
112-
</PropertyGroup>
113-
114-
<PropertyGroup Condition="'$(Digest_Authentication_Available)' == ''">
115-
<Digest_Authentication_Available></Digest_Authentication_Available>
116-
</PropertyGroup>
117-
118-
<PropertyGroup Condition="'$(Windows_Authentication_Available)' == ''">
119-
<Windows_Authentication_Available></Windows_Authentication_Available>
120-
</PropertyGroup>
121-
122-
<PropertyGroup Condition="'$(ServiceUri)' == ''">
123-
<ServiceUri >localhost</ServiceUri >
124-
</PropertyGroup>
125-
126-
<PropertyGroup Condition="'$(ExplicitUserName)' == ''">
127-
<ExplicitUserName ></ExplicitUserName >
128-
</PropertyGroup>
129-
130-
<PropertyGroup Condition="'$(ExplicitPassword)' == ''">
131-
<ExplicitPassword ></ExplicitPassword >
132-
</PropertyGroup>
133-
134-
<PropertyGroup Condition="'$(SSL_Available)' == ''">
135-
<SSL_Available></SSL_Available>
136-
</PropertyGroup>
137-
138-
<!-- The default value of $(IncludeTestsWithIssues) is blank, which is equivalent fo 'false'.
66+
<PropertyGroup Condition="'$(Domain_Joined)' == ''">
67+
<Domain_Joined></Domain_Joined>
68+
</PropertyGroup>
69+
70+
<PropertyGroup Condition="'$(Server_Domain_Joined)' == ''">
71+
<Server_Domain_Joined></Server_Domain_Joined>
72+
</PropertyGroup>
73+
74+
<PropertyGroup Condition="'$(Root_Certificate_Installed)' == ''">
75+
<Root_Certificate_Installed></Root_Certificate_Installed>
76+
</PropertyGroup>
77+
78+
<PropertyGroup Condition="'$(Client_Certificate_Installed)' == ''">
79+
<Client_Certificate_Installed></Client_Certificate_Installed>
80+
</PropertyGroup>
81+
82+
<PropertyGroup Condition="'$(Peer_Certificate_Installed)' == ''">
83+
<Peer_Certificate_Installed></Peer_Certificate_Installed>
84+
</PropertyGroup>
85+
86+
<PropertyGroup Condition="'$(OSXPeer_Certificate_Installed)' == ''">
87+
<OSXPeer_Certificate_Installed></OSXPeer_Certificate_Installed>
88+
</PropertyGroup>
89+
90+
<PropertyGroup Condition="'$(SPN_Available)' == ''">
91+
<SPN_Available></SPN_Available>
92+
</PropertyGroup>
93+
94+
<PropertyGroup Condition="'$(NTLM_Available)' == ''">
95+
<NTLM_Available></NTLM_Available>
96+
</PropertyGroup>
97+
98+
<PropertyGroup Condition="'$(Ambient_Credentials_Available)' == ''">
99+
<Ambient_Credentials_Available></Ambient_Credentials_Available>
100+
</PropertyGroup>
101+
102+
<PropertyGroup Condition="'$(Explicit_Credentials_Available)' == ''">
103+
<Explicit_Credentials_Available></Explicit_Credentials_Available>
104+
</PropertyGroup>
105+
106+
<PropertyGroup Condition="'$(Server_Accepts_Certificates)' == ''">
107+
<Server_Accepts_Certificates></Server_Accepts_Certificates>
108+
</PropertyGroup>
109+
110+
<PropertyGroup Condition="'$(Basic_Authentication_Available)' == ''">
111+
<Basic_Authentication_Available></Basic_Authentication_Available>
112+
</PropertyGroup>
113+
114+
<PropertyGroup Condition="'$(Digest_Authentication_Available)' == ''">
115+
<Digest_Authentication_Available></Digest_Authentication_Available>
116+
</PropertyGroup>
117+
118+
<PropertyGroup Condition="'$(Windows_Authentication_Available)' == ''">
119+
<Windows_Authentication_Available></Windows_Authentication_Available>
120+
</PropertyGroup>
121+
122+
<PropertyGroup Condition="'$(ServiceUri)' == ''">
123+
<ServiceUri >localhost</ServiceUri >
124+
</PropertyGroup>
125+
126+
<PropertyGroup Condition="'$(ExplicitUserName)' == ''">
127+
<ExplicitUserName ></ExplicitUserName >
128+
</PropertyGroup>
129+
130+
<PropertyGroup Condition="'$(ExplicitPassword)' == ''">
131+
<ExplicitPassword ></ExplicitPassword >
132+
</PropertyGroup>
133+
134+
<PropertyGroup Condition="'$(SSL_Available)' == ''">
135+
<SSL_Available></SSL_Available>
136+
</PropertyGroup>
137+
138+
<!-- The default value of $(IncludeTestsWithIssues) is blank, which is equivalent fo 'false'.
139139
The check of $(WithCategories) preserves the convention used by other repo's where the
140140
keyword 'failing' inside $(WithCategories) asks that tests with [ActiveIssue] be run.
141141
Optionally, $(IncludeTestsWithIssues) can be a semicolon-separated list of issue numbers.
142142
Tests marked with an [Issue] whose issue number is in this list will be run rather than skipped.
143143
-->
144-
<PropertyGroup Condition="'$(IncludeTestsWithIssues)' == '' and $(WithCategories.ToLower().Contains('failing'))">
145-
<IncludeTestsWithIssues>true</IncludeTestsWithIssues>
146-
</PropertyGroup>
147-
144+
<PropertyGroup Condition="'$(IncludeTestsWithIssues)' == '' and $(WithCategories.ToLower().Contains('failing'))">
145+
<IncludeTestsWithIssues>true</IncludeTestsWithIssues>
146+
</PropertyGroup>
147+
148+
<PropertyGroup Condition="'$(RunWithCoreWCF)' == ''">
149+
<RunWithCoreWCF></RunWithCoreWCF>
150+
</PropertyGroup>
148151
<!--
149152
GeneratedTestPropertiesFileName:
150153
The full path of the C# file that will be generated at build time to

src/System.Private.ServiceModel/tests/Common/Infrastructure/testproperties.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace Infrastructure.Common
5050
public static readonly string ExplicitPassword_PropertyName = "ExplicitPassword"%3B
5151
public static readonly string SSL_Available_PropertyName = "SSL_Available"%3B
5252
public static readonly string IncludeTestsWithIssues_PropertyName = "IncludeTestsWithIssues"%3B
53+
public static readonly string RunWithCoreWCF_PropertyName = "RunWithCoreWCF"%3B
5354
5455
static partial void Initialize(Dictionary<string, string> properties)
5556
{
@@ -86,6 +87,7 @@ namespace Infrastructure.Common
8687
properties["ExplicitPassword"] = "$(ExplicitPassword)"%3B
8788
properties["SSL_Available"] = "$(SSL_Available)"%3B
8889
properties["IncludeTestsWithIssues"] = "$(IncludeTestsWithIssues)"%3B
90+
properties["RunWithCoreWCF"] = "$(RunWithCoreWCF)"%3B
8991
}
9092
}
9193
}

src/System.Private.ServiceModel/tests/Scenarios/Binding/Http/NetHttpBindingTests.4.0.0.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
using Infrastructure.Common;
88
using Xunit;
99

10-
public static class Binding_Http_NetHttpBindingTests
10+
public class Binding_Http_NetHttpBindingTests : ConditionalWcfTest
1111
{
1212
[WcfTheory]
13+
[Condition(nameof(Skip_CoreWCFService_FailedTest))]
1314
[InlineData(NetHttpMessageEncoding.Binary)]
1415
[InlineData(NetHttpMessageEncoding.Text)]
1516
[InlineData(NetHttpMessageEncoding.Mtom)]

0 commit comments

Comments
 (0)