|
| 1 | +Feature: Create a pull-request/merge-request after update |
| 2 | + |
| 3 | + Scenario: Run update in no-op mode and ask for GitHub PR |
| 4 | + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" |
| 5 | + And a file named "managed_modules.yml" with: |
| 6 | + """ |
| 7 | + --- |
| 8 | + puppet-test: |
| 9 | + github: {} |
| 10 | + """ |
| 11 | + And I set the environment variables to: |
| 12 | + | variable | value | |
| 13 | + | GITHUB_TOKEN | foobar | |
| 14 | + | GITHUB_BASE_URL | https://github.example.com | |
| 15 | + And a file named "config_defaults.yml" with: |
| 16 | + """ |
| 17 | + --- |
| 18 | + test: |
| 19 | + name: aruba |
| 20 | + """ |
| 21 | + And a file named "moduleroot/test.erb" with: |
| 22 | + """ |
| 23 | + <%= @configs['name'] %> |
| 24 | + """ |
| 25 | + When I run `msync update --noop --branch managed_update --pr` |
| 26 | + Then the output should contain "Would submit PR " |
| 27 | + And the exit status should be 0 |
| 28 | + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" |
| 29 | + |
| 30 | + Scenario: Run update in no-op mode and ask for GitLab MR |
| 31 | + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" |
| 32 | + And a file named "managed_modules.yml" with: |
| 33 | + """ |
| 34 | + --- |
| 35 | + puppet-test: |
| 36 | + gitlab: { |
| 37 | + base_url: 'https://gitlab.example.com' |
| 38 | + } |
| 39 | + """ |
| 40 | + And I set the environment variables to: |
| 41 | + | variable | value | |
| 42 | + | GITLAB_TOKEN | foobar | |
| 43 | + And a file named "config_defaults.yml" with: |
| 44 | + """ |
| 45 | + --- |
| 46 | + test: |
| 47 | + name: aruba |
| 48 | + """ |
| 49 | + And a file named "moduleroot/test.erb" with: |
| 50 | + """ |
| 51 | + <%= @configs['name'] %> |
| 52 | + """ |
| 53 | + When I run `msync update --noop --branch managed_update --pr` |
| 54 | + Then the output should contain "Would submit MR " |
| 55 | + And the exit status should be 0 |
| 56 | + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" |
| 57 | + |
| 58 | + Scenario: Run update without changes in no-op mode and ask for GitLab MR |
| 59 | + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" |
| 60 | + And a directory named "moduleroot" |
| 61 | + And a file named "managed_modules.yml" with: |
| 62 | + """ |
| 63 | + --- |
| 64 | + puppet-test: |
| 65 | + gitlab: { |
| 66 | + base_url: 'https://gitlab.example.com' |
| 67 | + } |
| 68 | + """ |
| 69 | + And I set the environment variables to: |
| 70 | + | variable | value | |
| 71 | + | GITLAB_TOKEN | foobar | |
| 72 | + When I run `msync update --noop --branch managed_update --pr` |
| 73 | + Then the output should not contain "Would submit MR " |
| 74 | + And the exit status should be 0 |
| 75 | + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" |
| 76 | + |
| 77 | + Scenario: Ask for PR without credentials |
| 78 | + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" |
| 79 | + And a file named "managed_modules.yml" with: |
| 80 | + """ |
| 81 | + --- |
| 82 | + puppet-test: |
| 83 | + gitlab: { |
| 84 | + base_url: https://gitlab.example.com |
| 85 | + } |
| 86 | + """ |
| 87 | + And a file named "config_defaults.yml" with: |
| 88 | + """ |
| 89 | + --- |
| 90 | + test: |
| 91 | + name: aruba |
| 92 | + """ |
| 93 | + And a file named "moduleroot/test.erb" with: |
| 94 | + """ |
| 95 | + <%= @configs['name'] %> |
| 96 | + """ |
| 97 | + When I run `msync update --noop --pr` |
| 98 | + Then the stderr should contain "A token is required to use services from gitlab" |
| 99 | + And the exit status should be 1 |
| 100 | + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" |
| 101 | + |
| 102 | + Scenario: Ask for PR/MR with modules from GitHub and from GitLab |
| 103 | + Given a basic setup with a puppet module "puppet-github" from "fakenamespace" |
| 104 | + And a basic setup with a puppet module "puppet-gitlab" from "fakenamespace" |
| 105 | + And a file named "managed_modules.yml" with: |
| 106 | + """ |
| 107 | + --- |
| 108 | + puppet-github: |
| 109 | + github: |
| 110 | + base_url: https://github.example.com |
| 111 | + token: 'secret' |
| 112 | + puppet-gitlab: |
| 113 | + gitlab: |
| 114 | + base_url: https://gitlab.example.com |
| 115 | + token: 'secret' |
| 116 | + """ |
| 117 | + And a file named "config_defaults.yml" with: |
| 118 | + """ |
| 119 | + --- |
| 120 | + test: |
| 121 | + name: aruba |
| 122 | + """ |
| 123 | + And a file named "moduleroot/test.erb" with: |
| 124 | + """ |
| 125 | + <%= @configs['name'] %> |
| 126 | + """ |
| 127 | + When I run `msync update --noop --branch managed_update --pr` |
| 128 | + Then the exit status should be 0 |
| 129 | + And the output should contain "Would submit PR " |
| 130 | + And the output should contain "Would submit MR " |
| 131 | + And the puppet module "puppet-github" from "fakenamespace" should have no commits made by "Aruba" |
| 132 | + And the puppet module "puppet-gitlab" from "fakenamespace" should have no commits made by "Aruba" |
| 133 | + |
| 134 | + Scenario: Ask for PR with same source and target branch |
| 135 | + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" |
| 136 | + And a file named "managed_modules.yml" with: |
| 137 | + """ |
| 138 | + --- |
| 139 | + puppet-test: |
| 140 | + gitlab: |
| 141 | + token: 'secret' |
| 142 | + base_url: 'https://gitlab.example.com' |
| 143 | + """ |
| 144 | + And a file named "config_defaults.yml" with: |
| 145 | + """ |
| 146 | + --- |
| 147 | + test: |
| 148 | + name: aruba |
| 149 | + """ |
| 150 | + And a file named "moduleroot/test.erb" with: |
| 151 | + """ |
| 152 | + <%= @configs['name'] %> |
| 153 | + """ |
| 154 | + When I run `msync update --noop --branch managed_update --pr --pr-target-branch managed_update` |
| 155 | + Then the stderr should contain "Unable to open a pull request with the same source and target branch: 'managed_update'" |
| 156 | + And the exit status should be 1 |
| 157 | + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" |
| 158 | + |
| 159 | + Scenario: Ask for PR with the default branch as source and target |
| 160 | + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" |
| 161 | + And the puppet module "puppet-test" from "fakenamespace" has the default branch named "custom_default_branch" |
| 162 | + And a file named "managed_modules.yml" with: |
| 163 | + """ |
| 164 | + --- |
| 165 | + puppet-test: |
| 166 | + github: |
| 167 | + token: 'secret' |
| 168 | + base_url: 'https://gitlab.example.com' |
| 169 | + """ |
| 170 | + And a file named "config_defaults.yml" with: |
| 171 | + """ |
| 172 | + --- |
| 173 | + test: |
| 174 | + name: aruba |
| 175 | + """ |
| 176 | + And a file named "moduleroot/test.erb" with: |
| 177 | + """ |
| 178 | + <%= @configs['name'] %> |
| 179 | + """ |
| 180 | + And a directory named "moduleroot" |
| 181 | + When I run `msync update --noop --pr` |
| 182 | + Then the stderr should contain "Unable to open a pull request with the same source and target branch: 'custom_default_branch'" |
| 183 | + And the exit status should be 1 |
| 184 | + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" |
0 commit comments