mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
IMPALA-13985: Fix webUI JS tests naming scheme
The names of webUI's JS tests seem arbitrary and vary widely from the
the general naming scheme of other test framework generated JUnitXMLs.
This patch provides consistency to the naming scheme.
All the webUI JS tests follow the following naming scheme now.
webui.js_tests.<module>.<function>.<description>
jest-junit package has been configured to use the following config -
{
"classNameTemplate": "{classname}",
"titleTemplate": "{title}",
"ancestorSeparator": "."
}
Example:
Within JUnitXML,
<testsuites ... >
...
<testsuite
name = "webui.js_tests.fragment_diagram.getSvgTests"
... >
...
<testcase
classname="webui.js_tests.fragment_diagram.getSvgTests"
name="basic_case.SvgRect"
... >
</testcase>
...
</testsuite>
...
</testsuites>
Change-Id: I5715d47cef5c1c3c06b4f2de7fe467aee3de8868
Reviewed-on: http://gerrit.cloudera.org:8080/23071
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Riza Suminto <riza.suminto@cloudera.com>
This commit is contained in:
committed by
Riza Suminto
parent
b201b81598
commit
08ae29f47b
@@ -15,6 +15,9 @@
|
|||||||
"reporters": [ "default", "jest-junit" ]
|
"reporters": [ "default", "jest-junit" ]
|
||||||
},
|
},
|
||||||
"jest-junit": {
|
"jest-junit": {
|
||||||
"outputName": "js-tests.xml"
|
"outputName": "js-tests.xml",
|
||||||
|
"classNameTemplate": "{classname}",
|
||||||
|
"titleTemplate": "{title}",
|
||||||
|
"ancestorSeparator": "."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import {describe, test, expect} from "@jest/globals";
|
|||||||
import {readFileSync} from "node:fs";
|
import {readFileSync} from "node:fs";
|
||||||
|
|
||||||
// JEST does not support workers, so "profileParseWorker.js" cannot be tested directly
|
// JEST does not support workers, so "profileParseWorker.js" cannot be tested directly
|
||||||
describe("Test Compression Library", () => {
|
describe("webui.js_tests.queries.profileParseWorker", () => {
|
||||||
// Test whether the compression library imported by the worker script
|
// Test whether the compression library imported by the worker script
|
||||||
// properly utilizes the pako library's compression methods
|
// properly utilizes the pako library's compression methods
|
||||||
test("Basic Test", () => {
|
test("basic_test", () => {
|
||||||
const exampleJSONProfileText = readFileSync("../../../testdata/impala-profiles/"
|
const exampleJSONProfileText = readFileSync("../../../testdata/impala-profiles/"
|
||||||
+ "impala_profile_log_tpcds_compute_stats_extended.expected.pretty.json",
|
+ "impala_profile_log_tpcds_compute_stats_extended.expected.pretty.json",
|
||||||
{encoding : "utf-8"});
|
{encoding : "utf-8"});
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import {exportedForTest, generateTimesamples, clearTimeseriesValues,
|
|||||||
mapTimeseriesCounters, aggregateProfileTimeseries} from
|
mapTimeseriesCounters, aggregateProfileTimeseries} from
|
||||||
"scripts/query_timeline/chart_commons.js";
|
"scripts/query_timeline/chart_commons.js";
|
||||||
|
|
||||||
describe("Test mapTimeseriesCounters", () => {
|
describe("webui.js_tests.chart_commons.mapTimeseriesCounters", () => {
|
||||||
// Test whether the method correctly searches and maps indexes of counters based
|
// Test whether the method correctly searches and maps indexes of counters based
|
||||||
// on counter_name
|
// on counter_name
|
||||||
test("Basic Test (Serial Order)", () => {
|
test("basic_test.serial_order", () => {
|
||||||
const parent_profile =
|
const parent_profile =
|
||||||
{
|
{
|
||||||
"profile_name" : "Per Node Profiles",
|
"profile_name" : "Per Node Profiles",
|
||||||
@@ -65,7 +65,7 @@ describe("Test mapTimeseriesCounters", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Basic Test (Reverse Order)", () => {
|
test("basic_test.reverse_order", () => {
|
||||||
const parent_profile =
|
const parent_profile =
|
||||||
{
|
{
|
||||||
"profile_name" : "Per Node Profiles",
|
"profile_name" : "Per Node Profiles",
|
||||||
@@ -107,7 +107,7 @@ describe("Test mapTimeseriesCounters", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Edge Case (No such 'counter_name' within profile)", () => {
|
test("edge_case.counter_name_undefined", () => {
|
||||||
const parent_profile =
|
const parent_profile =
|
||||||
{
|
{
|
||||||
"profile_name" : "Per Node Profiles",
|
"profile_name" : "Per Node Profiles",
|
||||||
@@ -151,12 +151,12 @@ describe("Test mapTimeseriesCounters", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Test accumulateTimeseriesValues", () => {
|
describe("webui.js_tests.chart_commons.accumulateTimeseriesValues", () => {
|
||||||
// Test whether the method correctly accumlates values after parsing values from 'data'
|
// Test whether the method correctly accumlates values after parsing values from 'data'
|
||||||
// in 'time_series_counters' and correctly updates 'max_samples' even in corner cases
|
// in 'time_series_counters' and correctly updates 'max_samples' even in corner cases
|
||||||
const {accumulateTimeseriesValues} = exportedForTest;
|
const {accumulateTimeseriesValues} = exportedForTest;
|
||||||
const DATA_TYPE = "value type";
|
const DATA_TYPE = "value type";
|
||||||
test("Basic Case (time_series_counter.num > max_samples.collected)", () => {
|
test("basic_case.samples_greater_than_collected", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 7,
|
allocated : 7,
|
||||||
period : 0,
|
period : 0,
|
||||||
@@ -183,7 +183,7 @@ describe("Test accumulateTimeseriesValues", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Basic Case (time_series_counter.period > max_samples.period", () => {
|
test("basic_case.sample_period_greater_than_current_period", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 7,
|
allocated : 7,
|
||||||
period : 100,
|
period : 100,
|
||||||
@@ -210,8 +210,7 @@ describe("Test accumulateTimeseriesValues", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test(`Basic Case (time_series_counter.period <= max_samples.period
|
test("basic_case.period_and_samples_num_within_limits", () => {
|
||||||
&& time_series_counter.num <= max_samples.collected)`, () => {
|
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 7,
|
allocated : 7,
|
||||||
period : 100,
|
period : 100,
|
||||||
@@ -238,7 +237,7 @@ describe("Test accumulateTimeseriesValues", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test(`Edge Case (values_array length is smaller than collected samples)`, () => {
|
test("edge_case.allocated_values_array_smaller_than_collected_samples", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 2,
|
allocated : 2,
|
||||||
period : 100,
|
period : 100,
|
||||||
@@ -266,11 +265,11 @@ describe("Test accumulateTimeseriesValues", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Test generateTimesamples", () => {
|
describe("webui.js_tests.chart_commons.generateTimesamples", () => {
|
||||||
// Test whether time sample values generated based on 'max_samples' are correct,
|
// Test whether time sample values generated based on 'max_samples' are correct,
|
||||||
// even in corner cases, with different 'max_samples' scenarios
|
// even in corner cases, with different 'max_samples' scenarios
|
||||||
const DATA_TYPE = "timesample type";
|
const DATA_TYPE = "timesample type";
|
||||||
test("Basic Case (max_samples.allocated > max_samples.available)", () => {
|
test("basic_case.available_samples_within_allocated_size", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 10,
|
allocated : 10,
|
||||||
period : 1000,
|
period : 1000,
|
||||||
@@ -286,7 +285,7 @@ describe("Test generateTimesamples", () => {
|
|||||||
null, null, null, null]);
|
null, null, null, null]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Edge Case (max_samples.allocated < max_samples.available)", () => {
|
test("edge_case.available_samples_exceed_allocated_size", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 10,
|
allocated : 10,
|
||||||
period : 1000,
|
period : 1000,
|
||||||
@@ -302,7 +301,7 @@ describe("Test generateTimesamples", () => {
|
|||||||
4.5, 5]);
|
4.5, 5]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Edge Case (max_samples.allocated = max_samples.available)", () => {
|
test("edge_case.same_num_available_samples_and_allocated", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 10,
|
allocated : 10,
|
||||||
period : 1000,
|
period : 1000,
|
||||||
@@ -318,10 +317,10 @@ describe("Test generateTimesamples", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Test clearTimeseriesValues", () => {
|
describe("webui.js_tests.chart_commons.clearTimeseriesValues", () => {
|
||||||
// Test whether Timeseries arrays are being properly truncated in the correct range
|
// Test whether Timeseries arrays are being properly truncated in the correct range
|
||||||
const DATA_TYPE = "value type";
|
const DATA_TYPE = "value type";
|
||||||
test("Basic Case (max_samples.available < max_samples.allocated)", () => {
|
test("basic_case.available_samples_within_allocated_size", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 7,
|
allocated : 7,
|
||||||
period : 1000,
|
period : 1000,
|
||||||
@@ -335,7 +334,7 @@ describe("Test clearTimeseriesValues", () => {
|
|||||||
expect(values_array).toEqual([DATA_TYPE, 0, null, null, null, 10, 100, 10]);
|
expect(values_array).toEqual([DATA_TYPE, 0, null, null, null, 10, 100, 10]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Edge Case (max_samples.available >= max_samples.allocated)", () => {
|
test("edge_case.available_samples_exceed_allocated_size", () => {
|
||||||
const max_samples = {
|
const max_samples = {
|
||||||
allocated : 7,
|
allocated : 7,
|
||||||
period : 1000,
|
period : 1000,
|
||||||
@@ -351,9 +350,9 @@ describe("Test clearTimeseriesValues", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Test aggregateProfileTimeseries", () => {
|
describe("webui.js_tests.chart_commons.aggregateProfileTimeseries", () => {
|
||||||
// Test correctness of values being aggregated from parsing the profile
|
// Test correctness of values being aggregated from parsing the profile
|
||||||
test("Basic Case", () => {
|
test("basic_case", () => {
|
||||||
const parent_profile =
|
const parent_profile =
|
||||||
{
|
{
|
||||||
"profile_name" : "Per Node Profiles",
|
"profile_name" : "Per Node Profiles",
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
import {describe, test, expect} from "@jest/globals";
|
import {describe, test, expect} from "@jest/globals";
|
||||||
import {exportedForTest} from "scripts/query_timeline/fragment_diagram.js";
|
import {exportedForTest} from "scripts/query_timeline/fragment_diagram.js";
|
||||||
|
|
||||||
describe("Test getSvg*", () => {
|
describe("webui.js_tests.fragment_diagram.getSvgTests", () => {
|
||||||
// Test whether getSvg* methods correctly set attributes and return expected elements
|
// Test whether getSvg* methods correctly set attributes and return expected elements
|
||||||
const {getSvgRect, getSvgLine, getSvgText, getSvgTitle, getSvgGroup} = exportedForTest;
|
const {getSvgRect, getSvgLine, getSvgText, getSvgTitle, getSvgGroup} = exportedForTest;
|
||||||
const stroke_fill_colors = {black : "#000000", dark_grey : "#505050",
|
const stroke_fill_colors = {black : "#000000", dark_grey : "#505050",
|
||||||
light_grey : "#F0F0F0", transperent : "rgba(0, 0, 0, 0)"};
|
light_grey : "#F0F0F0", transperent : "rgba(0, 0, 0, 0)"};
|
||||||
|
|
||||||
test("Test getSvgRect", () => {
|
test("basic_case.SvgRect", () => {
|
||||||
expect(getSvgRect(stroke_fill_colors.transperent, 0, 0, 100, 100, "2 2",
|
expect(getSvgRect(stroke_fill_colors.transperent, 0, 0, 100, 100, "2 2",
|
||||||
stroke_fill_colors.black).outerHTML).toBe(
|
stroke_fill_colors.black).outerHTML).toBe(
|
||||||
`<rect x="0" y="0" width="100" height="100"`
|
`<rect x="0" y="0" width="100" height="100"`
|
||||||
@@ -34,14 +34,14 @@ describe("Test getSvg*", () => {
|
|||||||
+ ` stroke-dasharray="2 2"></rect>`);
|
+ ` stroke-dasharray="2 2"></rect>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test getSvgLine", () => {
|
test("basic_case.SvgLine", () => {
|
||||||
expect(getSvgLine(stroke_fill_colors.black, 0, 0, 100, 100, true).outerHTML).toBe(
|
expect(getSvgLine(stroke_fill_colors.black, 0, 0, 100, 100, true).outerHTML).toBe(
|
||||||
`<line x1="0" y1="0" x2="100" y2="100"`
|
`<line x1="0" y1="0" x2="100" y2="100"`
|
||||||
+ ` stroke="${stroke_fill_colors.black}"`
|
+ ` stroke="${stroke_fill_colors.black}"`
|
||||||
+ ` stroke-dasharray="2 2"></line>`);
|
+ ` stroke-dasharray="2 2"></line>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test getSvgText", () => {
|
test("basic_case.SvgText", () => {
|
||||||
expect(getSvgText("Text", stroke_fill_colors.black, 0, 0, 15, true, 300)
|
expect(getSvgText("Text", stroke_fill_colors.black, 0, 0, 15, true, 300)
|
||||||
.outerHTML).toBe(
|
.outerHTML).toBe(
|
||||||
`<text x="0" y="0" style="font-size: 10px;" dominant-baseline="middle" `
|
`<text x="0" y="0" style="font-size: 10px;" dominant-baseline="middle" `
|
||||||
@@ -49,11 +49,11 @@ describe("Test getSvg*", () => {
|
|||||||
+ `lengthAdjust="spacingAndGlyphs">Text</text>`);
|
+ `lengthAdjust="spacingAndGlyphs">Text</text>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test getSvgTitle", () => {
|
test("basic_case.SvgTitle", () => {
|
||||||
expect(getSvgTitle("Title").outerHTML).toBe("<title>Title</title>");
|
expect(getSvgTitle("Title").outerHTML).toBe("<title>Title</title>");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test getSvgGroup", () => {
|
test("basic_case.SvgGroup", () => {
|
||||||
expect(getSvgGroup().outerHTML).toBe("<g></g>");
|
expect(getSvgGroup().outerHTML).toBe("<g></g>");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
import {exportedForTest} from "scripts/query_timeline/fragment_metrics_diagram.js";
|
import {exportedForTest} from "scripts/query_timeline/fragment_metrics_diagram.js";
|
||||||
|
|
||||||
describe("Test initializeFragmentMetrics", () => {
|
describe("webui.js_tests.fragment_metrics_diagram.initializeFragmentMetrics", () => {
|
||||||
// Test whether aggregate arrays and time sample arrays are correctly allocated
|
// Test whether aggregate arrays and time sample arrays are correctly allocated
|
||||||
// based on counters and max_samples
|
// based on counters and max_samples
|
||||||
const {initializeFragmentMetrics} = exportedForTest;
|
const {initializeFragmentMetrics} = exportedForTest;
|
||||||
test("Basic Test", () => {
|
test("basic_case", () => {
|
||||||
const parent_profile =
|
const parent_profile =
|
||||||
{
|
{
|
||||||
"profile_name" : "Coordinator Fragment F31",
|
"profile_name" : "Coordinator Fragment F31",
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
import {describe, test, expect} from "@jest/globals";
|
import {describe, test, expect} from "@jest/globals";
|
||||||
import {exportedForTest} from "scripts/query_timeline/host_utilization_diagram.js";
|
import {exportedForTest} from "scripts/query_timeline/host_utilization_diagram.js";
|
||||||
|
|
||||||
describe("Test initializeUtilizationMetrics", () => {
|
describe("webui.js_tests.host_utilization_diagram.initializeUtilizationMetrics", () => {
|
||||||
// Test whether aggregate arrays and time sample arrays are correctly allocated
|
// Test whether aggregate arrays and time sample arrays are correctly allocated
|
||||||
// based on counters and max_samples
|
// based on counters and max_samples
|
||||||
const {initializeUtilizationMetrics} = exportedForTest;
|
const {initializeUtilizationMetrics} = exportedForTest;
|
||||||
test("Basic Test", () => {
|
test("basic_case", () => {
|
||||||
const parent_profile =
|
const parent_profile =
|
||||||
{
|
{
|
||||||
"profile_name" : "Per Node Profiles",
|
"profile_name" : "Per Node Profiles",
|
||||||
|
|||||||
Reference in New Issue
Block a user