Bug 1527673 - Output histogram name in asserts r=chutten

Depends on D21531

Differential Revision: https://phabricator.services.mozilla.com/D21532

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan-Erik Rediger 2019-02-28 18:44:45 +00:00
Родитель 125702c2b2
Коммит f33143837e
1 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -233,13 +233,13 @@ var TelemetryTestUtils = {
if (i == index) {
found = true;
Assert.equal(val, expected,
`expected counts should match for the histogram index ${i}`);
`expected counts should match for ${histogram.name()} at index ${i}`);
} else {
Assert.equal(val, 0,
`unexpected counts should be zero for the histogram index ${i}`);
`unexpected counts should be zero for ${histogram.name()} at index ${i}`);
}
}
Assert.ok(found, `Should have found an entry for histogram index ${index}`);
Assert.ok(found, `Should have found an entry for ${histogram.name()} at index ${index}`);
},
/**
@ -252,12 +252,12 @@ var TelemetryTestUtils = {
assertKeyedHistogramSum(histogram, key, expected) {
const snapshot = histogram.snapshot();
if (expected === undefined) {
Assert.ok(!(key in snapshot), `The histogram must not contain ${key}.`);
Assert.ok(!(key in snapshot), `The histogram ${histogram.name()} must not contain ${key}.`);
return;
}
Assert.ok(key in snapshot, `The histogram must contain ${key}.`);
Assert.ok(key in snapshot, `The histogram ${histogram.name()} must contain ${key}.`);
Assert.equal(snapshot[key].sum, expected,
`The key ${key} must contain the expected sum.`);
`The key ${key} must contain the expected sum in ${histogram.name()}.`);
},
/**
@ -272,16 +272,16 @@ var TelemetryTestUtils = {
assertKeyedHistogramValue(histogram, key, index, expected) {
const snapshot = histogram.snapshot();
if (!(key in snapshot)) {
Assert.ok(false, `The histogram must contain ${key}`);
Assert.ok(false, `The histogram ${histogram.name()} must contain ${key}`);
return;
}
for (let [i, val] of Object.entries(snapshot[key].values)) {
if (i == index) {
Assert.equal(val, expected,
`expected counts should match for the histogram index ${i}`);
`expected counts should match for ${histogram.name()} at index ${i}`);
} else {
Assert.equal(val, 0,
`unexpected counts should be zero for the histogram index ${i}`);
`unexpected counts should be zero for ${histogram.name() } at index ${i}`);
}
}
},