@tdk-landscape/tdk-cli-core 1.3.15 ā 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tiltfile +144 -0
- package/discovery/AGENTS.md +362 -0
- package/discovery/TILT_DISCOVERY.star +424 -0
- package/discovery/Tiltfile +58 -0
- package/discovery/config.star +258 -0
- package/discovery/constants.star +127 -0
- package/discovery/deterministic.star +211 -0
- package/discovery/discovery_daemon.star +191 -0
- package/discovery/discovery_orchestrator.star +460 -0
- package/discovery/filtering.star +5 -0
- package/discovery/identity-management-backend/service.yaml +26 -0
- package/discovery/identity-management-frontend/service.yaml +29 -0
- package/discovery/identity-sdk/service.yaml +9 -0
- package/discovery/incremental_discovery.star +213 -0
- package/discovery/indexing.star +7 -0
- package/discovery/json_manifest_scanner.star +51 -0
- package/discovery/libraries.star +46 -0
- package/discovery/loading.star +23 -0
- package/discovery/manifest/constants.star +104 -0
- package/discovery/manifest/loading.star +386 -0
- package/discovery/manifest/normalize.star +281 -0
- package/discovery/manifest/validation.star +108 -0
- package/discovery/normalization.star +11 -0
- package/discovery/registry.star +544 -0
- package/discovery/resource_snapshot.py +382 -0
- package/discovery/resource_snapshot.star +143 -0
- package/discovery/schemas.star +1 -0
- package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
- package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
- package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
- package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
- package/discovery/test_resource_snapshot.py +251 -0
- package/discovery/validation.star +78 -0
- package/discovery/versioning.star +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +11 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +1 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/project.d.ts.map +1 -1
- package/dist/commands/project.js +36 -41
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/resource.d.ts.map +1 -1
- package/dist/commands/resource.js +51 -55
- package/dist/commands/resource.js.map +1 -1
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +22 -24
- package/dist/commands/stack.js.map +1 -1
- package/dist/commands/ui.d.ts.map +1 -1
- package/dist/commands/ui.js +1 -2
- package/dist/commands/ui.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +1 -2
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/upgrade.d.ts +8 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +59 -18
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/generator/extension-fetch.d.ts +19 -0
- package/dist/generator/extension-fetch.d.ts.map +1 -1
- package/dist/generator/extension-fetch.js +71 -5
- package/dist/generator/extension-fetch.js.map +1 -1
- package/dist/generator/template-engine.d.ts +1 -0
- package/dist/generator/template-engine.d.ts.map +1 -1
- package/dist/generator/template-engine.js +50 -6
- package/dist/generator/template-engine.js.map +1 -1
- package/dist/utils/command-helpers.d.ts.map +1 -1
- package/dist/utils/command-helpers.js +7 -9
- package/dist/utils/command-helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/project-features.d.ts.map +1 -1
- package/dist/utils/project-features.js +1 -1
- package/dist/utils/project-features.js.map +1 -1
- package/dist/utils/resource-features.d.ts.map +1 -1
- package/dist/utils/resource-features.js +2 -2
- package/dist/utils/resource-features.js.map +1 -1
- package/dist/utils/tar.js +4 -4
- package/dist/utils/tar.js.map +1 -1
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +9 -0
- package/dist/utils/validation.js.map +1 -1
- package/engine/AGENTS.md +705 -0
- package/engine/README.md +29 -0
- package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
- package/engine/Tiltfile +80 -0
- package/engine/assets/docker/golden-layers.Dockerfile +221 -0
- package/engine/assets/scripts/cleanup-completed-migrator-images.sh +37 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +120 -0
- package/engine/assets/scripts/mac-m1-resource-monitor.sh +121 -0
- package/engine/config.star +3 -0
- package/engine/docs/AUTODISCOVERY_TEST.md +182 -0
- package/engine/docs/C4-ARCHITECTURE-operations.md +396 -0
- package/engine/docs/C4-ARCHITECTURE-overview.md +284 -0
- package/engine/docs/C4-ARCHITECTURE.md +17 -0
- package/engine/docs/GOLDEN_IMAGE_INTEGRATION.md +349 -0
- package/engine/docs/MANIFEST_DRIVEN_ARCHITECTURE.md +357 -0
- package/engine/docs/README.md +284 -0
- package/engine/entrypoint.star +97 -0
- package/engine/lifecycle/orchestrator.star +260 -0
- package/engine/paths.star +717 -0
- package/engine/schemas/manifest-schema.json +301 -0
- package/engine/schemas/service-schema.json +301 -0
- package/engine/scripts/README.md +89 -0
- package/engine/scripts/build-and-publish-lib.sh +205 -0
- package/engine/scripts/check-lib-publish.sh +85 -0
- package/engine/scripts/debug-container.sh +258 -0
- package/engine/scripts/generate-manifest.sh +197 -0
- package/engine/spec.master +702 -0
- package/engine/spec.master.example +341 -0
- package/engine/topologies/README.md +34 -0
- package/engine/topologies/platform/docker/AGENTS.md +59 -0
- package/engine/topologies/platform/docker/auth/auth.star +167 -0
- package/engine/topologies/platform/docker/build/golden_image.star +37 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +82 -0
- package/engine/topologies/platform/docker/build/golden_image_constants.star +93 -0
- package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +291 -0
- package/engine/topologies/platform/docker/compose/compose.star +636 -0
- package/engine/topologies/platform/docker/compose/compose_helpers.star +52 -0
- package/engine/topologies/platform/docker/compose/traefik_standalone.star +53 -0
- package/engine/topologies/platform/docker/config/bunignore.star +142 -0
- package/engine/topologies/platform/docker/config/dockerignore.star +150 -0
- package/engine/topologies/platform/docker/constants.star +170 -0
- package/engine/topologies/platform/docker/dockerfile/dockerfile.star +54 -0
- package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +73 -0
- package/engine/topologies/platform/docker/index.star +27 -0
- package/engine/topologies/platform/docker/layers/bun_helpers.star +23 -0
- package/engine/topologies/platform/docker/layers/infisical/index.star +40 -0
- package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +262 -0
- package/engine/topologies/platform/docker/layers/l1_base_layers.star +87 -0
- package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +125 -0
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +209 -0
- package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +214 -0
- package/engine/topologies/platform/docker/layers/prisma/constants.star +135 -0
- package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +96 -0
- package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +109 -0
- package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +98 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +126 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +161 -0
- package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +119 -0
- package/engine/topologies/platform/docker/networking/api_path_constants.star +230 -0
- package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +27 -0
- package/engine/topologies/platform/docker/networking/traefik.star +232 -0
- package/engine/topologies/platform/docker/networking/traefik_constants.star +146 -0
- package/engine/topologies/platform/docker/networking/traefik_helpers.star +160 -0
- package/engine/topologies/platform/docker/secrets/infisical.star +135 -0
- package/engine/topologies/platform/net/proxy.star +4 -0
- package/engine/topologies/platform/registries/local.star +4 -0
- package/engine/topologies/platform/security/secrets.star +239 -0
- package/engine/topologies/platform/state/relational.star +4 -0
- package/engine/topologies/tilt/common/AGENTS.md +59 -0
- package/engine/topologies/tilt/common/utils.star +364 -0
- package/engine/topologies/tilt/common/utils_debug.star +69 -0
- package/engine/topologies/tilt/common/utils_deterministic.star +168 -0
- package/engine/topologies/tilt/common/utils_docker_networks.star +46 -0
- package/engine/topologies/tilt/common/utils_env.star +43 -0
- package/engine/topologies/tilt/common/utils_output.star +97 -0
- package/engine/topologies/tilt/config/AGENTS.md +68 -0
- package/engine/topologies/tilt/config/defaults.star +3 -0
- package/engine/topologies/tilt/config/feature_flags.star +10 -0
- package/engine/topologies/tilt/config/global.star +55 -0
- package/engine/topologies/tilt/config/profiles.star +382 -0
- package/engine/topologies/tilt/generators/agents_md.star +62 -0
- package/engine/topologies/tilt/generators/api_gateway.star +145 -0
- package/engine/topologies/tilt/generators/index.star +124 -0
- package/engine/topologies/tilt/generators/infisical/README.md +424 -0
- package/engine/topologies/tilt/generators/infisical/examples.star +312 -0
- package/engine/topologies/tilt/generators/infisical/index.star +57 -0
- package/engine/topologies/tilt/generators/infisical/machine_identity.star +420 -0
- package/engine/topologies/tilt/generators/infisical/organization.star +534 -0
- package/engine/topologies/tilt/generators/infisical/path_manager.star +476 -0
- package/engine/topologies/tilt/generators/infisical/secrets_generator.star +420 -0
- package/engine/topologies/tilt/generators/nginx_conf.star +143 -0
- package/engine/topologies/tilt/generators/npmrc.star +111 -0
- package/engine/topologies/tilt/generators/tsconfig.star +23 -0
- package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +71 -0
- package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +124 -0
- package/engine/topologies/tilt/generators/typescript/common.star +7 -0
- package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +76 -0
- package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +110 -0
- package/engine/topologies/tilt/generators/typescript/include.star +23 -0
- package/engine/topologies/tilt/generators/typescript/playwright_config.star +40 -0
- package/engine/topologies/tilt/generators/typescript/prisma_config.star +49 -0
- package/engine/topologies/tilt/generators/validators.star +853 -0
- package/engine/topologies/tilt/generators/vite/backend.star +78 -0
- package/engine/topologies/tilt/generators/vite/frontend.star +98 -0
- package/engine/topologies/tilt/generators/vite/generators.star +43 -0
- package/engine/topologies/tilt/generators/vite/helpers.star +244 -0
- package/engine/topologies/tilt/generators/vite/library.star +65 -0
- package/engine/topologies/tilt/generators/vite/sdk.star +73 -0
- package/engine/topologies/tilt/generators/vite/templates.star +737 -0
- package/engine/topologies/tilt/generators/vite_config.star +22 -0
- package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
- package/engine/topologies/tilt/manifest/README.md +693 -0
- package/engine/topologies/tilt/manifest/__init__.star +218 -0
- package/engine/topologies/tilt/manifest/constants.star +252 -0
- package/engine/topologies/tilt/manifest/errors.star +266 -0
- package/engine/topologies/tilt/manifest/integration.star +339 -0
- package/engine/topologies/tilt/manifest/json_to_yaml.py +54 -0
- package/engine/topologies/tilt/manifest/loader.star +214 -0
- package/engine/topologies/tilt/manifest/mapper.star +227 -0
- package/engine/topologies/tilt/manifest/parser.star +400 -0
- package/engine/topologies/tilt/manifest/schema.star +462 -0
- package/engine/topologies/tilt/manifest/tests/test_integration.star +276 -0
- package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +397 -0
- package/engine/topologies/tilt/manifest/tests/test_manifest.star +316 -0
- package/engine/topologies/tilt/manifest/tests/test_validator.star +470 -0
- package/engine/topologies/tilt/manifest/validator.star +717 -0
- package/engine/topologies/tilt/manifest/yaml_to_json.py +18 -0
- package/engine/topologies/tilt/resources/AGENTS.md +71 -0
- package/engine/topologies/tilt/resources/conditions.star +3 -0
- package/engine/topologies/tilt/resources/databases.star +244 -0
- package/engine/topologies/tilt/resources/declaration.star +3 -0
- package/engine/topologies/tilt/resources/deps.star +3 -0
- package/engine/topologies/tilt/resources/infra-loader.star +437 -0
- package/engine/topologies/tilt/resources/libs.star +30 -0
- package/engine/topologies/tilt/resources/libs_discovery.star +102 -0
- package/engine/topologies/tilt/resources/libs_paths.star +79 -0
- package/engine/topologies/tilt/resources/libs_resource_definition.star +151 -0
- package/engine/topologies/tilt/resources/libs_setup.star +164 -0
- package/engine/topologies/tilt/resources/libs_tsconfig.star +37 -0
- package/engine/topologies/tilt/resources/orchestrator/apply.star +77 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +431 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +81 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +148 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +36 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +44 -0
- package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +164 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +21 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +134 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/env.star +258 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +169 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +524 -0
- package/engine/topologies/tilt/resources/orchestrator/helpers.star +33 -0
- package/engine/topologies/tilt/resources/orchestrator.star +54 -0
- package/engine/topologies/tilt/resources/ordering.star +3 -0
- package/engine/topologies/tilt/resources/triggers.star +3 -0
- package/engine/topologies/tilt/resources/watchers.star +299 -0
- package/engine/where-things-live.star +717 -0
- package/ext/Tiltfile +66 -0
- package/ext/ide-components/README.md +219 -0
- package/ext/ide-components/code_executor/server.py +268 -0
- package/ext/ide-components/code_viewer/server.py +206 -0
- package/ext/ide-components/config_inspector/server.py +1050 -0
- package/ext/ide-components/file_browser/server.py +285 -0
- package/ext/ide-components/shared/config_service.py +469 -0
- package/ext/ide-components/shared/file_utils.py +298 -0
- package/ext/ide-components/shared/http_utils.py +232 -0
- package/ext/ide-components/shared/static/styles.css +1334 -0
- package/ext/ide-components/shared/syntax_highlighter.py +140 -0
- package/ext/ide-components/shared/template_engine.py +123 -0
- package/ext/ide-components/shared/templates/base.html +121 -0
- package/ext/ide-components/shared/test_config_service.py +326 -0
- package/ext/ide-components/shared/tilt_integration.py +158 -0
- package/ext/ui-enhancements/cron-status-server.sh +49 -0
- package/ext/ui-enhancements/cron-status-tracker.sh +146 -0
- package/ext/ui-enhancements/extension.yaml +36 -0
- package/ext/ui-enhancements/tiltfile.py +99 -0
- package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
- package/ext/ui-enhancements/ui/help-panel.css +279 -0
- package/ext/ui-enhancements/ui/icons.css +125 -0
- package/ext/ui-enhancements/ui/tooltips.css +114 -0
- package/package.json +13 -9
- package/specs/specs/TILT_SERVICE_DEFAULTS.star +205 -0
- package/specs/specs/TILT_TECH_STACK.star +159 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# š MANIFEST MODULE - INTEGRATION TESTS (Phase 4)
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Path: .tilt/topologies/tilt/manifest/tests/test_integration.star
|
|
5
|
+
# Purpose: Integration tests for discovery system integration
|
|
6
|
+
# Status: Phase 4 of manifest system refactoring
|
|
7
|
+
# =============================================================================
|
|
8
|
+
|
|
9
|
+
load("../__init__.star", "Manifest")
|
|
10
|
+
load("../integration.star", "ManifestIntegration")
|
|
11
|
+
|
|
12
|
+
# =============================================================================
|
|
13
|
+
# TEST FRAMEWORK
|
|
14
|
+
# =============================================================================
|
|
15
|
+
|
|
16
|
+
test_results = {
|
|
17
|
+
'passed': 0,
|
|
18
|
+
'failed': 0,
|
|
19
|
+
'errors': [],
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def assert_true(condition, message="Assertion failed"):
|
|
23
|
+
"""Assert that condition is true."""
|
|
24
|
+
if not condition:
|
|
25
|
+
test_results['failed'] += 1
|
|
26
|
+
test_results['errors'].append("FAIL: " + message)
|
|
27
|
+
else:
|
|
28
|
+
test_results['passed'] += 1
|
|
29
|
+
|
|
30
|
+
def assert_equal(expected, actual, message="Values not equal"):
|
|
31
|
+
"""Assert that expected equals actual."""
|
|
32
|
+
if expected != actual:
|
|
33
|
+
test_results['failed'] += 1
|
|
34
|
+
test_results['errors'].append(
|
|
35
|
+
"FAIL: {} - expected '{}', got '{}'".format(message, expected, actual)
|
|
36
|
+
)
|
|
37
|
+
else:
|
|
38
|
+
test_results['passed'] += 1
|
|
39
|
+
|
|
40
|
+
def assert_not_none(value, message="Value is None"):
|
|
41
|
+
"""Assert that value is not None."""
|
|
42
|
+
if value == None:
|
|
43
|
+
test_results['failed'] += 1
|
|
44
|
+
test_results['errors'].append("FAIL: " + message)
|
|
45
|
+
else:
|
|
46
|
+
test_results['passed'] += 1
|
|
47
|
+
|
|
48
|
+
# =============================================================================
|
|
49
|
+
# TEST SUITE: Integration Functions
|
|
50
|
+
# =============================================================================
|
|
51
|
+
|
|
52
|
+
def _test_integration_functions():
|
|
53
|
+
"""Test integration functions are accessible."""
|
|
54
|
+
print("š Testing integration functions...")
|
|
55
|
+
|
|
56
|
+
# Test via facade
|
|
57
|
+
assert_not_none(Manifest.load_and_validate_integration, "load_and_validate_integration should be accessible")
|
|
58
|
+
assert_not_none(Manifest.load_all_integration, "load_all_integration should be accessible")
|
|
59
|
+
assert_not_none(Manifest.convert_to_resource, "convert_to_resource should be accessible")
|
|
60
|
+
assert_not_none(Manifest.get_validation_summary, "get_validation_summary should be accessible")
|
|
61
|
+
assert_not_none(Manifest.check_port_conflicts, "check_port_conflicts should be accessible")
|
|
62
|
+
assert_not_none(Manifest.check_dependencies_valid, "check_dependencies_valid should be accessible")
|
|
63
|
+
|
|
64
|
+
# Test via integration module
|
|
65
|
+
assert_not_none(ManifestIntegration.load_and_validate, "ManifestIntegration.load_and_validate should exist")
|
|
66
|
+
assert_not_none(ManifestIntegration.load_all, "ManifestIntegration.load_all should exist")
|
|
67
|
+
|
|
68
|
+
print("ā
Integration functions accessible\n")
|
|
69
|
+
|
|
70
|
+
# =============================================================================
|
|
71
|
+
# TEST SUITE: Convert to Resource
|
|
72
|
+
# =============================================================================
|
|
73
|
+
|
|
74
|
+
def _test_convert_to_resource():
|
|
75
|
+
"""Test manifest to resource conversion."""
|
|
76
|
+
print("š Testing convert_to_resource...")
|
|
77
|
+
|
|
78
|
+
# Test backend conversion
|
|
79
|
+
backend_manifest = {
|
|
80
|
+
'appName': 'user-management-backend',
|
|
81
|
+
'appType': 'backend',
|
|
82
|
+
'stack': 'user',
|
|
83
|
+
'port': 4000,
|
|
84
|
+
'syncs': ['src', 'prisma'],
|
|
85
|
+
'_resource_path': 'services/product/user/user-management-backend',
|
|
86
|
+
'_manifest': {'runtime': 'bun'},
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
resource = Manifest.convert_to_resource(backend_manifest)
|
|
90
|
+
|
|
91
|
+
assert_equal('user-management-backend', resource['name'], "Should preserve name")
|
|
92
|
+
assert_equal(4000, resource['port'], "Should preserve port")
|
|
93
|
+
assert_equal('user', resource['stack'], "Should preserve stack")
|
|
94
|
+
assert_true('frontend' not in resource or not resource['frontend'], "Should not mark as frontend")
|
|
95
|
+
assert_equal('services/product/user/user-management-backend', resource['_resource_path'], "Should preserve service path")
|
|
96
|
+
|
|
97
|
+
# Test frontend conversion
|
|
98
|
+
frontend_manifest = {
|
|
99
|
+
'appName': 'user-management-frontend',
|
|
100
|
+
'appType': 'frontend',
|
|
101
|
+
'stack': 'user',
|
|
102
|
+
'port': 3000,
|
|
103
|
+
'backendName': 'user-management-backend',
|
|
104
|
+
'_resource_path': 'services/product/user/user-management-frontend',
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
resource = Manifest.convert_to_resource(frontend_manifest)
|
|
108
|
+
|
|
109
|
+
assert_equal('user-management-frontend', resource['name'], "Should preserve name")
|
|
110
|
+
assert_true(resource.get('frontend', False), "Should mark as frontend")
|
|
111
|
+
assert_equal('user-management-backend', resource['backendName'], "Should preserve backendName")
|
|
112
|
+
|
|
113
|
+
print("ā
Convert to resource tests complete\n")
|
|
114
|
+
|
|
115
|
+
# =============================================================================
|
|
116
|
+
# TEST SUITE: Validation Summary
|
|
117
|
+
# =============================================================================
|
|
118
|
+
|
|
119
|
+
def _test_validation_summary():
|
|
120
|
+
"""Test validation summary generation."""
|
|
121
|
+
print("š Testing validation summary...")
|
|
122
|
+
|
|
123
|
+
manifests = [
|
|
124
|
+
{
|
|
125
|
+
'appName': 'valid-service',
|
|
126
|
+
'appType': 'backend',
|
|
127
|
+
'stack': 'user',
|
|
128
|
+
'port': 4000,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
'appName': 'valid-frontend',
|
|
132
|
+
'appType': 'frontend',
|
|
133
|
+
'stack': 'user',
|
|
134
|
+
'port': 3000,
|
|
135
|
+
'backendName': 'valid-service',
|
|
136
|
+
},
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
summary = Manifest.get_validation_summary(manifests)
|
|
140
|
+
|
|
141
|
+
assert_equal(2, summary['total'], "Should count total manifests")
|
|
142
|
+
assert_true('valid' in summary, "Should have valid count")
|
|
143
|
+
assert_true('invalid' in summary, "Should have invalid count")
|
|
144
|
+
assert_true('by_severity' in summary, "Should have severity breakdown")
|
|
145
|
+
|
|
146
|
+
print("ā
Validation summary tests complete\n")
|
|
147
|
+
|
|
148
|
+
# =============================================================================
|
|
149
|
+
# TEST SUITE: Port Conflicts
|
|
150
|
+
# =============================================================================
|
|
151
|
+
|
|
152
|
+
def _test_port_conflicts():
|
|
153
|
+
"""Test port conflict detection."""
|
|
154
|
+
print("š Testing port conflict detection...")
|
|
155
|
+
|
|
156
|
+
# No conflicts
|
|
157
|
+
no_conflict = [
|
|
158
|
+
{'appName': 'service-1', 'port': 4000},
|
|
159
|
+
{'appName': 'service-2', 'port': 4001},
|
|
160
|
+
{'appName': 'service-3', 'port': 4002},
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
conflicts = Manifest.check_port_conflicts(no_conflict)
|
|
164
|
+
assert_equal(0, len(conflicts), "Should find no conflicts for unique ports")
|
|
165
|
+
|
|
166
|
+
# With conflicts
|
|
167
|
+
with_conflict = [
|
|
168
|
+
{'appName': 'service-1', 'port': 4000},
|
|
169
|
+
{'appName': 'service-2', 'port': 4000}, # Conflict!
|
|
170
|
+
{'appName': 'service-3', 'port': 4001},
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
conflicts = Manifest.check_port_conflicts(with_conflict)
|
|
174
|
+
assert_true(len(conflicts) > 0, "Should find port conflicts")
|
|
175
|
+
|
|
176
|
+
print("ā
Port conflict tests complete\n")
|
|
177
|
+
|
|
178
|
+
# =============================================================================
|
|
179
|
+
# TEST SUITE: Dependency Validation
|
|
180
|
+
# =============================================================================
|
|
181
|
+
|
|
182
|
+
def _test_dependency_validation():
|
|
183
|
+
"""Test dependency validation across services."""
|
|
184
|
+
print("š Testing dependency validation...")
|
|
185
|
+
|
|
186
|
+
manifests = [
|
|
187
|
+
{
|
|
188
|
+
'appName': 'identity-backend',
|
|
189
|
+
'appType': 'backend',
|
|
190
|
+
'stack': 'identity',
|
|
191
|
+
'port': 4004,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
'appName': 'user-backend',
|
|
195
|
+
'appType': 'backend',
|
|
196
|
+
'stack': 'user',
|
|
197
|
+
'port': 4000,
|
|
198
|
+
'dependsOn': ['identity-backend'], # Valid
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
'appName': 'user-frontend',
|
|
202
|
+
'appType': 'frontend',
|
|
203
|
+
'stack': 'user',
|
|
204
|
+
'port': 3000,
|
|
205
|
+
'backendName': 'user-backend', # Valid
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
'appName': 'bad-service',
|
|
209
|
+
'appType': 'backend',
|
|
210
|
+
'stack': 'user',
|
|
211
|
+
'port': 4001,
|
|
212
|
+
'dependsOn': ['nonexistent-service'], # Invalid
|
|
213
|
+
},
|
|
214
|
+
]
|
|
215
|
+
|
|
216
|
+
errors = Manifest.check_dependencies_valid(manifests)
|
|
217
|
+
|
|
218
|
+
# Should find at least one error for nonexistent dependency
|
|
219
|
+
assert_true(len(errors) > 0, "Should find dependency issues")
|
|
220
|
+
|
|
221
|
+
print("ā
Dependency validation tests complete\n")
|
|
222
|
+
|
|
223
|
+
# =============================================================================
|
|
224
|
+
# TEST SUITE: Feature Flag
|
|
225
|
+
# =============================================================================
|
|
226
|
+
|
|
227
|
+
def _test_feature_flag():
|
|
228
|
+
"""Test the feature flag system."""
|
|
229
|
+
print("š Testing feature flag...")
|
|
230
|
+
|
|
231
|
+
# Check if flag is accessible
|
|
232
|
+
use_new = ManifestIntegration.use_new_system()
|
|
233
|
+
assert_true(use_new != None, "Feature flag should return boolean")
|
|
234
|
+
|
|
235
|
+
print("ā
Feature flag tests complete\n")
|
|
236
|
+
|
|
237
|
+
# =============================================================================
|
|
238
|
+
# MAIN
|
|
239
|
+
# =============================================================================
|
|
240
|
+
|
|
241
|
+
def run_tests():
|
|
242
|
+
"""Run all Phase 4 integration tests."""
|
|
243
|
+
print("\n" + "="*70)
|
|
244
|
+
print("š MANIFEST MODULE - PHASE 4 INTEGRATION TESTS")
|
|
245
|
+
print("="*70 + "\n")
|
|
246
|
+
|
|
247
|
+
# Run all test suites
|
|
248
|
+
_test_integration_functions()
|
|
249
|
+
_test_convert_to_resource()
|
|
250
|
+
_test_validation_summary()
|
|
251
|
+
_test_port_conflicts()
|
|
252
|
+
_test_dependency_validation()
|
|
253
|
+
_test_feature_flag()
|
|
254
|
+
|
|
255
|
+
# Print results
|
|
256
|
+
print("\n" + "="*70)
|
|
257
|
+
print("š TEST RESULTS")
|
|
258
|
+
print("="*70)
|
|
259
|
+
print("ā
Passed: {}".format(test_results['passed']))
|
|
260
|
+
print("ā Failed: {}".format(test_results['failed']))
|
|
261
|
+
|
|
262
|
+
if test_results['errors']:
|
|
263
|
+
print("\nš ERRORS:")
|
|
264
|
+
for error in test_results['errors']:
|
|
265
|
+
print(" " + error)
|
|
266
|
+
else:
|
|
267
|
+
print("\nš All Phase 4 integration tests passed!")
|
|
268
|
+
|
|
269
|
+
print("="*70 + "\n")
|
|
270
|
+
|
|
271
|
+
return test_results['failed'] == 0
|
|
272
|
+
|
|
273
|
+
# Export test runner
|
|
274
|
+
TestIntegration = struct(
|
|
275
|
+
run=run_tests,
|
|
276
|
+
)
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# š MANIFEST MODULE - INTEGRATION TESTS (Phase 2)
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Path: .tilt/topologies/tilt/manifest/tests/test_loader_parser.star
|
|
5
|
+
# Purpose: Integration tests for loader and parser modules
|
|
6
|
+
# Status: Phase 2 of manifest system refactoring
|
|
7
|
+
# =============================================================================
|
|
8
|
+
|
|
9
|
+
load("../__init__.star", "Manifest")
|
|
10
|
+
load("../loader.star", "ManifestLoader")
|
|
11
|
+
load("../parser.star", "ManifestParser")
|
|
12
|
+
|
|
13
|
+
# =============================================================================
|
|
14
|
+
# TEST FRAMEWORK
|
|
15
|
+
# =============================================================================
|
|
16
|
+
|
|
17
|
+
test_results = {
|
|
18
|
+
'passed': 0,
|
|
19
|
+
'failed': 0,
|
|
20
|
+
'errors': [],
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def assert_true(condition, message="Assertion failed"):
|
|
24
|
+
"""Assert that condition is true."""
|
|
25
|
+
if not condition:
|
|
26
|
+
test_results['failed'] += 1
|
|
27
|
+
test_results['errors'].append("FAIL: " + message)
|
|
28
|
+
else:
|
|
29
|
+
test_results['passed'] += 1
|
|
30
|
+
|
|
31
|
+
def assert_equal(expected, actual, message="Values not equal"):
|
|
32
|
+
"""Assert that expected equals actual."""
|
|
33
|
+
if expected != actual:
|
|
34
|
+
test_results['failed'] += 1
|
|
35
|
+
test_results['errors'].append(
|
|
36
|
+
"FAIL: {} - expected '{}', got '{}'".format(message, expected, actual)
|
|
37
|
+
)
|
|
38
|
+
else:
|
|
39
|
+
test_results['passed'] += 1
|
|
40
|
+
|
|
41
|
+
def assert_not_none(value, message="Value is None"):
|
|
42
|
+
"""Assert that value is not None."""
|
|
43
|
+
if value == None:
|
|
44
|
+
test_results['failed'] += 1
|
|
45
|
+
test_results['errors'].append("FAIL: " + message)
|
|
46
|
+
else:
|
|
47
|
+
test_results['passed'] += 1
|
|
48
|
+
|
|
49
|
+
def assert_in(value, collection, message="Value not in collection"):
|
|
50
|
+
"""Assert that value is in collection."""
|
|
51
|
+
found = False
|
|
52
|
+
for item in collection:
|
|
53
|
+
if item == value:
|
|
54
|
+
found = True
|
|
55
|
+
break
|
|
56
|
+
|
|
57
|
+
if not found:
|
|
58
|
+
test_results['failed'] += 1
|
|
59
|
+
test_results['errors'].append(
|
|
60
|
+
"FAIL: {} - '{}' not in collection".format(message, value)
|
|
61
|
+
)
|
|
62
|
+
else:
|
|
63
|
+
test_results['passed'] += 1
|
|
64
|
+
|
|
65
|
+
# =============================================================================
|
|
66
|
+
# TEST SUITE: Loader Module
|
|
67
|
+
# =============================================================================
|
|
68
|
+
|
|
69
|
+
def _test_loader_functions():
|
|
70
|
+
"""Test loader functions."""
|
|
71
|
+
print("š Testing loader module...")
|
|
72
|
+
|
|
73
|
+
# Test that loader functions are accessible via facade
|
|
74
|
+
assert_not_none(Manifest.load_from_file, "load_from_file should be accessible")
|
|
75
|
+
assert_not_none(Manifest.load_from_path, "load_from_path should be accessible")
|
|
76
|
+
assert_not_none(Manifest.load_all, "load_all should be accessible")
|
|
77
|
+
assert_not_none(Manifest.clear_cache, "clear_cache should be accessible")
|
|
78
|
+
assert_not_none(Manifest.get_cache_stats, "get_cache_stats should be accessible")
|
|
79
|
+
assert_not_none(Manifest.is_cached, "is_cached should be accessible")
|
|
80
|
+
assert_not_none(Manifest.get_manifest_path, "get_manifest_path should be accessible")
|
|
81
|
+
|
|
82
|
+
# Test get_manifest_path
|
|
83
|
+
path = Manifest.get_manifest_path("services/product/user/user-management-backend")
|
|
84
|
+
assert_true(
|
|
85
|
+
path.endswith("service.json"),
|
|
86
|
+
"get_manifest_path should include manifest filename"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Test cache functions
|
|
90
|
+
Manifest.clear_cache()
|
|
91
|
+
stats = Manifest.get_cache_stats()
|
|
92
|
+
assert_equal(0, stats['entries'], "Cache should be empty after clear")
|
|
93
|
+
|
|
94
|
+
print("ā
Loader module tests complete\n")
|
|
95
|
+
|
|
96
|
+
# =============================================================================
|
|
97
|
+
# TEST SUITE: Parser Module
|
|
98
|
+
# =============================================================================
|
|
99
|
+
|
|
100
|
+
def _test_parser_functions():
|
|
101
|
+
"""Test parser functions."""
|
|
102
|
+
print("š Testing parser module...")
|
|
103
|
+
|
|
104
|
+
# Test that parser functions are accessible via facade
|
|
105
|
+
assert_not_none(Manifest.parse, "parse should be accessible")
|
|
106
|
+
assert_not_none(Manifest.normalize, "normalize should be accessible")
|
|
107
|
+
assert_not_none(Manifest.get_normalized, "get_normalized should be accessible")
|
|
108
|
+
assert_not_none(Manifest.extract_resource_path, "extract_resource_path should be accessible")
|
|
109
|
+
assert_not_none(Manifest.extract_stack, "extract_stack should be accessible")
|
|
110
|
+
assert_not_none(Manifest.parse_traefik, "parse_traefik should be accessible")
|
|
111
|
+
assert_not_none(Manifest.merge_manifests, "merge_manifests should be accessible")
|
|
112
|
+
assert_not_none(Manifest.get_description, "get_description should be accessible")
|
|
113
|
+
|
|
114
|
+
print("ā
Parser module tests complete\n")
|
|
115
|
+
|
|
116
|
+
# =============================================================================
|
|
117
|
+
# TEST SUITE: Parse and Normalize
|
|
118
|
+
# =============================================================================
|
|
119
|
+
|
|
120
|
+
def _test_parse_and_normalize():
|
|
121
|
+
"""Test parsing and normalization together."""
|
|
122
|
+
print("š Testing parse and normalize integration...")
|
|
123
|
+
|
|
124
|
+
# Test valid JSON parsing
|
|
125
|
+
valid_json = '''
|
|
126
|
+
{
|
|
127
|
+
"appName": "test-service",
|
|
128
|
+
"appType": "backend",
|
|
129
|
+
"stack": "user",
|
|
130
|
+
"port": 4001
|
|
131
|
+
}
|
|
132
|
+
'''
|
|
133
|
+
|
|
134
|
+
result = Manifest.parse(valid_json)
|
|
135
|
+
assert_not_none(result.manifest, "Should parse valid JSON")
|
|
136
|
+
assert_equal(None, result.error, "Should have no error for valid JSON")
|
|
137
|
+
|
|
138
|
+
# Test normalization
|
|
139
|
+
normalized = Manifest.normalize(result.manifest, "services/product/user/test-service")
|
|
140
|
+
assert_not_none(normalized, "Should normalize manifest")
|
|
141
|
+
assert_equal("test-service", normalized['appName'], "Should preserve appName")
|
|
142
|
+
assert_equal("backend", normalized['appType'], "Should preserve appType")
|
|
143
|
+
assert_equal("user", normalized['stack'], "Should preserve stack")
|
|
144
|
+
assert_equal(4001, normalized['port'], "Should preserve port")
|
|
145
|
+
|
|
146
|
+
# Test defaults are applied
|
|
147
|
+
assert_equal(1, normalized['replicas'], "Should apply default replicas")
|
|
148
|
+
assert_equal(3000, normalized['internalPort'], "Should apply default internalPort")
|
|
149
|
+
assert_equal("bun", normalized['runtime'], "Should apply default runtime")
|
|
150
|
+
assert_not_none(normalized['syncs'], "Should compute default syncs")
|
|
151
|
+
assert_not_none(normalized['traefik'], "Should create traefik config")
|
|
152
|
+
|
|
153
|
+
# Test _normalized flag is set
|
|
154
|
+
assert_equal(True, normalized.get('_normalized'), "Should set _normalized flag")
|
|
155
|
+
|
|
156
|
+
print("ā
Parse and normalize tests complete\n")
|
|
157
|
+
|
|
158
|
+
# =============================================================================
|
|
159
|
+
# TEST SUITE: Domain Extraction
|
|
160
|
+
# =============================================================================
|
|
161
|
+
|
|
162
|
+
def _test_stack_extraction():
|
|
163
|
+
"""Test stack extraction from resource paths."""
|
|
164
|
+
print("š Testing stack extraction...")
|
|
165
|
+
|
|
166
|
+
# Standard paths
|
|
167
|
+
stack = Manifest.extract_stack("services/product/user/user-management-backend")
|
|
168
|
+
assert_equal("user", stack, "Should extract user stack")
|
|
169
|
+
|
|
170
|
+
stack = Manifest.extract_stack("services/product/order/order-management-backend")
|
|
171
|
+
assert_equal("order", stack, "Should extract order stack")
|
|
172
|
+
|
|
173
|
+
stack = Manifest.extract_stack("services/product/identity/identity-management-backend")
|
|
174
|
+
assert_equal("identity", stack, "Should extract identity stack")
|
|
175
|
+
|
|
176
|
+
# Special case: order-planner
|
|
177
|
+
stack = Manifest.extract_stack("services/product/order-planner/order-planner-backend")
|
|
178
|
+
assert_equal("order-planner", stack, "Should extract order-planner stack")
|
|
179
|
+
|
|
180
|
+
# Special case: profile -> identity
|
|
181
|
+
stack = Manifest.extract_stack("services/product/profile/profile-management-backend")
|
|
182
|
+
assert_equal("identity", stack, "Should map profile to identity stack")
|
|
183
|
+
|
|
184
|
+
print("ā
Stack extraction tests complete\n")
|
|
185
|
+
|
|
186
|
+
# =============================================================================
|
|
187
|
+
# TEST SUITE: Frontend Manifest Normalization
|
|
188
|
+
# =============================================================================
|
|
189
|
+
|
|
190
|
+
def _test_frontend_normalization():
|
|
191
|
+
"""Test normalization for frontend manifests."""
|
|
192
|
+
print("š Testing frontend normalization...")
|
|
193
|
+
|
|
194
|
+
frontend_json = '''
|
|
195
|
+
{
|
|
196
|
+
"appName": "user-management-frontend",
|
|
197
|
+
"appType": "frontend",
|
|
198
|
+
"stack": "user",
|
|
199
|
+
"port": 3000,
|
|
200
|
+
"backendName": "user-management-backend"
|
|
201
|
+
}
|
|
202
|
+
'''
|
|
203
|
+
|
|
204
|
+
result = Manifest.parse(frontend_json)
|
|
205
|
+
normalized = Manifest.normalize(result.manifest, "services/product/user/user-management-frontend")
|
|
206
|
+
|
|
207
|
+
assert_equal("frontend", normalized['appType'], "Should preserve frontend appType")
|
|
208
|
+
assert_equal("user-management-backend", normalized['backendName'], "Should preserve backendName")
|
|
209
|
+
|
|
210
|
+
# Test backendName auto-computation
|
|
211
|
+
frontend_json_no_backend = '''
|
|
212
|
+
{
|
|
213
|
+
"appName": "test-frontend",
|
|
214
|
+
"appType": "frontend",
|
|
215
|
+
"stack": "user",
|
|
216
|
+
"port": 3001
|
|
217
|
+
}
|
|
218
|
+
'''
|
|
219
|
+
|
|
220
|
+
result2 = Manifest.parse(frontend_json_no_backend)
|
|
221
|
+
normalized2 = Manifest.normalize(result2.manifest, "services/product/user/test-frontend")
|
|
222
|
+
assert_equal("test-backend", normalized2['backendName'], "Should auto-compute backendName")
|
|
223
|
+
|
|
224
|
+
print("ā
Frontend normalization tests complete\n")
|
|
225
|
+
|
|
226
|
+
# =============================================================================
|
|
227
|
+
# TEST SUITE: Traefik Configuration
|
|
228
|
+
# =============================================================================
|
|
229
|
+
|
|
230
|
+
def _test_traefik_config():
|
|
231
|
+
"""Test Traefik configuration parsing."""
|
|
232
|
+
print("š Testing Traefik configuration...")
|
|
233
|
+
|
|
234
|
+
# Backend with explicit traefik config
|
|
235
|
+
backend_json = '''
|
|
236
|
+
{
|
|
237
|
+
"appName": "user-management-backend",
|
|
238
|
+
"appType": "backend",
|
|
239
|
+
"stack": "user",
|
|
240
|
+
"port": 4000,
|
|
241
|
+
"traefik": {
|
|
242
|
+
"pathPrefix": "/api/v1/users",
|
|
243
|
+
"priority": 200
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
'''
|
|
247
|
+
|
|
248
|
+
result = Manifest.parse(backend_json)
|
|
249
|
+
normalized = Manifest.normalize(result.manifest, "services/product/user/user-management-backend")
|
|
250
|
+
|
|
251
|
+
assert_equal("/api/v1/users", normalized['traefik']['pathPrefix'], "Should preserve pathPrefix")
|
|
252
|
+
assert_equal(200, normalized['traefik']['priority'], "Should preserve priority")
|
|
253
|
+
|
|
254
|
+
# Test auto-generated pathPrefix
|
|
255
|
+
backend_json_no_traefik = '''
|
|
256
|
+
{
|
|
257
|
+
"appName": "test-management-backend",
|
|
258
|
+
"appType": "backend",
|
|
259
|
+
"stack": "user",
|
|
260
|
+
"port": 4001
|
|
261
|
+
}
|
|
262
|
+
'''
|
|
263
|
+
|
|
264
|
+
result2 = Manifest.parse(backend_json_no_traefik)
|
|
265
|
+
normalized2 = Manifest.normalize(result2.manifest, "services/product/user/test-management-backend")
|
|
266
|
+
|
|
267
|
+
assert_not_none(normalized2['traefik']['pathPrefix'], "Should auto-generate pathPrefix")
|
|
268
|
+
assert_not_none(normalized2['traefik']['priority'], "Should set default priority")
|
|
269
|
+
|
|
270
|
+
print("ā
Traefik configuration tests complete\n")
|
|
271
|
+
|
|
272
|
+
# =============================================================================
|
|
273
|
+
# TEST SUITE: Manifest Merging
|
|
274
|
+
# =============================================================================
|
|
275
|
+
|
|
276
|
+
def _test_manifest_merging():
|
|
277
|
+
"""Test manifest merging functionality."""
|
|
278
|
+
print("š Testing manifest merging...")
|
|
279
|
+
|
|
280
|
+
base = {
|
|
281
|
+
'appName': 'test-service',
|
|
282
|
+
'appType': 'backend',
|
|
283
|
+
'port': 4000,
|
|
284
|
+
'features': ['nats'],
|
|
285
|
+
'envVars': {
|
|
286
|
+
'SHARED_VAR': 'base_value',
|
|
287
|
+
},
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
overlay = {
|
|
291
|
+
'port': 4001, # Override
|
|
292
|
+
'features': ['prisma'], # Override
|
|
293
|
+
'envVars': {
|
|
294
|
+
'SHARED_VAR': 'overlay_value', # Override
|
|
295
|
+
'NEW_VAR': 'new_value', # Add
|
|
296
|
+
},
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
merged = Manifest.merge_manifests(base, overlay)
|
|
300
|
+
|
|
301
|
+
assert_equal('test-service', merged['appName'], "Should preserve base appName")
|
|
302
|
+
assert_equal(4001, merged['port'], "Should overlay port")
|
|
303
|
+
assert_equal(['prisma'], merged['features'], "Should overlay features")
|
|
304
|
+
assert_equal('overlay_value', merged['envVars']['SHARED_VAR'], "Should overlay nested env var")
|
|
305
|
+
assert_equal('new_value', merged['envVars']['NEW_VAR'], "Should add new env var")
|
|
306
|
+
|
|
307
|
+
print("ā
Manifest merging tests complete\n")
|
|
308
|
+
|
|
309
|
+
# =============================================================================
|
|
310
|
+
# TEST SUITE: Get Normalized Convenience Function
|
|
311
|
+
# =============================================================================
|
|
312
|
+
|
|
313
|
+
def _test_get_normalized():
|
|
314
|
+
"""Test the get_normalized convenience function."""
|
|
315
|
+
print("š Testing get_normalized...")
|
|
316
|
+
|
|
317
|
+
json_content = '''
|
|
318
|
+
{
|
|
319
|
+
"appName": "test-service",
|
|
320
|
+
"appType": "backend",
|
|
321
|
+
"stack": "user",
|
|
322
|
+
"port": 4001
|
|
323
|
+
}
|
|
324
|
+
'''
|
|
325
|
+
|
|
326
|
+
result = Manifest.get_normalized(json_content, "services/product/user/test-service")
|
|
327
|
+
|
|
328
|
+
assert_not_none(result.manifest, "Should return normalized manifest")
|
|
329
|
+
assert_equal(None, result.error, "Should have no error")
|
|
330
|
+
assert_equal("test-service", result.manifest['appName'], "Should have correct appName")
|
|
331
|
+
assert_equal("backend", result.manifest['appType'], "Should have correct appType")
|
|
332
|
+
assert_equal(True, result.manifest.get('_normalized'), "Should be marked as normalized")
|
|
333
|
+
|
|
334
|
+
print("ā
Get normalized tests complete\n")
|
|
335
|
+
|
|
336
|
+
# =============================================================================
|
|
337
|
+
# TEST SUITE: Service Description
|
|
338
|
+
# =============================================================================
|
|
339
|
+
|
|
340
|
+
def _test_resource_description():
|
|
341
|
+
"""Test service description generation."""
|
|
342
|
+
print("š Testing service description...")
|
|
343
|
+
|
|
344
|
+
manifest = {
|
|
345
|
+
'appName': 'user-management-backend',
|
|
346
|
+
'appType': 'backend',
|
|
347
|
+
'stack': 'user',
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
desc = Manifest.get_description(manifest)
|
|
351
|
+
assert_equal("user/backend/user-management-backend", desc, "Should generate correct description")
|
|
352
|
+
|
|
353
|
+
print("ā
Service description tests complete\n")
|
|
354
|
+
|
|
355
|
+
# =============================================================================
|
|
356
|
+
# MAIN
|
|
357
|
+
# =============================================================================
|
|
358
|
+
|
|
359
|
+
def run_tests():
|
|
360
|
+
"""Run all Phase 2 integration tests."""
|
|
361
|
+
print("\n" + "="*70)
|
|
362
|
+
print("š MANIFEST MODULE - PHASE 2 INTEGRATION TESTS")
|
|
363
|
+
print("="*70 + "\n")
|
|
364
|
+
|
|
365
|
+
# Run all test suites
|
|
366
|
+
_test_loader_functions()
|
|
367
|
+
_test_parser_functions()
|
|
368
|
+
_test_parse_and_normalize()
|
|
369
|
+
_test_domain_extraction()
|
|
370
|
+
_test_frontend_normalization()
|
|
371
|
+
_test_traefik_config()
|
|
372
|
+
_test_manifest_merging()
|
|
373
|
+
_test_get_normalized()
|
|
374
|
+
_test_resource_description()
|
|
375
|
+
|
|
376
|
+
# Print results
|
|
377
|
+
print("\n" + "="*70)
|
|
378
|
+
print("š TEST RESULTS")
|
|
379
|
+
print("="*70)
|
|
380
|
+
print("ā
Passed: {}".format(test_results['passed']))
|
|
381
|
+
print("ā Failed: {}".format(test_results['failed']))
|
|
382
|
+
|
|
383
|
+
if test_results['errors']:
|
|
384
|
+
print("\nš ERRORS:")
|
|
385
|
+
for error in test_results['errors']:
|
|
386
|
+
print(" " + error)
|
|
387
|
+
else:
|
|
388
|
+
print("\nš All Phase 2 integration tests passed!")
|
|
389
|
+
|
|
390
|
+
print("="*70 + "\n")
|
|
391
|
+
|
|
392
|
+
return test_results['failed'] == 0
|
|
393
|
+
|
|
394
|
+
# Export test runner
|
|
395
|
+
TestLoaderParser = struct(
|
|
396
|
+
run=run_tests,
|
|
397
|
+
)
|