Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions examples/banking-plantuml/architecture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ describe("Architecture", () => {
if (
items &&
!items.every((i: string) =>
config.sections.some((s) => s.prod_value === i),
config.sections.some(
(s) => s.prod_value === unescapePlantUmlUrl(i),
),
)
) {
log = `${log}❌ ${relation.to.name} ${items}`;
Expand Down Expand Up @@ -135,7 +137,9 @@ describe("Architecture", () => {
?.split(", ")
.every(
(i: string) =>
i.startsWith("https://gateway.int.com:443/") || /-v\d$/.exec(i),
unescapePlantUmlUrl(i).startsWith(
"https://gateway.int.com:443/",
) || /-v\d$/.exec(i),
)
) {
log = `${log}❌ ${r.to.name}`;
Expand All @@ -147,6 +151,10 @@ describe("Architecture", () => {
expect(pass).toBeTruthy();
});

function unescapePlantUmlUrl(url: string): string {
return url.replaceAll(/:~\/~?\//g, "://");
}

function checkSections(
config: DeployConfig,
containerFromPuml: Container,
Expand All @@ -157,13 +165,16 @@ describe("Architecture", () => {
config.sections.every((section) => {
const result =
containerFromPuml.relations.some((r) => {
const technology = r.technology
? unescapePlantUmlUrl(r.technology)
: undefined;
let result = false;
if (r.tags?.includes(AsyncTag))
result = r.technology?.includes(section.prod_value) === true;
result = technology?.includes(section.prod_value) === true;
if (!result && (!r.tags || r.tags.includes(RestTag)))
result =
r.to.name === section.name &&
(r.technology?.includes(section.prod_value) ||
(technology?.includes(section.prod_value) ||
r.to.type !== SystemExternalType);
return result;
}) ||
Expand All @@ -172,7 +183,10 @@ describe("Architecture", () => {
(r) =>
r.to.name === config.name &&
section.prod_value &&
r.technology?.includes(section.prod_value),
(r.technology
? unescapePlantUmlUrl(r.technology)
: ""
).includes(section.prod_value),
),
);
if (!result && verbose)
Expand All @@ -189,13 +203,16 @@ describe("Architecture", () => {
),
),
].every((relation) => {
const technology = relation.technology
? unescapePlantUmlUrl(relation.technology)
: undefined;
const result =
relation.to.name.endsWith("_db") ||
config.sections.some(
(configSection) =>
configSection.name === relation.to.name ||
(configSection.prod_value &&
relation.technology?.includes(configSection.prod_value)),
technology?.includes(configSection.prod_value)),
);

if (!result && verbose)
Expand Down
8 changes: 4 additions & 4 deletions resources/architecture/C4L2.puml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Boundary(our_system, "Our system"){
Rel(front, bff, "")
Rel(bff, camunda, "")
Rel(camunda, stock_acl, "")
Rel(stock_acl, stock, "", "https://gateway.int.com:443/stock/v1")
Rel(stock_acl, stock, "", "https:~/~/gateway.int.com:443/stock/v1")

Rel(bff, goods_acl, "")
Rel(goods_acl, goods_repository, "", "https://gateway.int.com:443/goods/v1")
Rel(goods_acl, goods2_repository, "", "https://gateway.int.com:443/goods2/v1")
Rel(goods_acl, goods_repository, "", "https:~/~/gateway.int.com:443/goods/v1")
Rel(goods_acl, goods2_repository, "", "https:~/~/gateway.int.com:443/goods2/v1")

Rel(bff, task_repository, "")
Rel(task_repository, task_repository_db, "")
Expand All @@ -51,7 +51,7 @@ Rel(camunda, invoice_repository, "")
Rel(camunda, invoice_acl, "")
Rel(invoice_source, invoice_acl, "", "orig-invoice-q8s-v1", $tags="async")
Rel(invoice_acl, invoice_dest, "", "result-invoice-q8s-v1", $tags="async")
Rel(invoice_acl, ext_system, "", "https://gateway.int.com:443/ext/v1")
Rel(invoice_acl, ext_system, "", "https:~/~/gateway.int.com:443/ext/v1")
'Rel(invoice_acl, bff, "", "https://gateway.int.com:443/ext/v1")

@enduml
Loading
Loading