-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema-v1.ts
66 lines (56 loc) · 1.41 KB
/
schema-v1.ts
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
import { SchemaVersion } from "./version.js"
export enum MetricType {
SCALAR = "SCALAR",
DISTRIBUTION = "DISTRIBUTION",
}
export enum TestOutcomeType {
PASS = "PASS",
FAIL = "FAIL"
}
export class ScalarMetric {
type: MetricType = MetricType.SCALAR
constructor(readonly name: string, readonly value: number) {}
}
export class DistributionMetric {
type: MetricType = MetricType.DISTRIBUTION
value: any
constructor(readonly name: string, value: Map<string, number>) {
this.value = Object.fromEntries(value.entries())
}
}
export type Metric = ScalarMetric | DistributionMetric
export class TestStream {
constructor(
readonly name: string,
readonly requirements: Array<Metric>,
readonly observations: Array<Metric>,
readonly outcome: TestOutcomeType
) {}
}
export class Component {
constructor(
readonly name: string,
//readonly appVersion: string,
readonly commitVersion: string
) {}
}
export class TestScenario {
constructor(
readonly name: string,
readonly startTime: Date,
readonly endTime: Date,
readonly streams: Array<TestStream>,
readonly components: Array<Component>,
metadata?: Object
) {}
}
export class TestReport {
schemaVersion = SchemaVersion.VERSION_1_0
metadata: Object = {}
constructor(
readonly name: string,
readonly startTime: Date,
readonly endTime: Date,
readonly scenarios: Array<TestScenario>
) {}
}