Skip to content

Commit 73fea12

Browse files
author
xval
committed
Merge pull request #152 from telefonicaid/error_state
Set state to error instead of completed
2 parents 12f8b8d + 96c38f9 commit 73fea12

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/evPersistence.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function init(emitter) {
4444
} else {
4545
type = data.state === MG.STATE_ERROR ? TYPE_ERROR : data.task.headers[MG.HEAD_RELAYER_PERSISTENCE];
4646
respObj = data.result || data.err || {};
47-
respObj['state'] = 'completed';
47+
respObj.state = data.state;
4848
}
4949

5050
doPersistence(data.task, respObj, type, function(error, result) {

test/e2e/persistenceCallbackTest.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ describe('Feature: Persistence Callback #FPT #FCB', function() {
262262
' first callback is incorrect', function() {
263263

264264
it('CallBack Incorrect', function(done) {
265-
265+
this.timeout(3000)
266266
var id, type = 'POST', httpCallBack = 'http://noexiste:2222';
267267

268268
var simpleServer = server.serverListener(
@@ -277,6 +277,7 @@ describe('Feature: Persistence Callback #FPT #FCB', function() {
277277

278278
utils.makeRequest(options, content, function(e, data) {
279279
id = JSON.parse(data).id;
280+
// console.log(id);
280281
});
281282
},
282283

@@ -314,7 +315,7 @@ describe('Feature: Persistence Callback #FPT #FCB', function() {
314315

315316
utils.makeRequest(options, '', checkResponse);
316317

317-
}, 10);
318+
}, 30);
318319
}
319320
);
320321

test/e2e/persistenceTest.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ describe('Feature: Persistence #FPT', function() {
157157
options.headers = {};
158158
options.method = 'POST';
159159
options.headers['X-Relayer-Host'] = 'notAServer:8014';
160-
options.headers['X-relayer-persistence'] = 'BODY';
160+
options.headers['X-relayer-persistence'] = 'HEADER';
161161
options.headers['test-header'] = 'test header';
162162

163163
async.series([
@@ -186,7 +186,7 @@ describe('Feature: Persistence #FPT', function() {
186186

187187
var JSONres = JSON.parse(data);
188188

189-
if (!checked && res.statusCode !== 404 && JSONres.state === 'completed') {
189+
if (!checked && res.statusCode !== 400 && JSONres.state === 'error') {
190190

191191
clearInterval(interval);
192192

@@ -202,7 +202,7 @@ describe('Feature: Persistence #FPT', function() {
202202

203203
utils.makeRequest(options, '', checkResponse);
204204

205-
}, 10);
205+
}, 20);
206206
}
207207
], function(err, res) {
208208
var resGet = res[1];

0 commit comments

Comments
 (0)