@@ -312,7 +312,6 @@ describe("reconcile tests", () => {
312312 exec : jest . fn ( ) . mockReturnValue ( Promise . resolve ( { } ) ) ,
313313 generateAccessYaml : jest . fn ( ) ,
314314 getGitOrigin : jest . fn ( ) ,
315- test : jest . fn ( ) . mockReturnValue ( false ) ,
316315 writeFile : jest . fn ( )
317316 } ;
318317
@@ -418,7 +417,32 @@ describe("reconcile tests", () => {
418417 expect ( dependencies . createIngressRouteForRing ) . not . toHaveBeenCalled ( ) ;
419418 } ) ;
420419
421- it ( "will re-write rings, even if they exist" , async ( ) => {
420+ it ( "overwrites existing rings" , async ( ) => {
421+ bedrockYaml . rings = {
422+ dev : {
423+ isDefault : true
424+ }
425+ } ;
426+
427+ for ( const i of Array ( 2 ) ) {
428+ await reconcileHld (
429+ dependencies ,
430+ bedrockYaml ,
431+ "service" ,
432+ "./path/to/hld" ,
433+ "./path/to/app"
434+ ) ;
435+ }
436+
437+ // Reconcile should run twice against the existing service's rings.
438+ expect ( dependencies . createRingComponent ) . toHaveBeenCalledTimes ( 2 ) ;
439+ expect ( dependencies . addChartToRing ) . toHaveBeenCalledTimes ( 2 ) ;
440+ expect ( dependencies . createStaticComponent ) . toHaveBeenCalledTimes ( 2 ) ;
441+ expect ( dependencies . createMiddlewareForRing ) . toHaveBeenCalledTimes ( 2 ) ;
442+ expect ( dependencies . createIngressRouteForRing ) . toHaveBeenCalledTimes ( 2 ) ;
443+ } ) ;
444+
445+ it ( "does not create rings, if they don't exist wihin bedrock.yaml" , async ( ) => {
422446 bedrockYaml . rings = { } ;
423447
424448 await reconcileHld (
@@ -429,10 +453,10 @@ describe("reconcile tests", () => {
429453 "./path/to/app"
430454 ) ;
431455
432- expect ( dependencies . createRingComponent ) . toHaveBeenCalled ( ) ;
433- expect ( dependencies . createStaticComponent ) . toHaveBeenCalled ( ) ;
434- expect ( dependencies . createMiddlewareForRing ) . toHaveBeenCalled ( ) ;
435- expect ( dependencies . createIngressRouteForRing ) . toHaveBeenCalled ( ) ;
456+ expect ( dependencies . createRingComponent ) . not . toHaveBeenCalled ( ) ;
457+ expect ( dependencies . createStaticComponent ) . not . toHaveBeenCalled ( ) ;
458+ expect ( dependencies . createMiddlewareForRing ) . not . toHaveBeenCalled ( ) ;
459+ expect ( dependencies . createIngressRouteForRing ) . not . toHaveBeenCalled ( ) ;
436460 } ) ;
437461
438462 it ( "does not create service components if the service path is `.`, and a display name does not exist" , async ( ) => {
0 commit comments