@@ -66,6 +66,7 @@ usage: action.sh [OPTION]...
66
66
@test " docs-ssh-key with space" {
67
67
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
68
68
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
69
+ stub ssh " $( capture_program " ssh" ) "
69
70
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
70
71
71
72
run action.sh --docs-username USER --docs-host HOST --docs-ssh-key ' SSH KEY' --docs-ssh-host-key HOST_KEY --site-path SITE_PATH --github-repository spring-projects/spring-security
@@ -74,10 +75,13 @@ usage: action.sh [OPTION]...
74
75
assert_output " " # No warnings due to spaces
75
76
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key SSH KEY --ssh-known-host HOST_KEY"
76
77
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path SITE_PATH --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
78
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
79
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
77
80
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
78
81
79
82
unstub --allow-missing setup_ssh.sh
80
83
unstub rsync_docs.sh
84
+ unstub ssh
81
85
unstub cleanup_ssh.sh
82
86
}
83
87
@@ -91,6 +95,7 @@ usage: action.sh [OPTION]...
91
95
@test " docs-ssh-host-key with space" {
92
96
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
93
97
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
98
+ stub ssh " $( capture_program " ssh" ) "
94
99
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
95
100
96
101
run action.sh --docs-username USER --docs-host HOST --docs-ssh-key ' SSH_KEY' --docs-ssh-host-key ' HOST KEY' --site-path SITE_PATH --github-repository spring-projects/spring-security
@@ -99,10 +104,13 @@ usage: action.sh [OPTION]...
99
104
assert_output " " # No warnings due to spaces
100
105
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key SSH_KEY --ssh-known-host HOST KEY"
101
106
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path SITE_PATH --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
107
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
108
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
102
109
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
103
110
104
111
unstub --allow-missing setup_ssh.sh
105
112
unstub rsync_docs.sh
113
+ unstub ssh
106
114
unstub cleanup_ssh.sh
107
115
}
108
116
@@ -116,74 +124,92 @@ usage: action.sh [OPTION]...
116
124
@test " valid arguments" {
117
125
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
118
126
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
127
+ stub ssh " $( capture_program " ssh" ) "
119
128
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
120
129
121
130
run action.sh --docs-username USER --docs-host HOST --docs-ssh-key KEY --docs-ssh-host-key HOST_KEY --site-path SITE_PATH --github-repository spring-projects/spring-security
122
131
123
132
assert_success
124
133
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
125
134
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path SITE_PATH --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
135
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
136
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
126
137
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
127
138
128
139
unstub --allow-missing setup_ssh.sh
129
140
unstub rsync_docs.sh
141
+ unstub ssh
130
142
unstub cleanup_ssh.sh
131
143
}
132
144
133
145
@test " missing site-path defaults build/site" {
134
146
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
135
147
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
148
+ stub ssh " $( capture_program " ssh" ) "
136
149
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
137
150
138
151
run action.sh --docs-username USER --docs-host HOST --docs-ssh-key KEY --docs-ssh-host-key HOST_KEY --github-repository spring-projects/spring-security
139
152
140
153
assert_success
141
154
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
142
155
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path build/site --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
156
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
157
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
143
158
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
159
+
144
160
unstub --allow-missing setup_ssh.sh
145
161
unstub rsync_docs.sh
162
+ unstub ssh
146
163
unstub cleanup_ssh.sh
147
164
}
148
165
149
166
# had a bug using -e instead of -z
150
167
@test " site-path where path exists does not default build/site" {
151
168
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
152
169
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
170
+ stub ssh " $( capture_program " ssh" ) "
153
171
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
154
172
155
173
run action.sh --docs-username USER --docs-host HOST --site-path " $BATS_TEMP_DIR " --docs-ssh-key KEY --docs-ssh-host-key HOST_KEY --github-repository spring-projects/spring-security
156
174
157
175
assert_success
158
176
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
159
177
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path $BATS_TEMP_DIR --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
178
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
179
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
160
180
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
161
181
162
182
unstub --allow-missing setup_ssh.sh
163
183
unstub rsync_docs.sh
184
+ unstub ssh
164
185
unstub cleanup_ssh.sh
165
186
}
166
187
167
188
@test " dry-run=true" {
168
189
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
169
190
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
191
+ stub ssh " $( capture_program " ssh" ) "
170
192
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
171
193
172
194
run action.sh --docs-username USER --docs-host HOST --docs-ssh-key KEY --docs-ssh-host-key HOST_KEY --site-path SITE_PATH --github-repository spring-projects/spring-security --dry-run
173
195
174
196
assert_success
175
197
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
176
198
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path SITE_PATH --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --dry-run"
199
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
200
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
177
201
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
178
202
179
203
unstub --allow-missing setup_ssh.sh
180
204
unstub rsync_docs.sh
205
+ unstub ssh
181
206
unstub cleanup_ssh.sh
182
207
}
183
208
184
209
@test " BUILD_REFNAME set" {
185
210
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
186
211
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
212
+ stub ssh " $( capture_program " ssh" ) "
187
213
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
188
214
189
215
export BUILD_REFNAME=6.1.x
@@ -193,25 +219,31 @@ usage: action.sh [OPTION]...
193
219
assert_success
194
220
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
195
221
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ --local-path SITE_PATH --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --build-ref-name 6.1.x --dry-run"
222
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/\" "
223
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
196
224
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
197
225
198
226
unstub --allow-missing setup_ssh.sh
199
227
unstub rsync_docs.sh
228
+ unstub ssh
200
229
unstub cleanup_ssh.sh
201
230
}
202
231
203
232
@test " httpdocs-path check httpdocs-path success" {
204
233
stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
205
234
stub ssh " $( capture_program " ssh" ) "
206
235
stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
236
+ stub ssh " $( capture_program " ssh" ) "
207
237
stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
208
238
209
239
run action.sh --docs-username USER --docs-host HOST --docs-ssh-key KEY --docs-ssh-host-key HOST_KEY --site-path SITE_PATH --github-repository spring-projects/spring-security --httpdocs-path /security/reference
210
240
211
241
assert_success
212
242
assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
213
- assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --github-repository \" spring-projects/spring-security\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/security/reference/\" "
243
+ assert_program_args " ssh" " -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --github-repository \" spring-projects/spring-security\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/security/reference/\"
244
+ -i $HOME /.ssh/spring-projects/spring-security USER@HOST bash -s -- --zip-name \" spring-security-docs.zip\" --ssh-docs-path \" /opt/www/domains/spring.io/docs/htdocs/security/reference/\" "
214
245
assert_regex " $( get_program_stdin ' ssh' ) " ' check_github_repository_owner'
246
+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
215
247
assert_program_args " rsync_docs" " --ssh-host USER@HOST --ssh-host-path /opt/www/domains/spring.io/docs/htdocs/security/reference/ --local-path SITE_PATH --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
216
248
assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
217
249
0 commit comments