generated from coulomb/repo-seed
Discover runtime topology facts
This commit is contained in:
@@ -40,6 +40,15 @@ def test_scan_repo_emits_schema_valid_deterministic_snapshot(tmp_path: Path) ->
|
||||
assert nodes_by_label[("ScoreWorkload", "fixture-api")]["attributes"]["container_count"] == 1
|
||||
assert nodes_by_label[("Lockfile", "package-lock.json")]["attributes"]["path"] == "package-lock.json"
|
||||
assert nodes_by_label[("ServiceConfig", "application.yaml")]["attributes"]["format"] == "yaml"
|
||||
assert nodes_by_label[("Server", "127.0.0.1")]["attributes"]["server_type"] == "compose-host"
|
||||
assert nodes_by_label[("Server", "fixture-api.testing.svc.cluster.local")]["attributes"]["server_type"] == "kubernetes-service-dns"
|
||||
assert nodes_by_label[("Server", "declared.fixture.test")]["attributes"]["server_type"] == "declared-endpoint"
|
||||
assert nodes_by_label[("NetworkPort", "127.0.0.1:8080/tcp")]["attributes"]["target_port"] == 8080
|
||||
assert nodes_by_label[("NetworkPort", "fixture-api.testing.svc.cluster.local:8080/tcp")]["attributes"]["service_port"] == 8080
|
||||
assert nodes_by_label[("NetworkPort", "declared.fixture.test:9443/tcp")]["attributes"]["scheme"] == "https"
|
||||
assert nodes_by_label[("DomainName", "api.fixture.test")]["attributes"]["domain"] == "api.fixture.test"
|
||||
assert nodes_by_label[("DomainName", "api.k8s.fixture.test")]["attributes"]["domain"] == "api.k8s.fixture.test"
|
||||
assert nodes_by_label[("DomainName", "declared.fixture.test")]["attributes"]["domain"] == "declared.fixture.test"
|
||||
|
||||
edge_types = {edge["edge_type"] for edge in candidates["edges"]}
|
||||
assert edge_types >= {
|
||||
@@ -53,6 +62,10 @@ def test_scan_repo_emits_schema_valid_deterministic_snapshot(tmp_path: Path) ->
|
||||
"uses_config",
|
||||
"provides",
|
||||
"exposes",
|
||||
"opens_port",
|
||||
"exposes_port",
|
||||
"routes_to_port",
|
||||
"resolves_to",
|
||||
}
|
||||
assert {attribute["name"] for attribute in candidates["attributes"]} >= {
|
||||
"readme_title",
|
||||
@@ -147,7 +160,10 @@ services:
|
||||
api:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "127.0.0.1:8080:8080"
|
||||
labels:
|
||||
- "traefik.http.routers.fixture.rule=Host(`api.fixture.test`)"
|
||||
- "VIRTUAL_HOST=api-alt.fixture.test"
|
||||
""".lstrip(),
|
||||
)
|
||||
_write(
|
||||
@@ -236,6 +252,49 @@ metadata:
|
||||
spec:
|
||||
interface_type: http-api
|
||||
lifecycle: active
|
||||
service_id: fixture.api
|
||||
endpoint:
|
||||
url: https://declared.fixture.test:9443/api
|
||||
""".lstrip(),
|
||||
)
|
||||
_write(
|
||||
repo / "deploy" / "service.yaml",
|
||||
"""
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: fixture-api
|
||||
namespace: testing
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
protocol: TCP
|
||||
""".lstrip(),
|
||||
)
|
||||
_write(
|
||||
repo / "deploy" / "ingress.yaml",
|
||||
"""
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: fixture-api
|
||||
namespace: testing
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- secure.fixture.test
|
||||
rules:
|
||||
- host: api.k8s.fixture.test
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: fixture-api
|
||||
port:
|
||||
number: 8080
|
||||
""".lstrip(),
|
||||
)
|
||||
return repo
|
||||
|
||||
Reference in New Issue
Block a user