github.com/replicatedhq/ship@v0.55.0/pkg/filetree/test-cases/tests.yml (about)

     1  ---
     2  - name: no files returns empty tree
     3    mkdir: []
     4    touch: []
     5    expect:
     6      name: /
     7      path: /
     8      children:
     9        - name: /
    10          path: /
    11          children: []
    12  
    13  - name: open non existent directory
    14    mkdir: []
    15    touch: []
    16    read: does/not/exist
    17    expectErr: 'read dir "does/not/exist": open .*/does/not/exist: no such file or directory'
    18  
    19  - name: read file as root dir fails
    20    mkdir: []
    21    touch:
    22      - foo.txt
    23    read: foo.txt
    24    expectErr: 'read dir "foo.txt": .*: not a directory'
    25  
    26  - name: read single file
    27    touch:
    28      - foo.txt
    29    expect:
    30      name: /
    31      path: /
    32      children:
    33        - name: /
    34          path: /
    35          children:
    36            - name: foo.txt
    37              path: /foo.txt
    38  
    39  - name: read single nested file
    40    mkdir:
    41      - bar
    42    touch:
    43      - bar/foo.txt
    44    expect:
    45      name: /
    46      path: /
    47      children:
    48        - name: /
    49          path: /
    50          children:
    51            - name: bar
    52              path: /bar
    53              children:
    54                - name: foo.txt
    55                  path: /bar/foo.txt
    56  
    57  - name: read empty dir
    58    mkdir:
    59      - bar
    60    expect:
    61      name: /
    62      path: /
    63      children:
    64        - name: /
    65          path: /
    66          children:
    67            - name: bar
    68              path: /bar
    69              children: []
    70  
    71  - name: read subdirectory
    72    mkdir:
    73      - bar/baz
    74    touch:
    75      - bar/baz/foo.txt
    76    read: bar/baz
    77    expect:
    78      name: /
    79      path: /
    80      children:
    81        - name: /
    82          path: /
    83          children:
    84            - name: foo.txt
    85              path: /foo.txt
    86  
    87  - name: big nested thing
    88    mkdir:
    89      - bar
    90      - baz
    91      - k/f/b/r/
    92      - k/f/b/r/3/
    93    touch:
    94      - k/foo.txt
    95      - k/f/foo.txt
    96      - k/f/b/foo.txt
    97      - k/f/b/r/foo.txt
    98    expect:
    99      name: /
   100      path: /
   101      children:
   102        - name: /
   103          path: /
   104          children:
   105            - name: bar
   106              path: /bar
   107              children: []
   108            - name: baz
   109              path: /baz
   110              children: []
   111            - name: k
   112              path: /k
   113              children:
   114              - name: f
   115                path: /k/f
   116                children:
   117                - name: b
   118                  path: /k/f/b
   119                  children:
   120                    - name: foo.txt
   121                      path: /k/f/b/foo.txt
   122                    - name: r
   123                      path: /k/f/b/r
   124                      children:
   125                      - name: foo.txt
   126                        path: /k/f/b/r/foo.txt
   127                      - name: 3
   128                        path: /k/f/b/r/3
   129                        children: []
   130                - name: foo.txt
   131                  path: /k/f/foo.txt
   132              - name: foo.txt
   133                path: /k/foo.txt
   134  
   135  - name: has a resource
   136    resources:
   137      /foo.txt: bar
   138    expect:
   139      name: /
   140      path: /
   141      children:
   142      - name: /
   143        path: /
   144        children: []
   145      - name: resources
   146        path: /
   147        children:
   148        - name: foo.txt
   149          path: /foo.txt
   150  
   151  - name: has an overlay
   152    touch:
   153      - foo.txt
   154    patches:
   155      /foo.txt: bar
   156    expect:
   157      name: /
   158      path: /
   159      children:
   160        - name: /
   161          path: /
   162          children:
   163            - name: foo.txt
   164              path: /foo.txt
   165              hasOverlay: true
   166        - name: overlays
   167          path: /
   168          children:
   169            - name: foo.txt
   170              path: /foo.txt
   171  
   172  - name: has multiple overlays
   173    mkdir:
   174      - foo
   175    touch:
   176      - foo/bar.txt
   177      - foo/baz.txt
   178    patches:
   179      /foo/bar.txt: foobar
   180      /foo/baz.txt: foobaz
   181    expect:
   182      name: /
   183      path: /
   184      children:
   185        - name: /
   186          path: /
   187          children:
   188            - name: foo
   189              path: /foo
   190              children:
   191                - name: bar.txt
   192                  path: /foo/bar.txt
   193                  hasOverlay: true
   194                - name: baz.txt
   195                  path: /foo/baz.txt
   196                  hasOverlay: true
   197        - name: overlays
   198          path: /
   199          children:
   200            - name: foo
   201              path: /foo
   202              children:
   203                - name: bar.txt
   204                  path: /foo/bar.txt
   205                - name: baz.txt
   206                  path: /foo/baz.txt
   207  
   208  - name: has a nested overlay
   209    mkdir:
   210      - bar
   211    touch:
   212      - bar/foo.txt
   213    patches:
   214      /bar/foo.txt: baz
   215    expect:
   216      name: /
   217      path: /
   218      children:
   219        - name: /
   220          path: /
   221          children:
   222            - name: bar
   223              path: /bar
   224              children:
   225                - name: foo.txt
   226                  path: /bar/foo.txt
   227                  hasOverlay: true
   228        - name: overlays
   229          path: /
   230          children:
   231          - name: bar
   232            path: /bar
   233            children:
   234                - name: foo.txt
   235                  path: /bar/foo.txt
   236  
   237  - name: has an overlay with resources
   238    mkdir:
   239    - bar
   240    touch:
   241    - bar/foo.txt
   242    patches:
   243      /bar/foo.txt: baz
   244    resources:
   245      /bar/spam.txt: eggs
   246    expect:
   247      name: /
   248      path: /
   249      children:
   250      - name: /
   251        path: /
   252        children:
   253        - name: bar
   254          path: /bar
   255          children:
   256          - name: foo.txt
   257            path: /bar/foo.txt
   258            hasOverlay: true
   259      - name: overlays
   260        path: /
   261        children:
   262        - name: bar
   263          path: /bar
   264          children:
   265          - name: foo.txt
   266            path: /bar/foo.txt
   267      - name: resources
   268        path: /
   269        children:
   270        - name: bar
   271          path: /bar
   272          children:
   273          - name: spam.txt
   274            path: /bar/spam.txt