From 08ae29f47b423d0e17a4e323f7fcae6d13fd2ca0 Mon Sep 17 00:00:00 2001 From: Surya Hebbar Date: Mon, 23 Jun 2025 19:41:18 +0530 Subject: [PATCH] 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... jest-junit package has been configured to use the following config - { "classNameTemplate": "{classname}", "titleTemplate": "{title}", "ancestorSeparator": "." } Example: Within JUnitXML, ... ... ... ... Change-Id: I5715d47cef5c1c3c06b4f2de7fe467aee3de8868 Reviewed-on: http://gerrit.cloudera.org:8080/23071 Tested-by: Impala Public Jenkins Reviewed-by: Riza Suminto --- tests/webui/js_tests/package.json | 5 ++- .../queries/profileParseWorker.test.js | 4 +- .../query_timeline/chart_commons.test.js | 37 +++++++++---------- .../query_timeline/fragment_diagram.test.js | 12 +++--- .../fragment_metrics_diagram.test.js | 4 +- .../host_utilization_diagram.test.js | 4 +- 6 files changed, 34 insertions(+), 32 deletions(-) diff --git a/tests/webui/js_tests/package.json b/tests/webui/js_tests/package.json index 657b9ce2f..779023f3f 100644 --- a/tests/webui/js_tests/package.json +++ b/tests/webui/js_tests/package.json @@ -15,6 +15,9 @@ "reporters": [ "default", "jest-junit" ] }, "jest-junit": { - "outputName": "js-tests.xml" + "outputName": "js-tests.xml", + "classNameTemplate": "{classname}", + "titleTemplate": "{title}", + "ancestorSeparator": "." } } diff --git a/tests/webui/js_tests/queries/profileParseWorker.test.js b/tests/webui/js_tests/queries/profileParseWorker.test.js index cb5747ec7..e1c0c55ff 100644 --- a/tests/webui/js_tests/queries/profileParseWorker.test.js +++ b/tests/webui/js_tests/queries/profileParseWorker.test.js @@ -19,10 +19,10 @@ import {describe, test, expect} from "@jest/globals"; import {readFileSync} from "node:fs"; // 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 // properly utilizes the pako library's compression methods - test("Basic Test", () => { + test("basic_test", () => { const exampleJSONProfileText = readFileSync("../../../testdata/impala-profiles/" + "impala_profile_log_tpcds_compute_stats_extended.expected.pretty.json", {encoding : "utf-8"}); diff --git a/tests/webui/js_tests/query_timeline/chart_commons.test.js b/tests/webui/js_tests/query_timeline/chart_commons.test.js index 72ef08056..a7a85b9c8 100644 --- a/tests/webui/js_tests/query_timeline/chart_commons.test.js +++ b/tests/webui/js_tests/query_timeline/chart_commons.test.js @@ -20,10 +20,10 @@ import {exportedForTest, generateTimesamples, clearTimeseriesValues, mapTimeseriesCounters, aggregateProfileTimeseries} from "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 // on counter_name - test("Basic Test (Serial Order)", () => { + test("basic_test.serial_order", () => { const parent_profile = { "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 = { "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 = { "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' // in 'time_series_counters' and correctly updates 'max_samples' even in corner cases const {accumulateTimeseriesValues} = exportedForTest; 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 = { allocated : 7, 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 = { allocated : 7, period : 100, @@ -210,8 +210,7 @@ describe("Test accumulateTimeseriesValues", () => { }); }); - test(`Basic Case (time_series_counter.period <= max_samples.period - && time_series_counter.num <= max_samples.collected)`, () => { + test("basic_case.period_and_samples_num_within_limits", () => { const max_samples = { allocated : 7, 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 = { allocated : 2, 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, // even in corner cases, with different 'max_samples' scenarios 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 = { allocated : 10, period : 1000, @@ -286,7 +285,7 @@ describe("Test generateTimesamples", () => { null, null, null, null]); }); - test("Edge Case (max_samples.allocated < max_samples.available)", () => { + test("edge_case.available_samples_exceed_allocated_size", () => { const max_samples = { allocated : 10, period : 1000, @@ -302,7 +301,7 @@ describe("Test generateTimesamples", () => { 4.5, 5]); }); - test("Edge Case (max_samples.allocated = max_samples.available)", () => { + test("edge_case.same_num_available_samples_and_allocated", () => { const max_samples = { allocated : 10, 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 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 = { allocated : 7, period : 1000, @@ -335,7 +334,7 @@ describe("Test clearTimeseriesValues", () => { 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 = { allocated : 7, 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("Basic Case", () => { + test("basic_case", () => { const parent_profile = { "profile_name" : "Per Node Profiles", diff --git a/tests/webui/js_tests/query_timeline/fragment_diagram.test.js b/tests/webui/js_tests/query_timeline/fragment_diagram.test.js index 188e2de9a..f23b4ca33 100644 --- a/tests/webui/js_tests/query_timeline/fragment_diagram.test.js +++ b/tests/webui/js_tests/query_timeline/fragment_diagram.test.js @@ -18,13 +18,13 @@ import {describe, test, expect} from "@jest/globals"; 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 const {getSvgRect, getSvgLine, getSvgText, getSvgTitle, getSvgGroup} = exportedForTest; const stroke_fill_colors = {black : "#000000", dark_grey : "#505050", 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", stroke_fill_colors.black).outerHTML).toBe( ` { + ` stroke-dasharray="2 2">`); }); - test("Test getSvgLine", () => { + test("basic_case.SvgLine", () => { expect(getSvgLine(stroke_fill_colors.black, 0, 0, 100, 100, true).outerHTML).toBe( ``); }); - test("Test getSvgText", () => { + test("basic_case.SvgText", () => { expect(getSvgText("Text", stroke_fill_colors.black, 0, 0, 15, true, 300) .outerHTML).toBe( ` { + `lengthAdjust="spacingAndGlyphs">Text`); }); - test("Test getSvgTitle", () => { + test("basic_case.SvgTitle", () => { expect(getSvgTitle("Title").outerHTML).toBe("Title"); }); - test("Test getSvgGroup", () => { + test("basic_case.SvgGroup", () => { expect(getSvgGroup().outerHTML).toBe(""); }); }); diff --git a/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js b/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js index 8c1794eb8..ac33d52e8 100644 --- a/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js +++ b/tests/webui/js_tests/query_timeline/fragment_metrics_diagram.test.js @@ -17,11 +17,11 @@ 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 // based on counters and max_samples const {initializeFragmentMetrics} = exportedForTest; - test("Basic Test", () => { + test("basic_case", () => { const parent_profile = { "profile_name" : "Coordinator Fragment F31", diff --git a/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js b/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js index 88781def1..f9248d66d 100644 --- a/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js +++ b/tests/webui/js_tests/query_timeline/host_utilization_diagram.test.js @@ -18,11 +18,11 @@ import {describe, test, expect} from "@jest/globals"; 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 // based on counters and max_samples const {initializeUtilizationMetrics} = exportedForTest; - test("Basic Test", () => { + test("basic_case", () => { const parent_profile = { "profile_name" : "Per Node Profiles",