github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/features/replace.feature (about)

     1  Feature: Replace directive
     2  
     3  Background:
     4    Given I'm in project dir
     5  
     6  
     7  Scenario: Use a local require
     8    Given file ./Oyafile containing
     9      """
    10      Project: project
    11  
    12      Require:
    13        github.com/tooploox/oya-fixtures: v1.0.0
    14  
    15      Replace:
    16        github.com/tooploox/oya-fixtures: /tmp/pack
    17  
    18      Import:
    19        foo: github.com/tooploox/oya-fixtures
    20      """
    21    And file /tmp/pack/Oyafile containing
    22      """
    23      Project: pack
    24  
    25      version: echo 1.0.0
    26      """
    27    When I run "oya run foo.version"
    28    Then the command succeeds
    29    And the command outputs
    30      """
    31      1.0.0
    32  
    33      """
    34    And file ./.oya/packs/github.com/tooploox/oya-fixtures@v1.0.0/Oyafile does not exist
    35  
    36  Scenario: With local require oya doesn't attempt to lookup requirements remotely
    37    Given file ./Oyafile containing
    38      """
    39      Project: project
    40  
    41      Require:
    42        github.com/tooploox/does-not-exist: v1.0.0
    43  
    44      Replace:
    45        github.com/tooploox/does-not-exist: /tmp/pack
    46  
    47      Import:
    48        foo: github.com/tooploox/does-not-exist
    49      """
    50    And file /tmp/pack/Oyafile containing
    51      """
    52      Project: pack
    53  
    54      version: echo 1.0.0
    55      """
    56    When I run "oya run foo.version"
    57    Then the command succeeds
    58  
    59  Scenario: Error for Replace in non-root Oyafile
    60    Given file ./Oyafile containing
    61      """
    62      Project: project
    63      """
    64    And file ./subdir/Oyafile containing
    65      """
    66      Replace:
    67        github.com/tooploox/oya-fixtures/pack3: ./pack3
    68      """
    69    When I'm in the subdir dir
    70    And I run "oya tasks"
    71    Then the command fails with error matching
    72      """
    73      .*unexpected Replace directive.*
    74      """