@@ -331,11 +331,15 @@ func (t *mintingTestHarness) queueSeedlingsInBatch(isFunded bool,
331331
332332// assertPendingBatchExists asserts that a pending batch is found and it has
333333// numSeedlings assets registered.
334- func (t * mintingTestHarness ) assertPendingBatchExists (numSeedlings int ) {
335- t . Helper ()
334+ func (t * mintingTestHarness ) assertPendingBatchExists (
335+ expectedSeedlings [] * tapgarden. Seedling ) {
336336
337337 // The planter is a state machine, so we need to wait until it has
338338 // reached the expected state.
339+ var (
340+ numExpectedSeedlings = len (expectedSeedlings )
341+ lastActualSeedlings map [string ]* tapgarden.Seedling
342+ )
339343 err := wait .NoError (func () error {
340344 batch , err := t .planter .PendingBatch ()
341345 if err != nil {
@@ -348,14 +352,43 @@ func (t *mintingTestHarness) assertPendingBatchExists(numSeedlings int) {
348352 "non-nil" )
349353 }
350354
351- if len (batch .Seedlings ) < numSeedlings {
355+ lastActualSeedlings = batch .Seedlings
356+
357+ if len (batch .Seedlings ) < numExpectedSeedlings {
352358 return fmt .Errorf ("expected %d seedlings, got %d" ,
353- numSeedlings , len (batch .Seedlings ))
359+ numExpectedSeedlings , len (batch .Seedlings ))
354360 }
355361
356362 return nil
357363 }, defaultTimeout )
358- require .NoError (t , err )
364+ if err != nil {
365+ // Report any missing seedlings.
366+ spewCfg := spew.ConfigState {
367+ // Disable .String() and other methods.
368+ DisableMethods : true ,
369+ Indent : " " ,
370+ }
371+
372+ for idx := range expectedSeedlings {
373+ expectedSeedling := expectedSeedlings [idx ]
374+ if lastActualSeedlings == nil {
375+ t .Logf ("Missing expected seedling: %s" ,
376+ spewCfg .Sdump (expectedSeedling ))
377+ continue
378+ }
379+
380+ _ , ok := lastActualSeedlings [expectedSeedling .AssetName ]
381+ if ! ok {
382+ t .Logf ("Missing expected seedling: %s" ,
383+ spewCfg .Sdump (expectedSeedling ))
384+ }
385+ }
386+
387+ t .Fatalf ("Batch seedling mismatch: \n actual seedlings: %s\n " +
388+ "expected seedlings: %s\n error: %v" ,
389+ spew .Sdump (lastActualSeedlings ),
390+ spew .Sdump (expectedSeedlings ), err )
391+ }
359392}
360393
361394// assertNoActiveBatch asserts that no pending batch exists.
@@ -1089,7 +1122,7 @@ func (t *mintingTestHarness) queueInitialBatch(
10891122
10901123 // At this point, there should be a single pending batch with 5
10911124 // seedlings. The batch stored in the log should also match up exactly.
1092- t .assertPendingBatchExists (numSeedlings )
1125+ t .assertPendingBatchExists (seedlings )
10931126
10941127 // Before we tick the batch, we record all existing batches, so we can
10951128 // make sure a new one was created.
@@ -1329,7 +1362,7 @@ func testMintingCancelFinalize(t *mintingTestHarness) {
13291362 }
13301363 t .queueSeedlingsInBatch (false , seedlings ... )
13311364
1332- t .assertPendingBatchExists (numSeedlings )
1365+ t .assertPendingBatchExists (seedlings )
13331366 t .assertSeedlingsExist (seedlings , nil )
13341367
13351368 // If we attempt to queue a seedling with the same name as a pending
@@ -1781,7 +1814,7 @@ func testFundSealBeforeFinalize(t *mintingTestHarness) {
17811814 // Add the seedlings modified earlier to the batch, and check that they
17821815 // were added correctly.
17831816 t .queueSeedlingsInBatch (true , seedlings ... )
1784- t .assertPendingBatchExists (numSeedlings )
1817+ t .assertPendingBatchExists (seedlings )
17851818 t .assertSeedlingsExist (seedlings , nil )
17861819
17871820 verboseBatches , err := t .planter .ListBatches (
0 commit comments