@@ -66,6 +66,7 @@ usage: action.sh [OPTION]...
6666@test " docs-ssh-key with space" {
6767 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
6868 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
69+ stub ssh " $( capture_program " ssh" ) "
6970 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
7071
7172 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]...
7475 assert_output " " # No warnings due to spaces
7576 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"
7677 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'
7780 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
7881
7982 unstub --allow-missing setup_ssh.sh
8083 unstub rsync_docs.sh
84+ unstub ssh
8185 unstub cleanup_ssh.sh
8286}
8387
@@ -91,6 +95,7 @@ usage: action.sh [OPTION]...
9195@test " docs-ssh-host-key with space" {
9296 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
9397 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
98+ stub ssh " $( capture_program " ssh" ) "
9499 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
95100
96101 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]...
99104 assert_output " " # No warnings due to spaces
100105 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"
101106 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'
102109 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
103110
104111 unstub --allow-missing setup_ssh.sh
105112 unstub rsync_docs.sh
113+ unstub ssh
106114 unstub cleanup_ssh.sh
107115}
108116
@@ -116,74 +124,92 @@ usage: action.sh [OPTION]...
116124@test " valid arguments" {
117125 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
118126 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
127+ stub ssh " $( capture_program " ssh" ) "
119128 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
120129
121130 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
122131
123132 assert_success
124133 assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
125134 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'
126137 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
127138
128139 unstub --allow-missing setup_ssh.sh
129140 unstub rsync_docs.sh
141+ unstub ssh
130142 unstub cleanup_ssh.sh
131143}
132144
133145@test " missing site-path defaults build/site" {
134146 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
135147 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
148+ stub ssh " $( capture_program " ssh" ) "
136149 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
137150
138151 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
139152
140153 assert_success
141154 assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
142155 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'
143158 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
159+
144160 unstub --allow-missing setup_ssh.sh
145161 unstub rsync_docs.sh
162+ unstub ssh
146163 unstub cleanup_ssh.sh
147164}
148165
149166# had a bug using -e instead of -z
150167@test " site-path where path exists does not default build/site" {
151168 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
152169 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
170+ stub ssh " $( capture_program " ssh" ) "
153171 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
154172
155173 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
156174
157175 assert_success
158176 assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
159177 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'
160180 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
161181
162182 unstub --allow-missing setup_ssh.sh
163183 unstub rsync_docs.sh
184+ unstub ssh
164185 unstub cleanup_ssh.sh
165186}
166187
167188@test " dry-run=true" {
168189 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
169190 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
191+ stub ssh " $( capture_program " ssh" ) "
170192 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
171193
172194 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
173195
174196 assert_success
175197 assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
176198 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'
177201 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
178202
179203 unstub --allow-missing setup_ssh.sh
180204 unstub rsync_docs.sh
205+ unstub ssh
181206 unstub cleanup_ssh.sh
182207}
183208
184209@test " BUILD_REFNAME set" {
185210 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
186211 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
212+ stub ssh " $( capture_program " ssh" ) "
187213 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
188214
189215 export BUILD_REFNAME=6.1.x
@@ -193,25 +219,31 @@ usage: action.sh [OPTION]...
193219 assert_success
194220 assert_program_args " setup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security --ssh-private-key KEY --ssh-known-host HOST_KEY"
195221 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'
196224 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
197225
198226 unstub --allow-missing setup_ssh.sh
199227 unstub rsync_docs.sh
228+ unstub ssh
200229 unstub cleanup_ssh.sh
201230}
202231
203232@test " httpdocs-path check httpdocs-path success" {
204233 stub setup_ssh.sh " $( capture_program_args " setup_ssh" ) "
205234 stub ssh " $( capture_program " ssh" ) "
206235 stub rsync_docs.sh " $( capture_program_args " rsync_docs" ) "
236+ stub ssh " $( capture_program " ssh" ) "
207237 stub cleanup_ssh.sh " $( capture_program_args " cleanup_ssh" ) "
208238
209239 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
210240
211241 assert_success
212242 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/\" "
214245 assert_regex " $( get_program_stdin ' ssh' ) " ' check_github_repository_owner'
246+ assert_regex " $( get_program_stdin ' ssh' ) " ' zip_docs'
215247 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"
216248 assert_program_args " cleanup_ssh" " --ssh-private-key-path $HOME /.ssh/spring-projects/spring-security"
217249
0 commit comments