Skip to content

Commit 7cf4597

Browse files
committed
Fix more async flakiness
1 parent 7c0f208 commit 7cf4597

2 files changed

Lines changed: 34 additions & 32 deletions

File tree

server-adobe@2021.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"name": "cordial-sdk-adobe@2021",
3-
"app": {
4-
"serverHomeDirectory": ".engine/adobe2021",
5-
"cfengine": "adobe@2021"
6-
},
7-
"web": {
8-
"http": {
9-
"port": "60298"
2+
"name":"cordial-sdk-adobe@2021",
3+
"app":{
4+
"serverHomeDirectory":".engine/adobe2021",
5+
"cfengine":"adobe@2021"
106
},
11-
"rewrites": {
12-
"enable": "true"
7+
"web":{
8+
"http":{
9+
"port":"60298"
10+
},
11+
"rewrites":{
12+
"enable":"true"
13+
}
14+
},
15+
"jvm":{
16+
"heapSize":"1024",
17+
"javaVersion":"openjdk11_jre"
18+
},
19+
"openBrowser":"false",
20+
"scripts":{
21+
"onServerInstall":"cfpm install zip,debugger"
1322
}
14-
},
15-
"jvm": {
16-
"heapSize": "1024",
17-
"javaVersion": "openjdk11_jre"
18-
},
19-
"openBrowser": "false",
20-
"scripts": {
21-
"onServerInstall": "cfpm install zip,debugger"
22-
}
2323
}

tests/specs/unit/SubscriptionsSpec.cfc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,15 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
260260
} );
261261

262262
it( "handles async future failures and returns mixed results", function() {
263+
variables.fakeInvocationCount = 0;
263264
variables.hyper
264265
.fake( {
265266
"/v2/contacts": function( newFakeResponse, req ) {
266-
return [
267-
newFakeResponse( 500, "Internal Server Error", "{}" ),
268-
newFakeResponse( 201, "Created", "{}" )
269-
];
267+
variables.fakeInvocationCount++;
268+
if ( variables.fakeInvocationCount == 1 ) {
269+
throw( type = "AsyncFutureBoom", message = "Boom from fake response callback" );
270+
}
271+
return newFakeResponse( 201, "Created", "{}" );
270272
}
271273
} )
272274
.preventStrayRequests();
@@ -285,15 +287,15 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
285287
return !item.success;
286288
} );
287289
expect( failedResults ).toHaveLength( 1 );
288-
expect( failedResults[ 1 ].statusCode ).toBe( 500 );
289-
expect( failedResults[ 1 ].error ).toInclude( "Internal Server Error" );
290-
expect(
291-
result.results
292-
.map( function( item ) {
293-
return item.subscriber;
294-
} )
295-
.sort( "textnocase" )
296-
).toBe( [ "explode@example.com", "ok@example.com" ].sort( "textnocase" ) );
290+
expect( failedResults[ 1 ].statusCode ).toBe( 0 );
291+
expect( failedResults[ 1 ].error ).toInclude( "Boom from fake response callback" );
292+
var actualSubscribers = result.results.map( function( item ) {
293+
return item.subscriber;
294+
} );
295+
var expectedSubscribers = [ "explode@example.com", "ok@example.com" ];
296+
arraySort( actualSubscribers, "textnocase" );
297+
arraySort( expectedSubscribers, "textnocase" );
298+
expect( actualSubscribers ).toBe( expectedSubscribers );
297299
} );
298300

299301
it( "falls back to sequential sends when async manager is missing", function() {

0 commit comments

Comments
 (0)