github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/examples/0001/02/up.yml (about)

     1  notes: |
     2    change test_case_name to case1 or case2 for different test
     3  
     4    compared to case 01, it uses a builder pattern to construct the steps of testing
     5  
     6    it dynamically fills in the detailed implementation step, such as case1 or case2 to test different scenario
     7  
     8  vars:
     9    test_case_name: case2
    10  
    11  tasks:
    12  
    13    -
    14      name: Main
    15      task:
    16        -
    17          func: call
    18          do: test_skeleton
    19  
    20    -
    21      name: test_skeleton
    22      desc: |
    23      task:
    24        -
    25          func: shell
    26          desc: |
    27            before sourcing, the env var: AAA does not exist
    28            this will cause an error
    29          do:
    30            - env |grep AAA
    31          flags:
    32            - ignoreError
    33  
    34        -
    35          func: call
    36          desc: |
    37            call the setup step
    38          do: '{{.test_case_name}}'
    39  
    40        -
    41          func: shell
    42          desc: |
    43            after sourcing, the env var: AAA exist
    44          do:
    45            - env |grep AAA
    46  
    47    -
    48      name: case1
    49      task:
    50        -
    51          func: cmd
    52          desc: |
    53            case1: only source
    54            source via the source content
    55          do:
    56            - name: virtualEnv
    57              cmd:
    58                source: |
    59                  echo "start of source"
    60                  export AAA=sourced_aaa
    61                  echo "end of source"
    62  
    63    -
    64      name: case2
    65      task:
    66  
    67        -
    68          func: cmd
    69          desc: |
    70            case2: only source
    71            source via srcfile
    72          do:
    73            - name: virtualEnv
    74              cmd:
    75                srcfile: ./test_env.rc