holado 0.7.0__py3-none-any.whl → 0.8.0__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.

Potentially problematic release.


This version of holado might be problematic. Click here for more details.

Files changed (36) hide show
  1. holado/common/context/context.py +110 -4
  2. holado/common/context/session_context.py +16 -5
  3. {holado-0.7.0.dist-info → holado-0.8.0.dist-info}/METADATA +4 -3
  4. {holado-0.7.0.dist-info → holado-0.8.0.dist-info}/RECORD +35 -30
  5. holado_context/tests/behave/steps/private/common/context_steps.py +35 -3
  6. holado_core/common/resource/persisted_method_to_call_manager.py +134 -27
  7. holado_core/common/tools/path_manager.py +47 -26
  8. holado_docker/tests/behave/steps/tools/docker_controller/client_steps.py +12 -9
  9. holado_docker/tools/docker_controller/client/rest/docker_controller_client.py +53 -5
  10. holado_docker/tools/docker_controller/server/rest/api/config.py +49 -0
  11. holado_docker/tools/docker_controller/server/rest/api/container.py +5 -5
  12. holado_docker/tools/docker_controller/server/rest/api/os.py +41 -0
  13. holado_docker/tools/docker_controller/server/rest/openapi.yaml +94 -0
  14. holado_docker/tools/docker_controller/server/run_docker_controller_in_docker.sh +2 -1
  15. holado_helper/docker/run_holado_test_nonreg_in_docker.sh +1 -1
  16. holado_helper/docker/run_terminal_in_docker.sh +1 -1
  17. holado_json/tests/behave/steps/ipc/json_steps.py +11 -0
  18. holado_python/common/iterables.py +8 -0
  19. holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +16 -16
  20. holado_python/standard_library/ssl/resources/certificates/tcpbin.key +26 -26
  21. holado_rabbitmq/tools/rabbitmq/rabbitmq_client.py +0 -2
  22. holado_rest/api/rest/rest_client.py +7 -11
  23. holado_system/tests/behave/steps/system/file_steps.py +14 -3
  24. holado_test/common/context/scenario_context.py +3 -64
  25. holado_yaml/tests/behave/steps/yaml_steps.py +106 -9
  26. holado_yaml/yaml/enums.py +28 -0
  27. holado_yaml/yaml/pyyaml/pyyaml_client.py +72 -0
  28. holado_yaml/yaml/ruamel/ruamel_yaml_client.py +80 -0
  29. holado_yaml/yaml/yaml_client.py +195 -0
  30. holado_yaml/yaml/yaml_manager.py +57 -49
  31. test_holado/features/NonReg/holado_yaml/yaml.feature +304 -8
  32. test_holado/features/NonReg/scenario/scenario.feature +48 -4
  33. test_holado/logging.conf +1 -0
  34. holado_helper/docker/run_terminal_in_docker-with_docker_control.sh +0 -103
  35. {holado-0.7.0.dist-info → holado-0.8.0.dist-info}/WHEEL +0 -0
  36. {holado-0.7.0.dist-info → holado-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -69,7 +69,7 @@ Feature: Test YAML module
69
69
  author: omkarbirade
70
70
  """
71
71
 
72
- When CONTENT = load YAML file FILE_PATH (with only strings)
72
+ When CONTENT = load YAML file FILE_PATH (client type: 'base')
73
73
 
74
74
  Given TABLE = convert json CONTENT to name/value table with names and list uncollapsed
75
75
  Then table TABLE is
@@ -88,8 +88,8 @@ Feature: Test YAML module
88
88
  | 'tutorial[2].xml.name' | 'Extensible Markup Language' |
89
89
  | 'tutorial[2].xml.type' | 'good' |
90
90
 
91
- @full_load_file
92
- Scenario: Load a YAML file with full YAML features
91
+ @safe_load_file
92
+ Scenario: Load a YAML file with safe YAML features
93
93
  Given FILE_PATH = create file with name 'load.yaml'
94
94
  """
95
95
  company: spacelift
@@ -108,7 +108,7 @@ Feature: Test YAML module
108
108
  author: omkarbirade
109
109
  """
110
110
 
111
- When CONTENT = load YAML file FILE_PATH (with full YAML features)
111
+ When CONTENT = load YAML file FILE_PATH (client type: 'safe')
112
112
 
113
113
  Given TABLE = convert json CONTENT to name/value table with names and list uncollapsed
114
114
  Then table TABLE is
@@ -191,28 +191,324 @@ Feature: Test YAML module
191
191
 
192
192
  Given EXPECTED = multiline text
193
193
  """
194
- author: omkarbirade
195
194
  company: spacelift
196
195
  domain:
197
196
  - devops
198
197
  - devsecops
199
198
  tutorial:
200
199
  - yaml:
201
- born: 2001
202
200
  name: YAML Ain't Markup Language
203
201
  type: awesome
204
- - json:
205
202
  born: 2001
203
+ - json:
206
204
  name: JavaScript Object Notation
207
205
  type: great
206
+ born: 2001
208
207
  - xml:
209
- born: 1996
210
208
  name: Extensible Markup Language
211
209
  type: good
210
+ born: 1996
211
+ author: omkarbirade
212
212
  """
213
213
  Then CONTENT_STR == EXPECTED
214
214
 
215
+ @update_file
216
+ Scenario: Update a YAML file
217
+ ### PRECONDITIONS - BEGIN
218
+ Given begin preconditions
219
+
220
+ # Initialize file
221
+ Given CONTENT_FILE_INIT = multiline text
222
+ """
223
+ company: spacelift
224
+ domain:
225
+ - devops
226
+ - devsecops
227
+ tutorial:
228
+ yaml: &reference
229
+ name: YAML Ain't Markup Language
230
+ type: awesome
231
+ born: 2001
232
+ json: *reference
233
+ xml:
234
+ <<: *reference
235
+ born: 1996
236
+ author: omkarbirade
237
+ """
238
+ Given FILE_PATH = create file with name 'load.yaml' and content CONTENT_FILE_INIT
239
+ Given BACKUP_PATH = '${FILE_PATH}.ha_bak'
240
+
241
+ Given end preconditions
242
+ ### PRECONDITIONS - END
243
+
244
+ # Define data to update in file
245
+ When DATA_1 = json object
246
+ """
247
+ {
248
+ "domain": [
249
+ "architect"
250
+ ],
251
+ "size": 100,
252
+ "author": "holado"
253
+ }
254
+ """
255
+ When DATA_2 = json object
256
+ """
257
+ {
258
+ "size": 50
259
+ }
260
+ """
261
+
262
+ # Update file with DATA_1 and backup
263
+ When update YAML file FILE_PATH with data DATA_1 (with backup ; backup extension: '.ha_bak')
264
+
265
+ # Verify content of file and backup
266
+ Given CONTENT_FILE = content of text file FILE_PATH
267
+ Then CONTENT_FILE is text
268
+ """
269
+ company: spacelift
270
+ domain:
271
+ - devops
272
+ - devsecops
273
+ - architect
274
+ tutorial:
275
+ yaml: &reference
276
+ name: YAML Ain't Markup Language
277
+ type: awesome
278
+ born: 2001
279
+ json: *reference
280
+ xml:
281
+ <<: *reference
282
+ born: 1996
283
+ author: holado
284
+ size: 100
285
+ """
286
+
287
+ Given CONTENT_BACKUP = content of text file BACKUP_PATH
288
+ Then CONTENT_BACKUP == CONTENT_FILE_INIT
289
+
290
+ # Update file with DATA_2 and backup
291
+ When update YAML file FILE_PATH with data DATA_2 (with backup ; backup extension: '.ha_bak')
292
+
293
+ # Verify content of file and backup
294
+ Given CONTENT_FILE = content of text file FILE_PATH
295
+ Then CONTENT_FILE is text
296
+ """
297
+ company: spacelift
298
+ domain:
299
+ - devops
300
+ - devsecops
301
+ - architect
302
+ tutorial:
303
+ yaml: &reference
304
+ name: YAML Ain't Markup Language
305
+ type: awesome
306
+ born: 2001
307
+ json: *reference
308
+ xml:
309
+ <<: *reference
310
+ born: 1996
311
+ author: holado
312
+ size: 50
313
+ """
314
+
315
+ Given CONTENT_BACKUP = content of text file BACKUP_PATH
316
+ Then CONTENT_BACKUP == CONTENT_FILE_INIT
317
+
318
+ # Restore file
319
+ When restore YAML file FILE_PATH (backup extension: '.ha_bak')
320
+
321
+ # Verify content of file, and backup doesn't exist anymore
322
+ Given CONTENT_FILE = content of text file FILE_PATH
323
+ Then CONTENT_FILE == CONTENT_FILE_INIT
324
+ Then file BACKUP_PATH doesn't exist
325
+
326
+ @update_string
327
+ Scenario: Update a YAML string
328
+ ### PRECONDITIONS - BEGIN
329
+ Given begin preconditions
330
+
331
+ # Initialize string
332
+ Given STR_INIT = multiline text
333
+ """
334
+ company: spacelift
335
+ domain:
336
+ - devops
337
+ - devsecops
338
+ tutorial:
339
+ yaml: &reference
340
+ name: YAML Ain't Markup Language
341
+ type: awesome
342
+ born: 2001
343
+ json: *reference
344
+ xml:
345
+ <<: *reference
346
+ born: 1996
347
+ author: omkarbirade
348
+ """
349
+
350
+ Given end preconditions
351
+ ### PRECONDITIONS - END
352
+
353
+ # Define data to update in file
354
+ When DATA_1 = json object
355
+ """
356
+ {
357
+ "domain": [
358
+ "architect"
359
+ ],
360
+ "size": 100,
361
+ "author": "holado"
362
+ }
363
+ """
364
+ When DATA_2 = json object
365
+ """
366
+ {
367
+ "size": 50
368
+ }
369
+ """
370
+
371
+ # Update string with DATA_1
372
+ When STR_1 = update YAML string STR_INIT with data DATA_1
373
+
374
+ # Verify string
375
+ Then STR_1 is text
376
+ """
377
+ company: spacelift
378
+ domain:
379
+ - devops
380
+ - devsecops
381
+ - architect
382
+ tutorial:
383
+ yaml: &reference
384
+ name: YAML Ain't Markup Language
385
+ type: awesome
386
+ born: 2001
387
+ json: *reference
388
+ xml:
389
+ <<: *reference
390
+ born: 1996
391
+ author: holado
392
+ size: 100
393
+ """
394
+
395
+ # Update string with DATA_2
396
+ When STR_2 = update YAML string STR_1 with data DATA_2
397
+
398
+ # Verify string
399
+ Then STR_2 is text
400
+ """
401
+ company: spacelift
402
+ domain:
403
+ - devops
404
+ - devsecops
405
+ - architect
406
+ tutorial:
407
+ yaml: &reference
408
+ name: YAML Ain't Markup Language
409
+ type: awesome
410
+ born: 2001
411
+ json: *reference
412
+ xml:
413
+ <<: *reference
414
+ born: 1996
415
+ author: holado
416
+ size: 50
417
+ """
215
418
 
419
+ @update_yaml_object
420
+ Scenario: Update a YAML object
421
+ ### PRECONDITIONS - BEGIN
422
+ Given begin preconditions
423
+
424
+ # Initialize string
425
+ Given STR_INIT = multiline text
426
+ """
427
+ company: spacelift
428
+ domain:
429
+ - devops
430
+ - devsecops
431
+ tutorial:
432
+ yaml: &reference
433
+ name: YAML Ain't Markup Language
434
+ type: awesome
435
+ born: 2001
436
+ json: *reference
437
+ xml:
438
+ <<: *reference
439
+ born: 1996
440
+ author: omkarbirade
441
+ """
442
+ Given OBJ = load YAML string STR_INIT
443
+
444
+ Given end preconditions
445
+ ### PRECONDITIONS - END
446
+
447
+ # Define data to update in file
448
+ When DATA_1 = YAML object
449
+ """
450
+ domain:
451
+ - architect
452
+ size: 100
453
+ author: holado
454
+ """
455
+ When DATA_2 = json object
456
+ """
457
+ {
458
+ "size": 50
459
+ }
460
+ """
461
+
462
+ # Update object with DATA_1
463
+ When update YAML object OBJ with data DATA_1
464
+
465
+ # Verify object
466
+ When STR_1 = convert YAML object OBJ to string
467
+ Then STR_1 is text
468
+ """
469
+ company: spacelift
470
+ domain:
471
+ - devops
472
+ - devsecops
473
+ - architect
474
+ tutorial:
475
+ yaml: &reference
476
+ name: YAML Ain't Markup Language
477
+ type: awesome
478
+ born: 2001
479
+ json: *reference
480
+ xml:
481
+ <<: *reference
482
+ born: 1996
483
+ author: holado
484
+ size: 100
485
+ """
486
+
487
+ # Update object with DATA_2
488
+ When update YAML object OBJ with data DATA_2
489
+
490
+ # Verify string
491
+ When STR_2 = convert YAML object OBJ to string
492
+ Then STR_2 is text
493
+ """
494
+ company: spacelift
495
+ domain:
496
+ - devops
497
+ - devsecops
498
+ - architect
499
+ tutorial:
500
+ yaml: &reference
501
+ name: YAML Ain't Markup Language
502
+ type: awesome
503
+ born: 2001
504
+ json: *reference
505
+ xml:
506
+ <<: *reference
507
+ born: 1996
508
+ author: holado
509
+ size: 50
510
+ """
511
+
216
512
 
217
513
 
218
514
 
@@ -18,27 +18,71 @@ Feature: Features related to scenario
18
18
 
19
19
  Then SCENARIO_CONTEXT.is_in_preconditions == False
20
20
 
21
-
21
+
22
+ @postconditions
22
23
  Scenario: postconditions
23
-
24
24
  ### PRECONDITIONS - BEGIN
25
25
  Given begin preconditions
26
26
 
27
+ # Verify no post processes are still persisted
28
+ Given NB = number of persisted post processes to perform for scenario context
29
+ Then NB == 0
30
+
31
+ # Manage verification that postconditions are called
27
32
  Given VAR = 'before postcondition'
28
33
  Given at end of scenario, call steps
29
34
  """
30
35
  Given VAR = 'after postcondition'
31
36
  """
32
-
37
+
38
+ # Manage verification that a same postcondition is called only once
39
+ Given COUNTER = 0
40
+ Given at end of scenario, call steps
41
+ """
42
+ Given COUNTER = ${${COUNTER} + 1}
43
+ """
44
+ Given at end of scenario, call steps
45
+ """
46
+ Given COUNTER = ${${COUNTER} + 1}
47
+ """
48
+ Given at end of scenario, call steps
49
+ """
50
+ Given COUNTER = ${${COUNTER} + 1}
51
+ """
52
+
53
+ # Manage verification that a failed postcondition become expired after 10 tries
54
+ Given at end of scenario, call steps
55
+ """
56
+ Then 0 == 1
57
+ """
58
+
33
59
  Given end preconditions
34
60
  ### PRECONDITIONS - END
35
61
 
36
62
  Then VAR == 'before postcondition'
63
+ Then COUNTER == 0
64
+
65
+ Given NB = number of persisted post processes to perform for scenario context
66
+ Then NB == 3
37
67
 
38
68
  When execute post processes of scenario context
39
69
 
40
70
  Then VAR == 'after postcondition'
41
-
71
+ Then COUNTER == 1
72
+
73
+ Given NB = number of persisted post processes to perform for scenario context
74
+ Then NB == 1
75
+
76
+ # Verify post processes in failure are expiring after 10 tries
77
+ Given for _ in range(8):
78
+ When execute persisted post processes of scenario context
79
+ Given end for
80
+ Given NB = number of persisted post processes to perform for scenario context
81
+ Then NB == 1
82
+
83
+ When execute persisted post processes of scenario context
84
+ Given NB = number of persisted post processes to perform for scenario context
85
+ Then NB == 0
42
86
 
43
87
  @table_possible_values
44
88
  Scenario: Scenario table possible values
test_holado/logging.conf CHANGED
@@ -36,6 +36,7 @@ holado_s3.tools.s3.minio_client.trace=INFO
36
36
 
37
37
  #holado_system=DEBUG
38
38
  #holado_test.behave.behave=DEBUG
39
+ #holado_yaml=DEBUG
39
40
 
40
41
  # External libraries
41
42
  chardet=WARNING
@@ -1,103 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Script to launch a command with testing docker.
4
- #
5
- # It is usually used to launch a script embedded in docker image.
6
- #
7
- # USAGE:
8
- # Considering a working directory WORK_DIR, to launch scenarios, open a console in WORK_DIR, and launch the script with wanted parameters (see bellow).
9
- #
10
- # Example: display feature & scenario durations of a report
11
- # run_terminal_in_docker.sh python ./resources/scripts/print_report_execution_historic.py -r {dirname_to_report} -f feature.name -f feature.filename -f feature.duration -s scenario.name -s scenario.line -s scenario.duration
12
- #
13
- # REQUIREMENTS:
14
- # Define in .profile the following variables
15
- # - HOLADO_IMAGE_TAG: docker image tag to use (usually "main" or tag associated to any branch)
16
- # - optional but preferable:
17
- # - HOLADO_OUTPUT_BASEDIR: absolute path to base output directory of testing solution
18
- # - HOLADO_LOCAL_RESOURCES_BASEDIR: absolute path to base local resources directory of testing solution (where data are stored through campaigns)
19
- # - optional:
20
- # - HOLADO_USE_LOCALHOST: force the container network to 'host'.
21
- # - HOLADO_NETWORK: specify on which network the docker is run.
22
- # Example:
23
- # export HOLADO_IMAGE_TAG=main
24
- # export HOLADO_USE_LOCALHOST=True
25
- # export HOLADO_OUTPUT_BASEDIR=$HOME/.holado/output
26
- # export HOLADO_LOCAL_RESOURCES_BASEDIR=$HOME/.holado/resources
27
- #
28
-
29
-
30
- for v in HOLADO_IMAGE_TAG; do
31
- if [ -z ${!v} ]; then
32
- echo "Environment variable $v must be set"
33
- exit 1
34
- fi
35
- done
36
-
37
- WORK_DIR="$(pwd)"
38
-
39
- if [[ -z "$HOLADO_IMAGE_REGISTRY" ]]; then
40
- HOLADO_IMAGE_REGISTRY=registry.gitlab.com/holado_framework/python
41
- fi
42
- TEST_IMAGE=${HOLADO_IMAGE_REGISTRY}:${HOLADO_IMAGE_TAG}
43
-
44
- # Update docker image
45
- echo "Updating docker image ${TEST_IMAGE}..."
46
- docker pull ${TEST_IMAGE}
47
-
48
- # Define test output directory
49
- if [[ ! -z "$HOLADO_OUTPUT_BASEDIR" ]]; then
50
- OUTPUT_DIR=${HOLADO_OUTPUT_BASEDIR}
51
- else
52
- OUTPUT_DIR=${WORK_DIR}/output
53
- fi
54
- echo "Output directory: $OUTPUT_DIR"
55
-
56
- # Define test resources directory
57
- if [[ ! -z "$HOLADO_LOCAL_RESOURCES_BASEDIR" ]]; then
58
- RESOURCES_DIR=${HOLADO_LOCAL_RESOURCES_BASEDIR}
59
- else
60
- RESOURCES_DIR=${WORK_DIR}/resources
61
- fi
62
- echo "Resources directory: $RESOURCES_DIR"
63
-
64
- # Make dirs
65
- if [ ! -d ${OUTPUT_DIR} ]; then
66
- echo "Create output directory: ${OUTPUT_DIR}"
67
- mkdir -p ${OUTPUT_DIR}
68
- fi
69
- if [ ! -d ${RESOURCES_DIR} ]; then
70
- echo "Create resources directory: ${RESOURCES_DIR}"
71
- mkdir -p ${RESOURCES_DIR}
72
- fi
73
-
74
- # Define container network
75
- if [ "$HOLADO_USE_LOCALHOST" = True ]; then
76
- NETWORK_DEF_COMMAND="--network=host"
77
- else
78
- if [[ ! -z "$HOLADO_NETWORK" ]]; then
79
- NETWORK_DEF_COMMAND="--network $HOLADO_NETWORK"
80
- else
81
- NETWORK_DEF_COMMAND=""
82
- fi
83
- fi
84
-
85
- # Docker run
86
- if [[ -z "$HOLADO_RUNNER_NAME" ]]; then
87
- HOLADO_RUNNER_NAME=holado_test_runner
88
- fi
89
-
90
- echo
91
- echo "Running tests (docker name: ${HOLADO_RUNNER_NAME})..."
92
- echo
93
- #docker run --rm -it $((docker info | grep -i rootless > /dev/null && echo -n "--user root") || echo -n "-u $(id -u ${USER}):$(id -g ${USER})") --name ${HOLADO_RUNNER_NAME} \
94
- docker run --rm -it --user root --name ${HOLADO_RUNNER_NAME} \
95
- --privileged -v /var/run/docker.sock:/var/run/docker.sock \
96
- -v "${OUTPUT_DIR}":/output \
97
- -v "${RESOURCES_DIR}":/resources \
98
- -e HOLADO_OUTPUT_BASEDIR=/output \
99
- -e HOLADO_LOCAL_RESOURCES_BASEDIR=/resources \
100
- ${NETWORK_DEF_COMMAND} \
101
- -w /work_dir \
102
- ${TEST_IMAGE} /bin/bash
103
-
File without changes