Skip to content

Commit dc8339f

Browse files
committed
add descriptions to each kind of mismatches
1 parent 93723a5 commit dc8339f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

scripts/es-db-compare/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ function getESSearchCriteria() {
101101
function getTemplate() {
102102
handlebars.registerHelper('getValue', (data, key) => data[key]);
103103
handlebars.registerHelper('toJSON', obj => JSON.stringify(obj, null, 2));
104+
handlebars.registerHelper('describeKind', (kind) => {
105+
if (kind === 'modify') {
106+
return 'values differ';
107+
}
108+
if (kind === 'add') {
109+
return 'missed in DB';
110+
}
111+
if (kind === 'delete') {
112+
return 'missed in ES';
113+
}
114+
return 'unknown';
115+
});
104116
const template = handlebars.compile(fs.readFileSync(path.join(__dirname, 'report.mustache')).toString());
105117
return template;
106118
}

scripts/es-db-compare/report.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ There are {{ project.meta.totalObjects }} objects with inconsistencies found in
4848
{{/if}}
4949
<ui>
5050
{{#each this.project }}
51-
<li>{{ this.path }} (kind: {{ this.kind }})</li>
51+
<li>{{ this.path }} ({{describeKind this.kind }})</li>
5252
{{/each}}
5353
</ui>
5454

@@ -61,7 +61,7 @@ There are {{ project.meta.totalObjects }} objects with inconsistencies found in
6161
<p>{{ this.length }} mismatches:</p>
6262
<ui>
6363
{{#each this }}
64-
<li>{{ this.path }} (kind: {{ this.kind }})</li>
64+
<li>{{ this.path }} ({{ this.kind }})</li>
6565
{{/each}}
6666
</ui>
6767
{{/each}}

0 commit comments

Comments
 (0)