complicated test case 4

complicated test case for a combination of:
  • dvar, dvar to object, keepName
  • loop in block func in a callee func

Demo

source

Main task yaml file
    tasks:
    - name: task
      task:
      - func: call
        dvars:
        - name: aaa
          value: var_a_from_task
        - name: countries
          value: |
            - Austraila
            - US
            - China
            - Japan
          flags:
          - toObj
          - keepName
          - v
        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 -> c0163
                 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/c0163
    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)({
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "up_runtime_task_layer_number": 0,
      "aaa": "var_a_from_task"
    })
    
    =Task2: [task ==> sub_task:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "aaa": "var_a_from_task",
      "up_runtime_task_layer_number": 1,
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      }
    })
    
    --Step1: [
    inspect if the correct parameter has been passed in correctly
    with default value
    in block func
    ]
    self: final context exec vars:
    
    (*core.Cache)({
      "aaa": "var_a_from_task",
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "loopitem": "Austraila",
      "loopindex": 0,
      "loopindex1": 1,
      "up_runtime_task_layer_number": 1
    })
    
    ~~SubStep1: [assert:  ]
     1 ASSERT OK:     [{{eq .aaa "var_a_from_task"}}]
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "loopitem": "Austraila",
      "loopindex": 0,
      "loopindex1": 1,
      "up_runtime_task_layer_number": 1,
      "aaa": "var_a_from_task"
    })
    
    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)({
      "loopindex": 1,
      "loopindex1": 2,
      "up_runtime_task_layer_number": 1,
      "aaa": "var_a_from_task",
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "loopitem": "US"
    })
    
    ~~SubStep1: [assert:  ]
     1 ASSERT OK:     [{{eq .aaa "var_a_from_task"}}]
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "loopitem": "US",
      "loopindex": 1,
      "loopindex1": 2,
      "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}}"
    
    -
    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)({
      "aaa": "var_a_from_task",
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "loopitem": "China",
      "loopindex": 2,
      "loopindex1": 3,
      "up_runtime_task_layer_number": 1
    })
    
    ~~SubStep1: [assert:  ]
     1 ASSERT OK:     [{{eq .aaa "var_a_from_task"}}]
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "aaa": "var_a_from_task",
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "loopindex1": 3,
      "loopitem": "China",
      "loopindex": 2
    })
    
    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)({
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "up_runtime_task_layer_number": 1,
      "aaa": "var_a_from_task",
      "loopitem": "Japan",
      "loopindex": 3,
      "loopindex1": 4
    })
    
    ~~SubStep1: [assert:  ]
     1 ASSERT OK:     [{{eq .aaa "var_a_from_task"}}]
    --Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "countries": {
        "Austraila",
        "US",
        "China",
        "Japan"
      },
      "up_runtime_task_layer_number": 1,
      "aaa": "var_a_from_task",
      "loopitem": "Japan",
      "loopindex": 3,
      "loopindex1": 4
    })
    
    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