mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	zblueslip: Store more_info and stack as well in the logs.
Now, the get_test_logs() returns an array of objects instead
of an array of strings as follows:
[{
  message: "something",
  more_info: {},
  stack: {},
}]
			
			
This commit is contained in:
		
				
					committed by
					
						
						showell
					
				
			
			
				
	
			
			
			
						parent
						
							61f8a6fd55
						
					
				
				
					commit
					e14dbecdd1
				
			@@ -267,7 +267,7 @@ run_test('retry', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            assert.equal(blueslip.get_test_logs('log').length, 1);
 | 
					            assert.equal(blueslip.get_test_logs('log').length, 1);
 | 
				
			||||||
            assert.equal(blueslip.get_test_logs('log')[0], 'Retrying idempotent[object Object]');
 | 
					            assert.equal(blueslip.get_test_logs('log')[0].message, 'Retrying idempotent[object Object]');
 | 
				
			||||||
            blueslip.clear_test_data();
 | 
					            blueslip.clear_test_data();
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ run_test('report_late_add', () => {
 | 
				
			|||||||
    reload.is_in_progress = true;
 | 
					    reload.is_in_progress = true;
 | 
				
			||||||
    people.report_late_add(55, 'foo@example.com');
 | 
					    people.report_late_add(55, 'foo@example.com');
 | 
				
			||||||
    assert.equal(blueslip.get_test_logs('log').length, 1);
 | 
					    assert.equal(blueslip.get_test_logs('log').length, 1);
 | 
				
			||||||
    assert.equal(blueslip.get_test_logs('log')[0], 'Added user late: user_id=55 email=foo@example.com');
 | 
					    assert.equal(blueslip.get_test_logs('log')[0].message, 'Added user late: user_id=55 email=foo@example.com');
 | 
				
			||||||
    assert.equal(blueslip.get_test_logs('error').length, 0);
 | 
					    assert.equal(blueslip.get_test_logs('error').length, 0);
 | 
				
			||||||
    blueslip.clear_test_data();
 | 
					    blueslip.clear_test_data();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,13 +60,13 @@ exports.make_zblueslip = function (opts) {
 | 
				
			|||||||
    Object.keys(opts).forEach(name => {
 | 
					    Object.keys(opts).forEach(name => {
 | 
				
			||||||
        if (!opts[name]) {
 | 
					        if (!opts[name]) {
 | 
				
			||||||
            // should just log the message.
 | 
					            // should just log the message.
 | 
				
			||||||
            lib[name] = function (message) {
 | 
					            lib[name] = function (message, more_info, stack) {
 | 
				
			||||||
                lib.test_logs[name].push(message);
 | 
					                lib.test_logs[name].push({message, more_info, stack});
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        lib[name] = function (message) {
 | 
					        lib[name] = function (message, more_info, stack) {
 | 
				
			||||||
            lib.test_logs[name].push(message);
 | 
					            lib.test_logs[name].push({message, more_info, stack});
 | 
				
			||||||
            const exact_match_fail = lib.test_data[name].indexOf(message) === -1;
 | 
					            const exact_match_fail = lib.test_data[name].indexOf(message) === -1;
 | 
				
			||||||
            const string_match_fail = lib.test_data[name].indexOf(message.toString()) === -1;
 | 
					            const string_match_fail = lib.test_data[name].indexOf(message.toString()) === -1;
 | 
				
			||||||
            if (exact_match_fail && string_match_fail) {
 | 
					            if (exact_match_fail && string_match_fail) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user