-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadd.feature
140 lines (122 loc) · 6.65 KB
/
add.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Copyright 2016 Ifwe Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Feature: package add application version [-f|--force]
As a user
I want to add a specific version of a package
So I can deploy that version of that package to targets
Background:
Given I have "dev" permissions
And there is an environment with name="dev"
And I am in the "dev" environment
Scenario: too few arguments
When I run "package add myapp --detach"
Then the output has "usage:"
Scenario: too many arguments
When I run "package add myapp vers foo --detach"
Then the output has "usage:"
Scenario: add a package to an application that doesn't exist
When I run "package add myapp 123 --detach"
Then the output is "Application does not exist: myapp"
Scenario: attempt to add package when jenkins is not accessible
Given there is an application with name="myapp"
When I run "package add myapp 123 --detach"
Then the output has "Unable to contact Jenkins server"
And there is no package with name="myapp",version="123"
@jenkins_server
Scenario: add a package to an application with a job name that doesn't exist
Given there is an application with name="myapp"
When I run "package add myapp 123 --detach"
Then the output has "Job does not exist on http://localhost"
And the output has "job@123"
And there is no package with name="myapp",version="123"
@jenkins_server
Scenario: add a package to an application with a version that doesn't exist
Given there is an application with name="myapp"
And there is a jenkins job with name="job"
When I run "package add myapp 123 --detach"
Then the output has "Build does not exist on http://localhost"
And the output has "job@123"
And there is no package with name="myapp",version="123"
@jenkins_server
Scenario: with --job flag indicating a non-existent job
Given there is an application with name="myapp"
And there is a jenkins job with name="job"
And the job has a build with number="123"
When I run "package add --job another_job myapp 123 --detach"
Then the output has "Job does not exist on http://localhost"
And the output has "job@123"
And there is no package with name="myapp",version=123
@jenkins_server
Scenario: add a package that has previously failed to an application
Given there is an application with name="myapp"
And there is a jenkins job with name="job"
And the job has a build with number="123"
And there is a package with name="myapp",version="123",status="failed"
When I run "package add myapp 123 --detach"
Then the output has "Package already exists with failed status. Changing status to pending for daemon to attempt re-adding..."
And the output has "Package ready for repo updater daemon. Disconnecting now."
And there is a package with name="myapp",version="123",status="pending",job="job"
@jenkins_server
Scenario: add a package to an application
Given there is an application with name="myapp"
And there is a jenkins job with name="job"
And the job has a build with number="123"
When I run "package add myapp 123 --detach"
Then the output has "Package ready for repo updater daemon. Disconnecting now."
And there is a package with name="myapp",version="123",status="pending",job="job"
@jenkins_server
Scenario: with explicit --job flag
Given there is an application with name="myapp"
And there is a jenkins job with name="another_job"
And the job has a build with number="123"
When I run "package add --job another_job myapp 123 --detach"
Then the output has "Package ready for repo updater daemon. Disconnecting now."
And there is a package with name="myapp",version="123",status="pending",job="another_job"
@jenkins_server
Scenario: override default job with explicit --job flag
Given there is an application with name="myapp"
And there is a jenkins job with name="job"
And there is a jenkins job with name="another_job"
And the job has a build with number="123"
When I run "package add --job another_job myapp 123 --detach"
Then the output has "Package ready for repo updater daemon. Disconnecting now."
And there is a package with name="myapp",version="123",status="pending",job="another_job"
@jenkins_server
Scenario: add a package to an application again
Given there is an application with name="myapp"
And there is a package with version="123"
And there is a jenkins job with name="job"
And the job has a build with number="123"
When I run "package add myapp 123 --detach"
Then the output has "Package already exists with status completed."
@jenkins_server
Scenario: add a package to an application again with --force
Given there is an application with name="myapp"
And there is a package with version="123"
And there is a jenkins job with name="job"
And the job has a build with number="123"
When I run "package add myapp 123 --detach --force"
Then the output has "Package was previously completed. Changing status to pending again for daemon to attempt re-adding..."
And there is a package with name="myapp",version="123",status="pending",job="job"
@jenkins_server
Scenario: add a package to an application again with the previous package in processing state
Given there is an application with name="myapp"
And there is a package with version="123",status="processing"
And there is a jenkins job with name="job"
And the job has a build with number="123"
When I run "package add myapp 123 --detach --force"
Then the output has "Package already being processed by daemon. Added"
# TODO: There are probably more failure tests that can be written here!
# e.g. test for already-exists package in various states: completed, pending, processing, removed, failed
# Scenario: after failure, make sure can still add