-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtests-schema.sql
141 lines (136 loc) · 3.91 KB
/
tests-schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
CREATE SCHEMA trinocicd.tests WITH (location = 's3://trino-ci/tests');
CREATE TABLE trinocicd.tests.surefire_reports (
testsuite row(
"ignored" varchar
, "hostname" varchar
, "failures" varchar
, "tests" varchar
, "name" varchar
, "time" varchar
, "errors" varchar
, "timestamp" varchar
, "skipped" varchar
, testcase array(row(
"classname" varchar
, "name" varchar
, "time" varchar
-- this is useless when value is null, and it's not possible to tell if it's set or not
, skipped row(
content varchar
, type varchar
)
, failure row(
content varchar
, message varchar
, type varchar
)
))
)
, branch varchar
, git_sha varchar
, workflow_name varchar
, workflow_run varchar
, workflow_conclusion varchar
, workflow_run_attempt varchar
, timestamp varchar
, repo varchar
, date_created date
) WITH (
external_location = 's3://trino-ci/tests/results/type=surefire/'
, format = 'JSON'
, partitioned_by = ARRAY['repo', 'date_created']
);
CALL trinocicd.system.sync_partition_metadata('tests', 'surefire_reports', 'ADD');
CREATE TABLE trinocicd.tests.testng_reports (
"testng_results" row(
"ignored" varchar
, "total" varchar
, "passed" varchar
, "failed" varchar
, "skipped" varchar
, "reporter_output" varchar
, suite row(
"started_at" varchar
, "name" varchar
, "finished_at" varchar
, "duration_ms" varchar
, groups row("group" array(row(
name varchar
, method array(row(
signature varchar
, name varchar
, class varchar
))
)))
, test row(
"started_at" varchar
, "name" varchar
, "finished_at" varchar
, "duration_ms" varchar
, class array(row(
name varchar
, "test_method" array(row(
"signature" varchar
, "started_at" varchar
, "name" varchar
, "data_provider" varchar
, "params" row(param array(row("index" varchar, "value" varchar)))
, "finished_at" varchar
, "duration_ms" varchar
, "status" varchar
, "exception" row(
"class" varchar
, "message" varchar
, "full_stacktrace" varchar
)
, "reporter_output" varchar
))
))
)
)
)
, branch varchar
, git_sha varchar
, workflow_name varchar
, workflow_run varchar
, workflow_conclusion varchar
, workflow_run_attempt varchar
, timestamp varchar
, repo varchar
, date_created date
) WITH (
external_location = 's3://trino-ci/tests/results/type=testng/'
, format = 'JSON'
, partitioned_by = ARRAY['repo', 'date_created']
);
CALL trinocicd.system.sync_partition_metadata('tests', 'testng_reports', 'ADD');
CREATE VIEW reports
AS SELECT
branch
, git_sha
, workflow_name
, workflow_run
, workflow_conclusion
, workflow_run_attempt
, cast("timestamp" AS timestamp(3) with time zone) AS job_timestamp
, repo
, date_created
, cast(testsuite.ignored AS bigint) AS ignored
, cast(testsuite.failures AS bigint) AS failures
, cast(testsuite.tests AS bigint) AS tests
, cast(testsuite.errors AS bigint) AS errors
, cast(testsuite.skipped AS bigint) AS num_skipped
, testsuite.name AS suite_name
, coalesce(
try_cast(testsuite.timestamp AS timestamp(3) with time zone),
parse_datetime(testsuite.timestamp, 'dd MMM yyyy HH:mm:ss z')
) AS suite_timestamp
, parse_duration(testsuite.time || 's') AS suite_time
, c.classname AS class_name
, c.name AS test_name
-- if it's null, it means the test was skipped
, parse_duration(c.time || 's') AS test_time
, c.failure
, c.skipped
FROM surefire_reports
CROSS JOIN unnest(testsuite.testcase) AS c;