github.com/bilus/oya@v0.0.3-0.20190301162104-da4acbd394c6/features/run.feature (about)

     1  Feature: Running tasks
     2  
     3  Background:
     4     Given I'm in project dir
     5  
     6  Scenario: Successfully run task
     7    Given file ./Oyafile containing
     8      """
     9      Project: project
    10      all: |
    11        foo=4
    12        if [ $$foo -ge 3 ]; then
    13          touch OK
    14        fi
    15        echo "Done"
    16      """
    17    When I run "oya run all"
    18    Then the command succeeds
    19    And the command outputs to stdout
    20    """
    21    Done
    22  
    23    """
    24    And file ./OK exists
    25  
    26  Scenario: Nested Oyafiles are not processed recursively by default
    27    Given file ./Oyafile containing
    28      """
    29      Project: project
    30      all: |
    31        touch Root
    32        echo "Root"
    33      """
    34    And file ./project1/Oyafile containing
    35      """
    36      all: |
    37        touch Project1
    38        echo "Project1"
    39      """
    40    And file ./project2/Oyafile containing
    41      """
    42      all: |
    43        touch Project2
    44        echo "Project2"
    45      """
    46    When I run "oya run all"
    47    Then the command succeeds
    48    And the command outputs to stdout
    49    """
    50    Root
    51  
    52    """
    53    And file ./Root exists
    54    And file ./project1/Project1 does not exist
    55    And file ./project2/Project2 does not exist
    56  
    57  Scenario: Nested Oyafiles can be processed recursively
    58    Given file ./Oyafile containing
    59      """
    60      Project: project
    61      all: |
    62        touch Root
    63        echo "Root"
    64      """
    65    And file ./project1/Oyafile containing
    66      """
    67      all: |
    68        touch Project1
    69        echo "Project1"
    70      """
    71    And file ./project2/Oyafile containing
    72      """
    73      all: |
    74        touch Project2
    75        echo "Project2"
    76      """
    77    When I run "oya run --recurse all"
    78    Then the command succeeds
    79    And the command outputs to stdout
    80    """
    81    Root
    82    Project1
    83    Project2
    84  
    85    """
    86    And file ./Root exists
    87    And file ./project1/Project1 exists
    88    And file ./project2/Project2 exists
    89  
    90  Scenario: No Oyafile
    91    Given file ./NotOyafile containing
    92      """
    93      Project: project
    94      """
    95    When I run "oya run all"
    96    Then the command fails with error matching
    97    """
    98    .*no Oyafile project in.*
    99    """
   100  
   101  Scenario: Missing task
   102    Given file ./Oyafile containing
   103      """
   104      Project: project
   105      """
   106    When I run "oya run all"
   107    Then the command fails with error
   108      """
   109      missing task "all"
   110      """
   111  
   112  Scenario: Script template
   113    Given file ./Oyafile containing
   114      """
   115      Project: project
   116      Values:
   117        value: some value
   118      all: |
   119        foo="$value"
   120        echo $$foo
   121      """
   122    When I run "oya run all"
   123    Then the command succeeds
   124    And the command outputs to stdout
   125    """
   126    some value
   127  
   128    """
   129  
   130  Scenario: Ignore projects inside current project
   131    Given file ./Oyafile containing
   132      """
   133      Project: main
   134      all: echo "main"
   135      """
   136    And file ./foo/Oyafile containing
   137      """
   138      Project: foo
   139      all: echo "foo"
   140      """
   141    When I run "oya run all"
   142    Then the command succeeds
   143    And the command outputs to stdout
   144    """
   145    main
   146  
   147    """
   148  
   149  Scenario: Ignore errors in projects inside current project
   150    Given file ./Oyafile containing
   151      """
   152      Project: main
   153      all: echo "main"
   154      """
   155    And file ./foo/Oyafile containing
   156      """
   157      Project: foo
   158      Import:
   159         xxx: does not exist
   160      all: echo "foo"
   161      """
   162    When I run "oya run all"
   163    Then the command succeeds
   164    And the command outputs to stdout
   165    """
   166    main
   167  
   168    """
   169  
   170  @bug
   171  Scenario: Running recursively
   172    Given file ./Oyafile containing
   173      """
   174      Project: project
   175      all: |
   176        touch Root
   177        echo "Root"
   178      """
   179    And file ./project1/Oyafile containing
   180      """
   181      all: |
   182        touch Project1
   183        echo "Project1"
   184      """
   185    And file ./project2/Oyafile containing
   186      """
   187      all: |
   188        touch Project2
   189        echo "Project2"
   190      """
   191    And I'm in the ./project1 dir
   192    When I run "oya run --recurse all"
   193    Then the command succeeds
   194    And the command outputs to stdout
   195    """
   196    Project1
   197  
   198    """
   199    And file ./Root does not exist
   200    And file ./project1/Project1 exists
   201    And file ./project2/Project2 does not exist
   202  
   203  Scenario: Running recursively
   204    Given file ./Oyafile containing
   205      """
   206      Project: project
   207      all: |
   208        touch Root
   209        echo "Root"
   210      """
   211    And file ./project1/Oyafile containing
   212      """
   213      all: |
   214        touch Project1
   215        echo "Project1"
   216      """
   217    And file ./project2/Oyafile containing
   218      """
   219      all: |
   220        touch Project2
   221        echo "Project2"
   222      """
   223    And I'm in the ./project1 dir
   224    When I run "oya run --recurse all"
   225    Then the command succeeds
   226    And the command outputs to stdout
   227    """
   228    Project1
   229  
   230    """
   231    And file ./Root does not exist
   232    And file ./project1/Project1 exists
   233    And file ./project2/Project2 does not exist
   234  
   235  Scenario: Running in a subdirectory
   236    Given file ./Oyafile containing
   237      """
   238      Project: project
   239      all: |
   240        echo "Root"
   241      """
   242    And file ./project1/Oyafile containing
   243      """
   244      all: |
   245        echo "Project1"
   246      """
   247    And I'm in the ./project1 dir
   248    When I run "oya run all"
   249    Then the command succeeds
   250    And the command outputs to stdout
   251    """
   252    Project1
   253  
   254    """
   255  
   256  Scenario: Allow empty Require, Import: Values
   257    Given file ./Oyafile containing
   258      """
   259      Project: project
   260  
   261      Require:
   262      Import:
   263      Values:
   264  
   265      foo: |
   266        echo "hello from foo"
   267      """
   268    When I run "oya run foo"
   269    Then the command succeeds
   270    And the command outputs to stdout
   271    """
   272    hello from foo
   273  
   274    """