Fix tests visualizer

This commit is contained in:
Alexey Milovidov 2023-04-29 23:48:45 +02:00
parent 15d0379e2c
commit d945089df8

View File

@ -20,9 +20,7 @@
width: 130px;
display: block;
margin: 30px auto;
-webkit-animation: spin 2s ease-in-out infinite;
-moz-animation: spin 2s ease-in-out infinite;
animation: spin 2s ease-in-out infinite;
animation: spin 10s ease-in-out infinite;
}
h1 {
@ -45,16 +43,9 @@
cursor: pointer;
}
@-moz-keyframes spin {
100% { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
100% { transform:rotate(360deg); }
50% { transform:scale(150%); }
100% { transform:scale(100%); }
}
</style>
</head>
@ -67,33 +58,26 @@
</div>
<canvas id="canvas"></canvas>
<script type="text/javascript">
///////////////////////
// GLOBAL VARIABLES
///////////////////////
let start_date = '2020-06-13';
let start_date = '2021-12-01';
const canvasNode = document.getElementById('canvas');
const infoNode = document.getElementById('info');
const loadingNode = document.getElementById('loading');
const failMessageNode = document.getElementById('fail-message');
///////////////////////
// QUERIES
///////////////////////
let render_data_query = `
WITH '${start_date}'::Date AS start_date
SELECT groupArray([d, n, fail]) FROM
(
SELECT n, check_start_time::Date - start_date AS d, max(test_status LIKE 'F%' OR test_status LIKE 'E%') AS fail
FROM "default".checks
FROM checks
INNER JOIN
(
SELECT test_name, toUInt16(rowNumberInAllBlocks()) AS n FROM
SELECT test_name, toUInt16(row_number() OVER (ORDER BY test_name)) AS n FROM
(
SELECT DISTINCT test_name
FROM "default".checks
FROM checks
WHERE match(test_name, '^\\d+_') AND check_name ILIKE '%stateless%' AND check_start_time > now() - INTERVAL 1 DAY
ORDER BY test_name
)
) AS nums
@ -109,25 +93,20 @@ let render_data_query = `
FORMAT TSV`;
let test_names_query = `
SELECT test_name, toUInt16(rowNumberInAllBlocks()) AS n FROM
SELECT test_name, toUInt16(row_number() OVER (ORDER BY test_name)) AS n FROM
(
SELECT DISTINCT test_name
FROM "default".checks
FROM checks
WHERE match(test_name, '^\\d+_') AND check_name ILIKE '%stateless%' AND check_start_time > now() - INTERVAL 1 DAY
ORDER BY test_name
) FORMAT JSONCompact`;
///////////////////////
// MAIN
///////////////////////
(async () => {
try {
const [render_data, test_names_data] = await Promise.all([
loadDataByQuery(render_data_query),
loadDataByQuery(test_names_query),
]);
// we good
renderResponse(render_data);
saveTestNames(test_names_data);
} catch (e) {
@ -138,10 +117,6 @@ let test_names_query = `
}
})()
///////////////////////
// SPECIAL FUNCTIONS
///////////////////////
async function loadDataByQuery(query) {
const response = await fetch(
"https://play.clickhouse.com?user=play&add_http_cors_header=1",