complicated test case 5
complicated test case for a combination of:
- dvar, dvar to object, keepName
- loop in block func in a callee func
- taskScope to pass loop item to callee
Demo
source
Main task yaml file
tasks:
- name: task
task:
- func: cmd
dvars:
- name: aaa
value: var_a_from_task
flags:
- taskScope
- name: countries
value: |
- Austraila
- US
- China
- Japan
flags:
- toObj
- keepName
- taskScope
- v
- func: cmd
do:
- name: print
cmd: '{{.countries}}'
- name: typeOf
cmd:
- 'countries'
- func: call
do:
- sub_task
- name: sub_task
task:
- func: block
loop: countries
vars:
aaa: var_a_from_sub_task
do:
- func: cmd
desc: |
inspect if the correct parameter has been passed in correctly
with default value
in block func
do:
- name: assert
cmd:
- '{{eq .aaa "var_a_from_task"}}'
- func: shell
do:
- echo "{{.aaa}}"
- echo "{{.loopitem}}"
Main log file
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0164
Verbose -> vvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/c0164
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
dvar> countries:
"- Austraila\n- US\n- China\n- Japan\n"
-
- Austraila
- US
- China
- Japan
dvar[object]> countries:
{
"Austraila",
"US",
"China",
"Japan"
}
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0,
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"aaa": "var_a_from_task"
})
WARN: [cmd] - [Not implemented or void for no action!]
-Step2:
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0,
"aaa": "var_a_from_task",
"countries": {
"Austraila",
"US",
"China",
"Japan"
}
})
~SubStep1: [print: ]
[Austraila US China Japan]
~SubStep2: [typeOf: ]
1 - type of [countries] > [[]interface {}]
-Step3:
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0,
"aaa": "var_a_from_task",
"countries": {
"Austraila",
"US",
"China",
"Japan"
}
})
=Task2: [task ==> sub_task: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task"
})
--Step1: [
inspect if the correct parameter has been passed in correctly
with default value
in block func
]
self: final context exec vars:
(*core.Cache)({
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task",
"loopitem": "Austraila",
"loopindex": 0,
"loopindex1": 1
})
~~SubStep1: [assert: ]
1 ASSERT OK: [{{eq .aaa "var_a_from_task"}}]
--Step2:
self: final context exec vars:
(*core.Cache)({
"loopindex": 0,
"loopindex1": 1,
"loopitem": "Austraila",
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task",
"countries": {
"Austraila",
"US",
"China",
"Japan"
}
})
cmd( 1):
echo "{{.aaa}}"
-
var_a_from_task
-
.. ok
cmd( 2):
echo "{{.loopitem}}"
-
Austraila
-
.. ok
. ok
--Step1: [
inspect if the correct parameter has been passed in correctly
with default value
in block func
]
self: final context exec vars:
(*core.Cache)({
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"loopitem": "US",
"loopindex": 1,
"loopindex1": 2,
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task"
})
~~SubStep1: [assert: ]
1 ASSERT OK: [{{eq .aaa "var_a_from_task"}}]
--Step2:
self: final context exec vars:
(*core.Cache)({
"loopindex": 1,
"loopindex1": 2,
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task",
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"loopitem": "US"
})
cmd( 1):
echo "{{.aaa}}"
-
var_a_from_task
-
.. ok
cmd( 2):
echo "{{.loopitem}}"
-
US
-
.. ok
. ok
--Step1: [
inspect if the correct parameter has been passed in correctly
with default value
in block func
]
self: final context exec vars:
(*core.Cache)({
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"loopitem": "China",
"loopindex": 2,
"loopindex1": 3,
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task"
})
~~SubStep1: [assert: ]
1 ASSERT OK: [{{eq .aaa "var_a_from_task"}}]
--Step2:
self: final context exec vars:
(*core.Cache)({
"aaa": "var_a_from_task",
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"loopitem": "China",
"loopindex": 2,
"loopindex1": 3,
"up_runtime_task_layer_number": 1
})
cmd( 1):
echo "{{.aaa}}"
-
var_a_from_task
-
.. ok
cmd( 2):
echo "{{.loopitem}}"
-
China
-
.. ok
. ok
--Step1: [
inspect if the correct parameter has been passed in correctly
with default value
in block func
]
self: final context exec vars:
(*core.Cache)({
"loopindex1": 4,
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task",
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"loopitem": "Japan",
"loopindex": 3
})
~~SubStep1: [assert: ]
1 ASSERT OK: [{{eq .aaa "var_a_from_task"}}]
--Step2:
self: final context exec vars:
(*core.Cache)({
"countries": {
"Austraila",
"US",
"China",
"Japan"
},
"loopindex1": 4,
"loopitem": "Japan",
"loopindex": 3,
"up_runtime_task_layer_number": 1,
"aaa": "var_a_from_task"
})
cmd( 1):
echo "{{.aaa}}"
-
var_a_from_task
-
.. ok
cmd( 2):
echo "{{.loopitem}}"
-
Japan
-
.. ok
. ok
Logs with different verbose level
Raw logs with different verbose level