@@ -18,7 +18,6 @@ public class DistributedApplicationTests
1818{
1919 private readonly ITestOutputHelper _testOutputHelper ;
2020
21- // Primary constructors don't get ITestOutputHelper injected
2221 public DistributedApplicationTests ( ITestOutputHelper testOutputHelper )
2322 {
2423 _testOutputHelper = testOutputHelper ;
@@ -187,109 +186,6 @@ public Task AfterEndpointsAllocatedAsync(DistributedApplicationModel appModel, C
187186 }
188187 }
189188
190- [ LocalOnlyFact ]
191- public async Task TestProjectStartsAndStopsCleanly ( )
192- {
193- var testProgram = CreateTestProgram ( ) ;
194- testProgram . AppBuilder . Services . AddLogging ( b => b . AddXunit ( _testOutputHelper ) ) ;
195-
196- testProgram . AppBuilder . Services
197- . AddHttpClient ( )
198- . ConfigureHttpClientDefaults ( b =>
199- {
200- b . UseSocketsHttpHandler ( ( handler , sp ) => handler . PooledConnectionLifetime = TimeSpan . FromSeconds ( 5 ) ) ;
201- } ) ;
202-
203- await using var app = testProgram . Build ( ) ;
204-
205- var client = app . Services . GetRequiredService < IHttpClientFactory > ( ) . CreateClient ( ) ;
206-
207- using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 1 ) ) ;
208-
209- await app . StartAsync ( cts . Token ) ;
210-
211- // Make sure each service is running
212- await testProgram . ServiceABuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
213- await testProgram . ServiceBBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
214- await testProgram . ServiceCBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
215- }
216-
217- [ LocalOnlyFact ]
218- public async Task TestPortOnServiceBindingAnnotationAndAllocatedEndpointAnnotationMatch ( )
219- {
220- var testProgram = CreateTestProgram ( ) ;
221- testProgram . AppBuilder . Services . AddLogging ( b => b . AddXunit ( _testOutputHelper ) ) ;
222-
223- testProgram . AppBuilder . Services
224- . AddHttpClient ( )
225- . ConfigureHttpClientDefaults ( b =>
226- {
227- b . UseSocketsHttpHandler ( ( handler , sp ) => handler . PooledConnectionLifetime = TimeSpan . FromSeconds ( 5 ) ) ;
228- } ) ;
229-
230- await using var app = testProgram . Build ( ) ;
231-
232- var client = app . Services . GetRequiredService < IHttpClientFactory > ( ) . CreateClient ( ) ;
233-
234- using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 1 ) ) ;
235-
236- await app . StartAsync ( cts . Token ) ;
237-
238- // Make sure each service is running
239- await testProgram . ServiceABuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
240- await testProgram . ServiceBBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
241- await testProgram . ServiceCBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
242-
243- foreach ( var projectBuilders in testProgram . ServiceProjectBuilders )
244- {
245- var serviceBinding = projectBuilders . Resource . Annotations . OfType < ServiceBindingAnnotation > ( ) . Single ( ) ;
246- var allocatedEndpoint = projectBuilders . Resource . Annotations . OfType < AllocatedEndpointAnnotation > ( ) . Single ( ) ;
247-
248- Assert . Equal ( serviceBinding . Port , allocatedEndpoint . Port ) ;
249- }
250- }
251-
252- [ LocalOnlyFact ]
253- public async Task TestPortOnServiceBindingAnnotationAndAllocatedEndpointAnnotationMatchForReplicatedServices ( )
254- {
255- var testProgram = CreateTestProgram ( ) ;
256-
257- foreach ( var serviceBuilder in testProgram . ServiceProjectBuilders )
258- {
259- serviceBuilder . WithReplicas ( 2 ) ;
260- }
261-
262- testProgram . AppBuilder . Services . AddLogging ( b => b . AddXunit ( _testOutputHelper ) ) ;
263-
264- testProgram . AppBuilder . Services
265- . AddHttpClient ( )
266- . ConfigureHttpClientDefaults ( b =>
267- {
268- b . UseSocketsHttpHandler ( ( handler , sp ) => handler . PooledConnectionLifetime = TimeSpan . FromSeconds ( 5 ) ) ;
269- } ) ;
270-
271- await using var app = testProgram . Build ( ) ;
272-
273- var client = app . Services . GetRequiredService < IHttpClientFactory > ( ) . CreateClient ( ) ;
274-
275- using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 1 ) ) ;
276-
277- await app . StartAsync ( cts . Token ) ;
278-
279- // Make sure each service is running
280- await testProgram . ServiceABuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
281- await testProgram . ServiceBBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
282- await testProgram . ServiceCBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
283-
284- foreach ( var projectBuilders in testProgram . ServiceProjectBuilders )
285- {
286- var serviceBinding = projectBuilders . Resource . Annotations . OfType < ServiceBindingAnnotation > ( ) . Single ( ) ;
287- var allocatedEndpoint = projectBuilders . Resource . Annotations . OfType < AllocatedEndpointAnnotation > ( ) . Single ( ) ;
288-
289- Assert . Equal ( serviceBinding . Port , allocatedEndpoint . Port ) ;
290- }
291- }
292-
293189 [ LocalOnlyFact ]
294190 public async Task TestServicesWithMultipleReplicas ( )
295191 {
@@ -315,6 +211,11 @@ public async Task TestServicesWithMultipleReplicas()
315211
316212 await app . StartAsync ( cts . Token ) ;
317213
214+ // Give the server some time to be ready to handle requests to
215+ // minimize the amount of retries the clients have to do (and log).
216+
217+ await Task . Delay ( 1000 , cts . Token ) ;
218+
318219 // Make sure services A and C are running
319220 await testProgram . ServiceABuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
320221 await testProgram . ServiceCBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
@@ -336,67 +237,6 @@ public async Task TestServicesWithMultipleReplicas()
336237 }
337238 }
338239
339- [ LocalOnlyFact ]
340- public async Task VerifyHealthyOnIntegrationServiceA ( )
341- {
342- var testProgram = CreateTestProgram ( includeIntegrationServices : true ) ;
343- testProgram . AppBuilder . Services . AddLogging ( b => b . AddXunit ( _testOutputHelper ) ) ;
344-
345- testProgram . AppBuilder . Services
346- . AddHttpClient ( )
347- . ConfigureHttpClientDefaults ( b =>
348- {
349- b . UseSocketsHttpHandler ( ( handler , sp ) => handler . PooledConnectionLifetime = TimeSpan . FromSeconds ( 5 ) ) ;
350- } ) ;
351-
352- await using var app = testProgram . Build ( ) ;
353-
354- var client = app . Services . GetRequiredService < IHttpClientFactory > ( ) . CreateClient ( ) ;
355-
356- using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 1 ) ) ;
357-
358- await app . StartAsync ( cts . Token ) ;
359-
360- // Make sure all services are running
361- await testProgram . ServiceABuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
362- await testProgram . ServiceBBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
363- await testProgram . ServiceCBuilder . HttpGetPidAsync ( client , "http" , cts . Token ) ;
364- await testProgram . IntegrationServiceABuilder ! . HttpGetPidAsync ( client , "http" , cts . Token ) ;
365-
366- // We wait until timeout for the /health endpoint to return successfully. We assume
367- // that components wired up into this project have health checks enabled.
368- await testProgram . IntegrationServiceABuilder ! . WaitForHealthyStatus ( client , "http" , cts . Token ) ;
369- }
370-
371- [ LocalOnlyFact ( "node" ) ]
372- public async Task VerifyNodeAppWorks ( )
373- {
374- var testProgram = CreateTestProgram ( includeNodeApp : true ) ;
375- testProgram . AppBuilder . Services . AddLogging ( b => b . AddXunit ( _testOutputHelper ) ) ;
376-
377- testProgram . AppBuilder . Services
378- . AddHttpClient ( )
379- . ConfigureHttpClientDefaults ( b =>
380- {
381- b . UseSocketsHttpHandler ( ( handler , sp ) => handler . PooledConnectionLifetime = TimeSpan . FromSeconds ( 5 ) ) ;
382- b . AddStandardResilienceHandler ( ) ;
383- } ) ;
384-
385- await using var app = testProgram . Build ( ) ;
386-
387- var client = app . Services . GetRequiredService < IHttpClientFactory > ( ) . CreateClient ( ) ;
388-
389- using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 1 ) ) ;
390-
391- await app . StartAsync ( cts . Token ) ;
392-
393- var response0 = await testProgram . NodeAppBuilder ! . HttpGetWithRetryAsync ( client , "http" , "/" , cts . Token ) ;
394- var response1 = await testProgram . NpmAppBuilder ! . HttpGetWithRetryAsync ( client , "http" , "/" , cts . Token ) ;
395-
396- Assert . Equal ( "Hello from node!" , response0 ) ;
397- Assert . Equal ( "Hello from node!" , response1 ) ;
398- }
399-
400240 [ LocalOnlyFact ( "docker" ) ]
401241 public async Task VerifyDockerAppWorks ( )
402242 {
0 commit comments