Update logging to be info level, fix un-staling of issues (#83)

* The bot would un-stale issues because of how it checked staleness
* Made logging info by default so its easier to troubleshoot customer issues/runs
* Updated operation counts
This commit is contained in:
Ross Brodbeck
2020-05-26 09:16:38 -04:00
committed by GitHub
parent 96b682d29f
commit b6f9559915
3 changed files with 142 additions and 106 deletions

View File

@@ -426,6 +426,7 @@ test('exempt issue labels will not be marked stale (multi issue label)', async (
expect(processor.staleIssues.length).toEqual(0);
expect(processor.closedIssues.length).toEqual(0);
expect(processor.removedLabelIssues.length).toEqual(0);
});
test('exempt pr labels will not be marked stale', async () => {
@@ -474,6 +475,7 @@ test('stale issues should not be closed if days is set to -1', async () => {
await processor.processIssues(1);
expect(processor.closedIssues.length).toEqual(0);
expect(processor.removedLabelIssues.length).toEqual(0);
});
test('stale label should be removed if a comment was added to a stale issue', async () => {
@@ -562,6 +564,7 @@ test('stale issues should not be closed until after the closed number of days',
await processor.processIssues(1);
expect(processor.closedIssues.length).toEqual(0);
expect(processor.removedLabelIssues.length).toEqual(0);
expect(processor.staleIssues.length).toEqual(1);
});
@@ -593,5 +596,37 @@ test('stale issues should be closed if the closed nubmer of days (additive) is a
await processor.processIssues(1);
expect(processor.closedIssues.length).toEqual(1);
expect(processor.removedLabelIssues.length).toEqual(0);
expect(processor.staleIssues.length).toEqual(0);
});
test('stale issues should not be closed until after the closed number of days (long)', async () => {
let lastUpdate = new Date();
lastUpdate.setDate(lastUpdate.getDate() - 10);
const TestIssueList: Issue[] = [
generateIssue(
1,
'An issue that should be marked stale but not closed',
lastUpdate.toString(),
false
)
];
const opts = DefaultProcessorOptions;
opts.daysBeforeStale = 5; // stale after 5 days
opts.daysBeforeClose = 20; // closes after 25 days
const processor = new IssueProcessor(
opts,
async p => (p == 1 ? TestIssueList : []),
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);
// process our fake issue list
await processor.processIssues(1);
expect(processor.closedIssues.length).toEqual(0);
expect(processor.removedLabelIssues.length).toEqual(0);
expect(processor.staleIssues.length).toEqual(1);
});