@@ -21,7 +21,7 @@ import (
21
21
22
22
type PublishSuite struct {
23
23
testing.FakeJujuHomeSuite
24
- testing .HTTPSuite
24
+ gitjujutesting .HTTPSuite
25
25
26
26
dir string
27
27
oldBaseURL string
@@ -172,13 +172,13 @@ func (s *PublishSuite) TestPreExistingPublished(c *gc.C) {
172
172
digest , err := s .branch .RevisionId ()
173
173
c .Assert (err , gc .IsNil )
174
174
body := `{"cs:precise/wordpress": {"kind": "published", "digest": %q, "revision": 42}}`
175
- testing .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
175
+ gitjujutesting .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
176
176
177
177
ctx , err := s .runPublish (c , "cs:precise/wordpress" )
178
178
c .Assert (err , gc .IsNil )
179
179
c .Assert (testing .Stdout (ctx ), gc .Equals , "cs:precise/wordpress-42\n " )
180
180
181
- req := testing .Server .WaitRequest ()
181
+ req := gitjujutesting .Server .WaitRequest ()
182
182
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
183
183
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:precise/wordpress@" + digest )
184
184
}
@@ -194,19 +194,19 @@ func (s *PublishSuite) TestPreExistingPublishedEdge(c *gc.C) {
194
194
c .Assert (err , gc .IsNil )
195
195
var body string
196
196
body = `{"cs:precise/wordpress": {"errors": ["entry not found"]}}`
197
- testing .Server .Response (200 , nil , []byte (body ))
197
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
198
198
body = `{"cs:precise/wordpress": {"kind": "published", "digest": %q, "revision": 42}}`
199
- testing .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
199
+ gitjujutesting .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
200
200
201
201
ctx , err := s .runPublish (c , "cs:precise/wordpress" )
202
202
c .Assert (err , gc .IsNil )
203
203
c .Assert (testing .Stdout (ctx ), gc .Equals , "cs:precise/wordpress-42\n " )
204
204
205
- req := testing .Server .WaitRequest ()
205
+ req := gitjujutesting .Server .WaitRequest ()
206
206
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
207
207
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:precise/wordpress@" + digest )
208
208
209
- req = testing .Server .WaitRequest ()
209
+ req = gitjujutesting .Server .WaitRequest ()
210
210
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
211
211
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:precise/wordpress" )
212
212
}
@@ -218,12 +218,12 @@ func (s *PublishSuite) TestPreExistingPublishError(c *gc.C) {
218
218
digest , err := s .branch .RevisionId ()
219
219
c .Assert (err , gc .IsNil )
220
220
body := `{"cs:precise/wordpress": {"kind": "publish-error", "digest": %q, "errors": ["an error"]}}`
221
- testing .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
221
+ gitjujutesting .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
222
222
223
223
_ , err = s .runPublish (c , "cs:precise/wordpress" )
224
224
c .Assert (err , gc .ErrorMatches , "charm could not be published: an error" )
225
225
226
- req := testing .Server .WaitRequest ()
226
+ req := gitjujutesting .Server .WaitRequest ()
227
227
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
228
228
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:precise/wordpress@" + digest )
229
229
}
@@ -249,19 +249,19 @@ func (s *PublishSuite) TestFullPublish(c *gc.C) {
249
249
250
250
// The local digest isn't found.
251
251
body = `{"cs:~user/precise/wordpress": {"kind": "", "errors": ["entry not found"]}}`
252
- testing .Server .Response (200 , nil , []byte (body ))
252
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
253
253
254
254
// But the charm exists with an arbitrary non-matching digest.
255
255
body = `{"cs:~user/precise/wordpress": {"kind": "published", "digest": "other-digest"}}`
256
- testing .Server .Response (200 , nil , []byte (body ))
256
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
257
257
258
258
// After the branch is pushed we fake the publishing delay.
259
259
body = `{"cs:~user/precise/wordpress": {"kind": "published", "digest": "other-digest"}}`
260
- testing .Server .Response (200 , nil , []byte (body ))
260
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
261
261
262
262
// And finally report success.
263
263
body = `{"cs:~user/precise/wordpress": {"kind": "published", "digest": %q, "revision": 42}}`
264
- testing .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
264
+ gitjujutesting .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
265
265
266
266
ctx , err := testing .RunCommandInDir (c , envcmd .Wrap (cmd ), []string {"cs:~user/precise/wordpress" }, s .dir )
267
267
c .Assert (err , gc .IsNil )
@@ -273,14 +273,14 @@ func (s *PublishSuite) TestFullPublish(c *gc.C) {
273
273
c .Assert (pushDigest , gc .Equals , digest )
274
274
275
275
// And that all the requests were sent with the proper data.
276
- req := testing .Server .WaitRequest ()
276
+ req := gitjujutesting .Server .WaitRequest ()
277
277
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
278
278
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:~user/precise/wordpress@" + digest )
279
279
280
280
for i := 0 ; i < 3 ; i ++ {
281
281
// The second request grabs tip to see the current state, and the
282
282
// following requests are done after pushing to see when it changes.
283
- req = testing .Server .WaitRequest ()
283
+ req = gitjujutesting .Server .WaitRequest ()
284
284
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
285
285
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:~user/precise/wordpress" )
286
286
}
@@ -307,17 +307,17 @@ func (s *PublishSuite) TestFullPublishError(c *gc.C) {
307
307
308
308
// The local digest isn't found.
309
309
body = `{"cs:~user/precise/wordpress": {"kind": "", "errors": ["entry not found"]}}`
310
- testing .Server .Response (200 , nil , []byte (body ))
310
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
311
311
312
312
// And tip isn't found either, meaning the charm was never published.
313
- testing .Server .Response (200 , nil , []byte (body ))
313
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
314
314
315
315
// After the branch is pushed we fake the publishing delay.
316
- testing .Server .Response (200 , nil , []byte (body ))
316
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
317
317
318
318
// And finally report success.
319
319
body = `{"cs:~user/precise/wordpress": {"kind": "published", "digest": %q, "revision": 42}}`
320
- testing .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
320
+ gitjujutesting .Server .Response (200 , nil , []byte (fmt .Sprintf (body , digest )))
321
321
322
322
ctx , err := testing .RunCommandInDir (c , envcmd .Wrap (cmd ), []string {"cs:~user/precise/wordpress" }, s .dir )
323
323
c .Assert (err , gc .IsNil )
@@ -329,14 +329,14 @@ func (s *PublishSuite) TestFullPublishError(c *gc.C) {
329
329
c .Assert (pushDigest , gc .Equals , digest )
330
330
331
331
// And that all the requests were sent with the proper data.
332
- req := testing .Server .WaitRequest ()
332
+ req := gitjujutesting .Server .WaitRequest ()
333
333
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
334
334
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:~user/precise/wordpress@" + digest )
335
335
336
336
for i := 0 ; i < 3 ; i ++ {
337
337
// The second request grabs tip to see the current state, and the
338
338
// following requests are done after pushing to see when it changes.
339
- req = testing .Server .WaitRequest ()
339
+ req = gitjujutesting .Server .WaitRequest ()
340
340
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
341
341
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:~user/precise/wordpress" )
342
342
}
@@ -363,17 +363,17 @@ func (s *PublishSuite) TestFullPublishRace(c *gc.C) {
363
363
364
364
// The local digest isn't found.
365
365
body = `{"cs:~user/precise/wordpress": {"kind": "", "errors": ["entry not found"]}}`
366
- testing .Server .Response (200 , nil , []byte (body ))
366
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
367
367
368
368
// And tip isn't found either, meaning the charm was never published.
369
- testing .Server .Response (200 , nil , []byte (body ))
369
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
370
370
371
371
// After the branch is pushed we fake the publishing delay.
372
- testing .Server .Response (200 , nil , []byte (body ))
372
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
373
373
374
374
// But, surprisingly, the digest changed to something else entirely.
375
375
body = `{"cs:~user/precise/wordpress": {"kind": "published", "digest": "surprising-digest", "revision": 42}}`
376
- testing .Server .Response (200 , nil , []byte (body ))
376
+ gitjujutesting .Server .Response (200 , nil , []byte (body ))
377
377
378
378
_ , err = testing .RunCommandInDir (c , envcmd .Wrap (cmd ), []string {"cs:~user/precise/wordpress" }, s .dir )
379
379
c .Assert (err , gc .ErrorMatches , `charm changed but not to local charm digest; publishing race\?` )
@@ -384,14 +384,14 @@ func (s *PublishSuite) TestFullPublishRace(c *gc.C) {
384
384
c .Assert (pushDigest , gc .Equals , digest )
385
385
386
386
// And that all the requests were sent with the proper data.
387
- req := testing .Server .WaitRequest ()
387
+ req := gitjujutesting .Server .WaitRequest ()
388
388
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
389
389
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:~user/precise/wordpress@" + digest )
390
390
391
391
for i := 0 ; i < 3 ; i ++ {
392
392
// The second request grabs tip to see the current state, and the
393
393
// following requests are done after pushing to see when it changes.
394
- req = testing .Server .WaitRequest ()
394
+ req = gitjujutesting .Server .WaitRequest ()
395
395
c .Assert (req .URL .Path , gc .Equals , "/charm-event" )
396
396
c .Assert (req .Form .Get ("charms" ), gc .Equals , "cs:~user/precise/wordpress" )
397
397
}
0 commit comments