@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,316 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 📋 MANIFEST MODULE - UNIT TESTS
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Path: .tilt/topologies/tilt/manifest/tests/test_manifest.star
|
|
5
|
+
# Purpose: Unit tests for manifest system
|
|
6
|
+
# Status: Phase 1 of manifest system refactoring
|
|
7
|
+
#
|
|
8
|
+
# Run with: tilt test (when implemented) or manually load and run
|
|
9
|
+
# =============================================================================
|
|
10
|
+
|
|
11
|
+
# Import modules under test
|
|
12
|
+
load("../__init__.star", "Manifest")
|
|
13
|
+
load("../constants.star", "ManifestConstants")
|
|
14
|
+
load("../errors.star", "ManifestErrors")
|
|
15
|
+
load("../schema.star", "ManifestSchema")
|
|
16
|
+
|
|
17
|
+
# =============================================================================
|
|
18
|
+
# TEST FRAMEWORK (Simple implementation for Starlark)
|
|
19
|
+
# =============================================================================
|
|
20
|
+
|
|
21
|
+
test_results = {
|
|
22
|
+
'passed': 0,
|
|
23
|
+
'failed': 0,
|
|
24
|
+
'errors': [],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def assert_true(condition, message="Assertion failed"):
|
|
28
|
+
"""Assert that condition is true."""
|
|
29
|
+
if not condition:
|
|
30
|
+
test_results['failed'] += 1
|
|
31
|
+
test_results['errors'].append("FAIL: " + message)
|
|
32
|
+
else:
|
|
33
|
+
test_results['passed'] += 1
|
|
34
|
+
|
|
35
|
+
def assert_equal(expected, actual, message="Values not equal"):
|
|
36
|
+
"""Assert that expected equals actual."""
|
|
37
|
+
if expected != actual:
|
|
38
|
+
test_results['failed'] += 1
|
|
39
|
+
test_results['errors'].append(
|
|
40
|
+
"FAIL: {} - expected '{}', got '{}'".format(message, expected, actual)
|
|
41
|
+
)
|
|
42
|
+
else:
|
|
43
|
+
test_results['passed'] += 1
|
|
44
|
+
|
|
45
|
+
def assert_not_none(value, message="Value is None"):
|
|
46
|
+
"""Assert that value is not None."""
|
|
47
|
+
if value == None:
|
|
48
|
+
test_results['failed'] += 1
|
|
49
|
+
test_results['errors'].append("FAIL: " + message)
|
|
50
|
+
else:
|
|
51
|
+
test_results['passed'] += 1
|
|
52
|
+
|
|
53
|
+
def assert_in(value, collection, message="Value not in collection"):
|
|
54
|
+
"""Assert that value is in collection."""
|
|
55
|
+
if value not in collection:
|
|
56
|
+
test_results['failed'] += 1
|
|
57
|
+
test_results['errors'].append("FAIL: {} - '{}' not in {}".format(message, value, collection))
|
|
58
|
+
else:
|
|
59
|
+
test_results['passed'] += 1
|
|
60
|
+
|
|
61
|
+
def run_tests():
|
|
62
|
+
"""Run all tests and print results."""
|
|
63
|
+
print("\n" + "="*70)
|
|
64
|
+
print("📋 MANIFEST MODULE - UNIT TESTS")
|
|
65
|
+
print("="*70 + "\n")
|
|
66
|
+
|
|
67
|
+
# Run test suites
|
|
68
|
+
_test_constants()
|
|
69
|
+
_test_schema()
|
|
70
|
+
_test_errors()
|
|
71
|
+
_test_facade()
|
|
72
|
+
_test_backward_compatibility()
|
|
73
|
+
|
|
74
|
+
# Print results
|
|
75
|
+
print("\n" + "="*70)
|
|
76
|
+
print("📊 TEST RESULTS")
|
|
77
|
+
print("="*70)
|
|
78
|
+
print("✅ Passed: {}".format(test_results['passed']))
|
|
79
|
+
print("❌ Failed: {}".format(test_results['failed']))
|
|
80
|
+
|
|
81
|
+
if test_results['errors']:
|
|
82
|
+
print("\n📝 ERRORS:")
|
|
83
|
+
for error in test_results['errors']:
|
|
84
|
+
print(" " + error)
|
|
85
|
+
else:
|
|
86
|
+
print("\n🎉 All tests passed!")
|
|
87
|
+
|
|
88
|
+
print("="*70 + "\n")
|
|
89
|
+
|
|
90
|
+
return test_results['failed'] == 0
|
|
91
|
+
|
|
92
|
+
# =============================================================================
|
|
93
|
+
# TEST SUITE: Constants Module
|
|
94
|
+
# =============================================================================
|
|
95
|
+
|
|
96
|
+
def _test_constants():
|
|
97
|
+
"""Test constants module."""
|
|
98
|
+
print("🔍 Testing constants module...")
|
|
99
|
+
|
|
100
|
+
# Test MANIFEST_FILENAME
|
|
101
|
+
assert_equal(
|
|
102
|
+
'service.json',
|
|
103
|
+
ManifestConstants.MANIFEST_FILENAME,
|
|
104
|
+
"MANIFEST_FILENAME should match expected"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Test VALID_APP_TYPES
|
|
108
|
+
assert_in('frontend', ManifestConstants.VALID_APP_TYPES, "frontend should be valid app type")
|
|
109
|
+
assert_in('backend', ManifestConstants.VALID_APP_TYPES, "backend should be valid app type")
|
|
110
|
+
|
|
111
|
+
# Test VALID_STACKS (stacks discovered dynamically from filesystem)
|
|
112
|
+
assert_true(type(ManifestConstants.VALID_STACKS) == "list", "VALID_STACKS should be a list")
|
|
113
|
+
|
|
114
|
+
# Test VALID_FEATURES
|
|
115
|
+
assert_in('nats', ManifestConstants.VALID_FEATURES, "nats should be valid feature")
|
|
116
|
+
assert_in('prisma', ManifestConstants.VALID_FEATURES, "prisma should be valid feature")
|
|
117
|
+
assert_in('api-client', ManifestConstants.VALID_FEATURES, "api-client should be valid feature")
|
|
118
|
+
assert_in('env-config', ManifestConstants.VALID_FEATURES, "env-config should be valid feature")
|
|
119
|
+
assert_in('api-index', ManifestConstants.VALID_FEATURES, "api-index should be valid feature")
|
|
120
|
+
|
|
121
|
+
# Test MANIFEST_DEFAULTS
|
|
122
|
+
assert_equal(4000, ManifestConstants.MANIFEST_DEFAULTS['port'], "Default port should be 4000")
|
|
123
|
+
assert_equal('backend', ManifestConstants.MANIFEST_DEFAULTS['appType'], "Default appType should be backend")
|
|
124
|
+
assert_equal(1, ManifestConstants.MANIFEST_DEFAULTS['replicas'], "Default replicas should be 1")
|
|
125
|
+
|
|
126
|
+
# Test PORT_RANGES
|
|
127
|
+
assert_not_none(ManifestConstants.PORT_RANGES['frontend'], "frontend should have port range")
|
|
128
|
+
assert_not_none(ManifestConstants.PORT_RANGES['backend'], "backend should have port range")
|
|
129
|
+
|
|
130
|
+
print("✅ Constants module tests complete\n")
|
|
131
|
+
|
|
132
|
+
# =============================================================================
|
|
133
|
+
# TEST SUITE: Schema Module
|
|
134
|
+
# =============================================================================
|
|
135
|
+
|
|
136
|
+
def _test_schema():
|
|
137
|
+
"""Test schema module."""
|
|
138
|
+
print("🔍 Testing schema module...")
|
|
139
|
+
|
|
140
|
+
# Test get_field
|
|
141
|
+
app_name_schema = ManifestSchema.get_field('appName')
|
|
142
|
+
assert_not_none(app_name_schema, "appName schema should exist")
|
|
143
|
+
assert_equal('string', app_name_schema['type'], "appName should be string type")
|
|
144
|
+
assert_true(app_name_schema['required'], "appName should be required")
|
|
145
|
+
|
|
146
|
+
# Test get_required_fields
|
|
147
|
+
required_fields = ManifestSchema.get_required_fields()
|
|
148
|
+
assert_in('appName', required_fields, "appName should be required")
|
|
149
|
+
assert_in('appType', required_fields, "appType should be required")
|
|
150
|
+
assert_in('stack', required_fields, "stack should be required")
|
|
151
|
+
|
|
152
|
+
# Test get_default
|
|
153
|
+
default_port = ManifestSchema.get_default('port')
|
|
154
|
+
assert_equal(4000, default_port, "Default port should be 4000")
|
|
155
|
+
|
|
156
|
+
default_replicas = ManifestSchema.get_default('replicas')
|
|
157
|
+
assert_equal(1, default_replicas, "Default replicas should be 1")
|
|
158
|
+
|
|
159
|
+
# Test get_valid_values
|
|
160
|
+
valid_app_types = ManifestSchema.get_valid_values('appType')
|
|
161
|
+
assert_not_none(valid_app_types, "appType should have valid values")
|
|
162
|
+
assert_in('frontend', valid_app_types, "frontend should be valid app type")
|
|
163
|
+
assert_in('backend', valid_app_types, "backend should be valid app type")
|
|
164
|
+
|
|
165
|
+
# Test is_required
|
|
166
|
+
assert_true(ManifestSchema.is_required('appName'), "appName should be required")
|
|
167
|
+
assert_true(ManifestSchema.is_required('appType'), "appType should be required")
|
|
168
|
+
|
|
169
|
+
# Test is_deprecated
|
|
170
|
+
# The 'dependencies' field is deprecated (replaced by 'dependsOn')
|
|
171
|
+
is_dep = ManifestSchema.is_deprecated('dependencies')
|
|
172
|
+
assert_true(is_dep, "dependencies field should be marked as deprecated")
|
|
173
|
+
|
|
174
|
+
# Test get_all_fields
|
|
175
|
+
all_fields = ManifestSchema.get_all_fields()
|
|
176
|
+
assert_true(len(all_fields) > 0, "Should have field definitions")
|
|
177
|
+
assert_in('appName', all_fields, "appName should be in all fields")
|
|
178
|
+
assert_in('port', all_fields, "port should be in all fields")
|
|
179
|
+
|
|
180
|
+
print("✅ Schema module tests complete\n")
|
|
181
|
+
|
|
182
|
+
# =============================================================================
|
|
183
|
+
# TEST SUITE: Errors Module
|
|
184
|
+
# =============================================================================
|
|
185
|
+
|
|
186
|
+
def _test_errors():
|
|
187
|
+
"""Test errors module."""
|
|
188
|
+
print("🔍 Testing errors module...")
|
|
189
|
+
|
|
190
|
+
# Test new error creation
|
|
191
|
+
error = ManifestErrors.new(
|
|
192
|
+
message="Test error",
|
|
193
|
+
category=ManifestErrors.CATEGORY['SCHEMA'],
|
|
194
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
195
|
+
context={'field': 'appName', 'path': '/test/manifest.json'},
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
assert_not_none(error, "Error should be created")
|
|
199
|
+
assert_equal("Test error", error.message, "Error message should match")
|
|
200
|
+
assert_equal('schema', error.category, "Error category should be schema")
|
|
201
|
+
assert_equal('error', error.severity, "Error severity should be error")
|
|
202
|
+
|
|
203
|
+
# Test format_error
|
|
204
|
+
formatted = ManifestErrors.format(error)
|
|
205
|
+
assert_not_none(formatted, "Formatted error should not be None")
|
|
206
|
+
assert_true('[ERROR]' in formatted, "Formatted should include severity")
|
|
207
|
+
assert_true('SCHEMA' in formatted, "Formatted should include category")
|
|
208
|
+
|
|
209
|
+
# Test has_critical
|
|
210
|
+
errors_list = [error]
|
|
211
|
+
assert_true(not ManifestErrors.has_critical(errors_list), "Should not have critical errors")
|
|
212
|
+
|
|
213
|
+
# Create a critical error
|
|
214
|
+
critical_error = ManifestErrors.new(
|
|
215
|
+
message="Critical test",
|
|
216
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
217
|
+
severity=ManifestErrors.SEVERITY['CRITICAL'],
|
|
218
|
+
)
|
|
219
|
+
critical_list = [critical_error]
|
|
220
|
+
assert_true(ManifestErrors.has_critical(critical_list), "Should detect critical error")
|
|
221
|
+
|
|
222
|
+
# Test get_summary
|
|
223
|
+
summary = ManifestErrors.get_summary([error, critical_error])
|
|
224
|
+
assert_equal(2, summary['total'], "Summary should show 2 errors")
|
|
225
|
+
assert_equal(1, summary['by_severity']['CRITICAL'], "Should have 1 critical")
|
|
226
|
+
assert_equal(1, summary['by_severity']['ERROR'], "Should have 1 error")
|
|
227
|
+
|
|
228
|
+
print("✅ Errors module tests complete\n")
|
|
229
|
+
|
|
230
|
+
# =============================================================================
|
|
231
|
+
# TEST SUITE: Facade Module
|
|
232
|
+
# =============================================================================
|
|
233
|
+
|
|
234
|
+
def _test_facade():
|
|
235
|
+
"""Test main Manifest facade."""
|
|
236
|
+
print("🔍 Testing Manifest facade...")
|
|
237
|
+
|
|
238
|
+
# Test constants accessible via facade
|
|
239
|
+
assert_equal('service.json', Manifest.filename, "Filename should be accessible")
|
|
240
|
+
assert_not_none(Manifest.defaults, "Defaults should be accessible")
|
|
241
|
+
assert_not_none(Manifest.app_types, "App types should be accessible")
|
|
242
|
+
assert_not_none(Manifest.stacks, "Stacks should be accessible")
|
|
243
|
+
assert_not_none(Manifest.features, "Features should be accessible")
|
|
244
|
+
|
|
245
|
+
# Test schema utilities accessible
|
|
246
|
+
assert_not_none(Manifest.get_field, "get_field should be accessible")
|
|
247
|
+
assert_not_none(Manifest.get_required_fields, "get_required_fields should be accessible")
|
|
248
|
+
assert_not_none(Manifest.get_default, "get_default should be accessible")
|
|
249
|
+
|
|
250
|
+
# Test error utilities accessible
|
|
251
|
+
assert_not_none(Manifest.format_error, "format_error should be accessible")
|
|
252
|
+
assert_not_none(Manifest.group_errors, "group_errors should be accessible")
|
|
253
|
+
assert_not_none(Manifest.has_critical_errors, "has_critical_errors should be accessible")
|
|
254
|
+
|
|
255
|
+
# Test convenience functions
|
|
256
|
+
assert_not_none(Manifest.is_valid_manifest, "is_valid_manifest should exist")
|
|
257
|
+
assert_not_none(Manifest.get_resource_type, "get_resource_type should exist")
|
|
258
|
+
|
|
259
|
+
print("✅ Facade module tests complete\n")
|
|
260
|
+
|
|
261
|
+
# =============================================================================
|
|
262
|
+
# TEST SUITE: Backward Compatibility
|
|
263
|
+
# =============================================================================
|
|
264
|
+
|
|
265
|
+
def _test_backward_compatibility():
|
|
266
|
+
"""Test backward compatibility with old imports."""
|
|
267
|
+
print("🔍 Testing backward compatibility...")
|
|
268
|
+
|
|
269
|
+
# Test that old imports still work
|
|
270
|
+
load("../../manifest/constants.star",
|
|
271
|
+
old_manifest_filename="MANIFEST_FILENAME",
|
|
272
|
+
old_defaults="MANIFEST_DEFAULTS",
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
# Old import should return same values
|
|
276
|
+
assert_equal(
|
|
277
|
+
ManifestConstants.MANIFEST_FILENAME,
|
|
278
|
+
old_manifest_filename,
|
|
279
|
+
"Old import should match new constant"
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
assert_equal(
|
|
283
|
+
ManifestConstants.MANIFEST_DEFAULTS['port'],
|
|
284
|
+
old_defaults['port'],
|
|
285
|
+
"Old defaults should match new defaults"
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
print("✅ Backward compatibility tests complete\n")
|
|
289
|
+
|
|
290
|
+
# =============================================================================
|
|
291
|
+
# MAIN
|
|
292
|
+
# =============================================================================
|
|
293
|
+
|
|
294
|
+
# Run tests when this file is loaded
|
|
295
|
+
# In production, this would be called by a test runner
|
|
296
|
+
# For now, we just define the test suite
|
|
297
|
+
|
|
298
|
+
def main():
|
|
299
|
+
"""Run all tests."""
|
|
300
|
+
return run_tests()
|
|
301
|
+
|
|
302
|
+
# Export test functions for external test runner
|
|
303
|
+
TestManifest = struct(
|
|
304
|
+
run=run_tests,
|
|
305
|
+
test_constants=_test_constants,
|
|
306
|
+
test_schema=_test_schema,
|
|
307
|
+
test_errors=_test_errors,
|
|
308
|
+
test_facade=_test_facade,
|
|
309
|
+
test_backward_compatibility=_test_backward_compatibility,
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
# Inlined constant
|
|
314
|
+
DEFAULTS = {}
|
|
315
|
+
|
|
316
|
+
VALIDATION = {}
|