opentf-toolkit-nightly 0.57.0.dev1093__py3-none-any.whl → 0.57.0.dev1098__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opentf/commons/__init__.py +2 -0
- opentf/commons/datasources.py +21 -40
- opentf/commons/schemas.py +1 -1
- opentf/schemas/opentestfactory.org/v1/WorkflowCanceled.json +60 -0
- {opentf_toolkit_nightly-0.57.0.dev1093.dist-info → opentf_toolkit_nightly-0.57.0.dev1098.dist-info}/METADATA +1 -1
- {opentf_toolkit_nightly-0.57.0.dev1093.dist-info → opentf_toolkit_nightly-0.57.0.dev1098.dist-info}/RECORD +9 -8
- {opentf_toolkit_nightly-0.57.0.dev1093.dist-info → opentf_toolkit_nightly-0.57.0.dev1098.dist-info}/LICENSE +0 -0
- {opentf_toolkit_nightly-0.57.0.dev1093.dist-info → opentf_toolkit_nightly-0.57.0.dev1098.dist-info}/WHEEL +0 -0
- {opentf_toolkit_nightly-0.57.0.dev1093.dist-info → opentf_toolkit_nightly-0.57.0.dev1098.dist-info}/top_level.txt +0 -0
opentf/commons/__init__.py
CHANGED
|
@@ -66,6 +66,7 @@ DEFAULT_HEADERS = {
|
|
|
66
66
|
REASON_STATUS = {
|
|
67
67
|
'OK': 200,
|
|
68
68
|
'Created': 201,
|
|
69
|
+
'Accepted': 202,
|
|
69
70
|
'NoContent': 204,
|
|
70
71
|
'BadRequest': 400,
|
|
71
72
|
'Unauthorized': 401,
|
|
@@ -75,6 +76,7 @@ REASON_STATUS = {
|
|
|
75
76
|
'AlreadyExists': 409,
|
|
76
77
|
'Conflict': 409,
|
|
77
78
|
'Invalid': 422,
|
|
79
|
+
'TooManyRequests': 429, # https://datatracker.ietf.org/doc/html/rfc6585
|
|
78
80
|
'InternalError': 500,
|
|
79
81
|
}
|
|
80
82
|
|
opentf/commons/datasources.py
CHANGED
|
@@ -49,6 +49,14 @@ CREATION_TIMESTAMP = 'creationTimestamp'
|
|
|
49
49
|
## Helpers
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
class DataSourceScopeError(Exception):
|
|
53
|
+
"""CacheException class"""
|
|
54
|
+
|
|
55
|
+
def __init__(self, msg, details=None):
|
|
56
|
+
self.msg = msg
|
|
57
|
+
self.details = details
|
|
58
|
+
|
|
59
|
+
|
|
52
60
|
def _merge_dicts(dict1: Dict[str, Any], dict2: Dict[str, Any]) -> Dict[str, Any]:
|
|
53
61
|
for k, v in dict1.items():
|
|
54
62
|
if k in dict2:
|
|
@@ -431,7 +439,7 @@ def _make_testcase_from_testresult(
|
|
|
431
439
|
if not in_scope(scope, testcase):
|
|
432
440
|
return {}
|
|
433
441
|
except ValueError as err:
|
|
434
|
-
raise
|
|
442
|
+
raise DataSourceScopeError(f'[SCOPE ERROR] {err}')
|
|
435
443
|
return testcase
|
|
436
444
|
|
|
437
445
|
|
|
@@ -449,8 +457,11 @@ def _extract_testcases(
|
|
|
449
457
|
) -> Dict[str, Dict[str, Any]]:
|
|
450
458
|
testcases = {}
|
|
451
459
|
items = 0
|
|
460
|
+
testresults_part = testresults[state['last_notification_used'] :]
|
|
461
|
+
if not testresults_part:
|
|
462
|
+
return {}
|
|
452
463
|
for i, testresult in enumerate(
|
|
453
|
-
|
|
464
|
+
testresults_part,
|
|
454
465
|
start=state['last_notification_used'],
|
|
455
466
|
):
|
|
456
467
|
if i == state['last_notification_used']:
|
|
@@ -547,11 +558,12 @@ def get_testcases(
|
|
|
547
558
|
|
|
548
559
|
if not testresults:
|
|
549
560
|
raise ValueError('No test results in events.')
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
561
|
+
try:
|
|
562
|
+
testcases = _extract_testcases(testresults, state, scope, events)
|
|
563
|
+
if not testcases:
|
|
564
|
+
raise DataSourceScopeError(f'No test cases matching scope `{scope}`.')
|
|
565
|
+
except DataSourceScopeError:
|
|
566
|
+
raise
|
|
555
567
|
return testcases
|
|
556
568
|
|
|
557
569
|
|
|
@@ -582,9 +594,7 @@ def _make_tag_datasource(tag: str, parent: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
582
594
|
}
|
|
583
595
|
|
|
584
596
|
|
|
585
|
-
def get_tags(
|
|
586
|
-
events: List[Dict[str, Any]], scope: Union[str, bool] = True, state=None
|
|
587
|
-
) -> Dict[str, Any]:
|
|
597
|
+
def get_tags(events: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
588
598
|
"""Extract metadata for each execution environment tag.
|
|
589
599
|
|
|
590
600
|
# Required parameters:
|
|
@@ -619,25 +629,12 @@ def get_tags(
|
|
|
619
629
|
raise ValueError(
|
|
620
630
|
'No job events found in workflow. Cannot extract data for tags.'
|
|
621
631
|
)
|
|
622
|
-
try:
|
|
623
|
-
testcases = get_testcases(events, scope, state)
|
|
624
|
-
except ValueError as err:
|
|
625
|
-
if str(err).startswith('[SCOPE ERROR] '):
|
|
626
|
-
raise ValueError(str(err))
|
|
627
|
-
current_app.logger.debug(str(err))
|
|
628
|
-
testcases = {}
|
|
629
632
|
tags = {}
|
|
630
633
|
for job, parent in jobs.values():
|
|
631
634
|
for tag in job['runs-on']:
|
|
632
635
|
tags.setdefault(tag, _make_tag_datasource(tag, parent))
|
|
633
636
|
tags[tag]['status']['jobCount'] += 1
|
|
634
637
|
|
|
635
|
-
for testcase in testcases.values():
|
|
636
|
-
for tag in testcase['test']['runs-on']:
|
|
637
|
-
tags[tag]['status']['testCaseCount'] += 1
|
|
638
|
-
tags[tag]['status']['testCaseStatusSummary'][
|
|
639
|
-
testcase['test']['outcome']
|
|
640
|
-
] += 1
|
|
641
638
|
return tags
|
|
642
639
|
|
|
643
640
|
|
|
@@ -757,9 +754,7 @@ def _make_job_datasource(
|
|
|
757
754
|
}
|
|
758
755
|
|
|
759
756
|
|
|
760
|
-
def get_jobs(
|
|
761
|
-
events: List[Dict[str, Any]], scope: Union[str, bool] = True, state=None
|
|
762
|
-
) -> Dict[str, Any]:
|
|
757
|
+
def get_jobs(events: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
763
758
|
"""Extract metadata for each job.
|
|
764
759
|
|
|
765
760
|
# Required parameters:
|
|
@@ -811,14 +806,6 @@ def get_jobs(
|
|
|
811
806
|
'No job events found in workflow. Cannot extract data for jobs.'
|
|
812
807
|
)
|
|
813
808
|
|
|
814
|
-
try:
|
|
815
|
-
testcases = get_testcases(events, scope, state)
|
|
816
|
-
except ValueError as err:
|
|
817
|
-
if str(err).startswith('[SCOPE ERROR] '):
|
|
818
|
-
raise ValueError(str(err))
|
|
819
|
-
current_app.logger.debug(str(err))
|
|
820
|
-
testcases = {}
|
|
821
|
-
|
|
822
809
|
jobs_events = list(
|
|
823
810
|
filter(
|
|
824
811
|
lambda event: event['kind'] in (EXECUTIONCOMMAND, EXECUTIONRESULT)
|
|
@@ -846,10 +833,4 @@ def get_jobs(
|
|
|
846
833
|
)
|
|
847
834
|
jobs[data['metadata']['id']] = data
|
|
848
835
|
|
|
849
|
-
for testcase in testcases.values():
|
|
850
|
-
jobs[testcase['metadata']['job_id']]['status']['testCaseCount'] += 1
|
|
851
|
-
jobs[testcase['metadata']['job_id']]['status']['testCaseStatusSummary'][
|
|
852
|
-
testcase['test']['outcome']
|
|
853
|
-
] += 1
|
|
854
|
-
|
|
855
836
|
return jobs
|
opentf/commons/schemas.py
CHANGED
|
@@ -37,7 +37,7 @@ SUBSCRIPTION = 'opentestfactory.org/v1alpha1/Subscription'
|
|
|
37
37
|
|
|
38
38
|
WORKFLOW = 'opentestfactory.org/v1/Workflow'
|
|
39
39
|
WORKFLOWCOMPLETED = 'opentestfactory.org/v1/WorkflowCompleted'
|
|
40
|
-
WORKFLOWCANCELED = 'opentestfactory.org/
|
|
40
|
+
WORKFLOWCANCELED = 'opentestfactory.org/v1/WorkflowCanceled'
|
|
41
41
|
WORKFLOWRESULT = 'opentestfactory.org/v1alpha1/WorkflowResult'
|
|
42
42
|
|
|
43
43
|
GENERATORCOMMAND = 'opentestfactory.org/v1alpha1/GeneratorCommand'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema#",
|
|
3
|
+
"title": "JSON SCHEMA for opentestfactory.org/v1 WorkflowCanceled manifests",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"apiVersion": {
|
|
7
|
+
"const": "opentestfactory.org/v1"
|
|
8
|
+
},
|
|
9
|
+
"kind": {
|
|
10
|
+
"const": "WorkflowCanceled"
|
|
11
|
+
},
|
|
12
|
+
"metadata": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"name": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"namespace": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$"
|
|
21
|
+
},
|
|
22
|
+
"workflow_id": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"labels": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"patternProperties": {
|
|
28
|
+
"^([a-zA-Z0-9-.]+/)?[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"minProperties": 1,
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"additionalProperties": true,
|
|
37
|
+
"required": [
|
|
38
|
+
"name",
|
|
39
|
+
"workflow_id"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"details": {
|
|
43
|
+
"type": "object"
|
|
44
|
+
},
|
|
45
|
+
"outputs": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"patternProperties": {
|
|
48
|
+
"^[a-zA-Z_][a-zA-Z0-9_-]*$": {
|
|
49
|
+
"type": "string"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"required": [
|
|
55
|
+
"apiVersion",
|
|
56
|
+
"kind",
|
|
57
|
+
"metadata"
|
|
58
|
+
],
|
|
59
|
+
"additionalProperties": false
|
|
60
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: opentf-toolkit-nightly
|
|
3
|
-
Version: 0.57.0.
|
|
3
|
+
Version: 0.57.0.dev1098
|
|
4
4
|
Summary: OpenTestFactory Orchestrator Toolkit
|
|
5
5
|
Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
|
|
6
6
|
Author: Martin Lafaix
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
opentf/commons/__init__.py,sha256=
|
|
1
|
+
opentf/commons/__init__.py,sha256=pHeXaleOQxz0b0Ds8zIvMu2COi7jYuj6dNne08o0UU0,22092
|
|
2
2
|
opentf/commons/auth.py,sha256=bM2Z3kxm2Wku1lKXaRAIg37LHvXWAXIZIqjplDfN2P8,15899
|
|
3
3
|
opentf/commons/config.py,sha256=dyus4K5Zdmcftc3Y9Z1YRkzA1KwiRLHoeAlg2_A49QM,7876
|
|
4
|
-
opentf/commons/datasources.py,sha256=
|
|
4
|
+
opentf/commons/datasources.py,sha256=lIQf81riLHWYj1bG0Mxez7rf9cxSL50NVOf2bmKkWT4,26032
|
|
5
5
|
opentf/commons/expressions.py,sha256=jM_YKXVOFhvOE2aE2IuacuvxhIsOYTFs2oQkpcbWR6g,19645
|
|
6
6
|
opentf/commons/pubsub.py,sha256=DVrSara5FRfNdPBwXKUkTobqGki0RPDehylTEFcJnFc,7341
|
|
7
|
-
opentf/commons/schemas.py,sha256=
|
|
7
|
+
opentf/commons/schemas.py,sha256=C4DE5LXTMTLHTiLGhcwtS-8za8d9ZgkMPiA9PDLpAJ4,4195
|
|
8
8
|
opentf/commons/selectors.py,sha256=DEpLgRAr5HXSpSYI4liXP2hLUTvOSexFa9Vfa1xIQTk,7134
|
|
9
9
|
opentf/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
opentf/schemas/abac.opentestfactory.org/v1alpha1/Policy.json,sha256=JXsfNAPSEYggeyaDutSQBeG38o4Bmcr70dPLWWeqIh8,2105
|
|
@@ -12,6 +12,7 @@ opentf/schemas/opentestfactory.org/v1/ExecutionCommand.json,sha256=UtmAlTaYdPSZD
|
|
|
12
12
|
opentf/schemas/opentestfactory.org/v1/GeneratorResult.json,sha256=neoFocJGkVTQQPtnG5xnbqNLX8ivFBJbanbbPweId7s,16608
|
|
13
13
|
opentf/schemas/opentestfactory.org/v1/ProviderResult.json,sha256=Ej4zhCE3rCqCGKcaeAoIHwSJTV_7fw-rAxhJ52qA-Gs,9641
|
|
14
14
|
opentf/schemas/opentestfactory.org/v1/Workflow.json,sha256=mpWxJfP3aV3sYzVxxWOivD55Top4J5WXTTKBzp7gjIw,22486
|
|
15
|
+
opentf/schemas/opentestfactory.org/v1/WorkflowCanceled.json,sha256=BCWxnm3rt4VWh9GXkIhdNY9JYohFWxi9Wg3JjXIavaU,1694
|
|
15
16
|
opentf/schemas/opentestfactory.org/v1/WorkflowCompleted.json,sha256=KtC9-oeaBNM3D60SFpmYnLMtqewUAGRoOJfVzb7CdHg,1635
|
|
16
17
|
opentf/schemas/opentestfactory.org/v1alpha1/AgentRegistration.json,sha256=NQykqU-lKE8LtBhBiFUcpVJq00MRG6dZsoM1xedx6uQ,1230
|
|
17
18
|
opentf/schemas/opentestfactory.org/v1alpha1/AllureCollectorOutput.json,sha256=-L9DDWA0A4x54bPMn4m6Qwi2tf2nHvzIPFOElTjaVck,1366
|
|
@@ -53,8 +54,8 @@ opentf/scripts/startup.py,sha256=Da2zo93pBWbdRmj-wgekgLcF94rpNc3ZkbvR8R0w8XY,212
|
|
|
53
54
|
opentf/toolkit/__init__.py,sha256=nbllYXON3Rzd-hU7Cred7r4hPaCPbfSJmoY7cQ6RShc,22589
|
|
54
55
|
opentf/toolkit/channels.py,sha256=6xcVKHUK2FdyVKIQmPQbakngfVuQDzCcD_lInOdKpro,17171
|
|
55
56
|
opentf/toolkit/core.py,sha256=6nud1vqcfjs9swZu_Z-rbvdbejtrlSjOd8eZXIF0ChE,9795
|
|
56
|
-
opentf_toolkit_nightly-0.57.0.
|
|
57
|
-
opentf_toolkit_nightly-0.57.0.
|
|
58
|
-
opentf_toolkit_nightly-0.57.0.
|
|
59
|
-
opentf_toolkit_nightly-0.57.0.
|
|
60
|
-
opentf_toolkit_nightly-0.57.0.
|
|
57
|
+
opentf_toolkit_nightly-0.57.0.dev1098.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
58
|
+
opentf_toolkit_nightly-0.57.0.dev1098.dist-info/METADATA,sha256=uPhQAxjwlGe5OUfel_BAR_JEbwnkreTZzEpleEdePxM,1946
|
|
59
|
+
opentf_toolkit_nightly-0.57.0.dev1098.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
60
|
+
opentf_toolkit_nightly-0.57.0.dev1098.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
|
|
61
|
+
opentf_toolkit_nightly-0.57.0.dev1098.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|