Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 067b409

Browse files
committed
Fix: always re-create ring components
1 parent 66c8460 commit 067b409

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

src/commands/hld/reconcile.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ describe("reconcile tests", () => {
418418
expect(dependencies.createIngressRouteForRing).not.toHaveBeenCalled();
419419
});
420420

421-
it("does not create a ring, if one already exists", async () => {
421+
it("will re-write rings, even if they exist", async () => {
422422
bedrockYaml.rings = {};
423423

424424
await reconcileHld(
@@ -429,10 +429,10 @@ describe("reconcile tests", () => {
429429
"./path/to/app"
430430
);
431431

432-
expect(dependencies.createRingComponent).not.toHaveBeenCalled();
433-
expect(dependencies.createStaticComponent).not.toHaveBeenCalled();
434-
expect(dependencies.createMiddlewareForRing).not.toHaveBeenCalled();
435-
expect(dependencies.createIngressRouteForRing).not.toHaveBeenCalled();
432+
expect(dependencies.createRingComponent).toHaveBeenCalled();
433+
expect(dependencies.createStaticComponent).toHaveBeenCalled();
434+
expect(dependencies.createMiddlewareForRing).toHaveBeenCalled();
435+
expect(dependencies.createIngressRouteForRing).toHaveBeenCalled();
436436
});
437437

438438
it("does not create service components if the service path is `.`, and a display name does not exist", async () => {

src/commands/hld/reconcile.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -263,23 +263,9 @@ export const reconcileHld = async (
263263

264264
// Create ring components.
265265
const svcPathInHld = path.join(absRepositoryInHldPath, serviceName);
266-
267-
// If the ring component already exists, we do not attempt to create it.
268-
const ringsToCreate = Object.keys(managedRings)
269-
.map(ring => {
270-
return { ring, ringPathInHld: path.join(svcPathInHld, ring) };
271-
})
272-
.filter(({ ring, ringPathInHld }) => {
273-
const alreadyExists =
274-
dependencies.test("-e", ringPathInHld) && // path exists
275-
dependencies.test("-d", ringPathInHld); // path is a directory
276-
if (alreadyExists) {
277-
logger.info(
278-
`Ring component: ${ring} already exists, skipping ring generation.`
279-
);
280-
}
281-
return !alreadyExists;
282-
});
266+
const ringsToCreate = Object.keys(managedRings).map(ring => {
267+
return { ring, ringPathInHld: path.join(svcPathInHld, ring) };
268+
});
283269

284270
// Will only loop over _existing_ rings in bedrock.yaml - does not cover the deletion case, ie: i remove a ring from bedrock.yaml
285271
for (const { ring, ringPathInHld } of ringsToCreate) {

0 commit comments

Comments
 (0)