109 lines
3.6 KiB
GDScript
109 lines
3.6 KiB
GDScript
# tests/test_deployment_pipeline.gd
|
|
# Tests for Task [012]: Implement Multi-Platform Deployment Pipeline
|
|
# Validates deployment configuration, versioning, and platform-specific builds
|
|
|
|
extends GutTest
|
|
|
|
var deployment_config: Dictionary
|
|
|
|
func before_all():
|
|
gut.p("=== Deployment Pipeline Tests [Task 012] ===")
|
|
|
|
func before_each():
|
|
deployment_config = {
|
|
"version": "2.3.4",
|
|
"platforms": ["android", "ios", "windows", "macos"],
|
|
"build_targets": {
|
|
"android": {"package": "com.tekton.dash", "format": "aab"},
|
|
"ios": {"package": "com.tekton.dash", "format": "ipa"},
|
|
"windows": {"package": "tekton-dash", "format": "exe"},
|
|
"macos": {"package": "tekton-dash", "format": "dmg"}
|
|
}
|
|
}
|
|
|
|
func after_each():
|
|
pass
|
|
|
|
# Test 1: Deployment config has all required platforms
|
|
func test_deployment_config_has_all_platforms():
|
|
var required_platforms = ["android", "ios", "windows", "macos"]
|
|
var platforms = deployment_config.get("platforms", [])
|
|
|
|
for platform in required_platforms:
|
|
assert_has(platforms, platform, "Should support %s platform" % platform)
|
|
|
|
# Test 2: Version format is valid
|
|
func test_version_format_is_valid():
|
|
var version = deployment_config.get("version", "")
|
|
var parts = version.split(".")
|
|
|
|
assert_eq(parts.size(), 3, "Version should have 3 parts (major.minor.patch)")
|
|
for part in parts:
|
|
assert_true(part.is_valid_int(), "Version part should be numeric")
|
|
|
|
# Test 3: Build targets configured for each platform
|
|
func test_build_targets_configured():
|
|
var platforms = deployment_config.get("platforms", [])
|
|
var targets = deployment_config.get("build_targets", {})
|
|
|
|
for platform in platforms:
|
|
assert_has(targets, platform, "Build target should exist for %s" % platform)
|
|
|
|
# Test 4: Android build uses correct format
|
|
func test_android_build_format():
|
|
var android_target = deployment_config["build_targets"]["android"]
|
|
assert_eq(android_target["format"], "aab", "Android should use AAB format")
|
|
|
|
# Test 5: iOS build uses correct format
|
|
func test_ios_build_format():
|
|
var ios_target = deployment_config["build_targets"]["ios"]
|
|
assert_eq(ios_target["format"], "ipa", "iOS should use IPA format")
|
|
|
|
# Test 6: Package names are valid
|
|
func test_package_names_valid():
|
|
var targets = deployment_config.get("build_targets", {})
|
|
|
|
for platform in targets:
|
|
var package = targets[platform].get("package", "")
|
|
assert_true(package.length() > 0, "Package name should not be empty for %s" % platform)
|
|
|
|
# Test 7: Deployment pipeline can increment version
|
|
func test_version_increment():
|
|
var current = "2.3.4"
|
|
var parts = current.split(".")
|
|
parts[2] = str(int(parts[2]) + 1)
|
|
var new_version = ".".join(parts)
|
|
|
|
assert_eq(new_version, "2.3.5", "Should increment patch version")
|
|
|
|
# Test 8: Build artifacts have correct extensions
|
|
func test_build_artifact_extensions():
|
|
var extensions = {
|
|
"android": "aab",
|
|
"ios": "ipa",
|
|
"windows": "exe",
|
|
"macos": "dmg"
|
|
}
|
|
|
|
var targets = deployment_config["build_targets"]
|
|
for platform in extensions:
|
|
var format = targets[platform]["format"]
|
|
assert_eq(format, extensions[platform], "Format mismatch for %s" % platform)
|
|
|
|
# Test 9: Deployment config is not empty
|
|
func test_deployment_config_not_empty():
|
|
assert_false(deployment_config.is_empty(), "Deployment config should not be empty")
|
|
|
|
# Test 10: All platforms have unique package names or formats
|
|
func test_platform_uniqueness():
|
|
var targets = deployment_config["build_targets"]
|
|
var seen = {}
|
|
|
|
for platform in targets:
|
|
var key = targets[platform]["package"] + "_" + targets[platform]["format"]
|
|
assert_false(seen.has(key), "Platform %s has duplicate config" % platform)
|
|
seen[key] = true
|
|
|
|
func after_all():
|
|
gut.p("=== Deployment Pipeline Tests Complete ===")
|