fix(tests): update applied_migrations expected fixtures in config_migration.sh
This commit is contained in:
@@ -396,7 +396,7 @@ function assert(condition, message) {
|
|||||||
assert(out.changed === true, '1.0.1 config should require migration');
|
assert(out.changed === true, '1.0.1 config should require migration');
|
||||||
assert(out.config.settings.config_version === '1.0.5', 'config schema version should advance to 1.0.5');
|
assert(out.config.settings.config_version === '1.0.5', 'config schema version should advance to 1.0.5');
|
||||||
assert(out.config.settings.component_update_check_enabled === '1', 'updates from 1.0.1 and below should enable component update checks');
|
assert(out.config.settings.component_update_check_enabled === '1', 'updates from 1.0.1 and below should enable component update checks');
|
||||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section', 'orphan_section_interface_cleanup']), 'named migrations should be recorded');
|
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section', 'orphan_section_interface_cleanup', 'ensure_dns_server_defaults']), 'named migrations should be recorded');
|
||||||
assert(!Object.prototype.hasOwnProperty.call(section, 'interfaces'), 'parent interface list should be removed');
|
assert(!Object.prototype.hasOwnProperty.call(section, 'interfaces'), 'parent interface list should be removed');
|
||||||
assert(JSON.stringify(interfaces.map(item => item.name)) === JSON.stringify(['awg0', 'tun0']), 'interfaces should keep their order');
|
assert(JSON.stringify(interfaces.map(item => item.name)) === JSON.stringify(['awg0', 'tun0']), 'interfaces should keep their order');
|
||||||
for (const item of interfaces) {
|
for (const item of interfaces) {
|
||||||
@@ -434,7 +434,7 @@ function assert(condition, message) {
|
|||||||
|
|
||||||
assert(out.config.settings.component_update_check_enabled === '0', '1.0.2 config must preserve an explicitly disabled component check');
|
assert(out.config.settings.component_update_check_enabled === '0', '1.0.2 config must preserve an explicitly disabled component check');
|
||||||
assert(out.config.settings.config_version === '1.0.5', '1.0.2 config should advance through the HTTP URL migration schema');
|
assert(out.config.settings.config_version === '1.0.5', '1.0.2 config should advance through the HTTP URL migration schema');
|
||||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section', 'orphan_section_interface_cleanup']), 'newer configs should mark skipped migrations');
|
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section', 'orphan_section_interface_cleanup', 'ensure_dns_server_defaults']), 'newer configs should mark skipped migrations');
|
||||||
NODE
|
NODE
|
||||||
|
|
||||||
cat >"$WORK_DIR/forkop-1.0.4-http.json" <<'JSON'
|
cat >"$WORK_DIR/forkop-1.0.4-http.json" <<'JSON'
|
||||||
@@ -500,7 +500,7 @@ assert(JSON.stringify(jsonOutbounds[1]) === JSON.stringify({
|
|||||||
server_port: 8080,
|
server_port: 8080,
|
||||||
}), 'unnamed HTTP URL should receive a unique http tag');
|
}), 'unnamed HTTP URL should receive a unique http tag');
|
||||||
assert(jsonOutbounds[2].type === 'direct' && jsonOutbounds[2].tag === 'http', 'existing JSON outbounds should remain unchanged');
|
assert(jsonOutbounds[2].type === 'direct' && jsonOutbounds[2].tag === 'http', 'existing JSON outbounds should remain unchanged');
|
||||||
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section', 'orphan_section_interface_cleanup']), 'HTTP URL migration should be recorded');
|
assert(JSON.stringify(out.config.settings.applied_migrations) === JSON.stringify(['interface_sections', 'enable_component_checks', 'http_connection_urls', 'dns_hosts_to_option', 'global_hosts_to_section', 'orphan_section_interface_cleanup', 'ensure_dns_server_defaults']), 'HTTP URL migration should be recorded');
|
||||||
NODE
|
NODE
|
||||||
|
|
||||||
cat >"$WORK_DIR/forkop-1.0.5-http.json" <<'JSON'
|
cat >"$WORK_DIR/forkop-1.0.5-http.json" <<'JSON'
|
||||||
@@ -615,7 +615,7 @@ grep -Fxq 'tachyon.settings.config_version=1.0.5' "$WORK_DIR/runtime-version.sta
|
|||||||
fail "runtime version migration must advance config_version"
|
fail "runtime version migration must advance config_version"
|
||||||
grep -Fxq 'tachyon.settings.component_update_check_enabled=1' "$WORK_DIR/runtime-version.state" ||
|
grep -Fxq 'tachyon.settings.component_update_check_enabled=1' "$WORK_DIR/runtime-version.state" ||
|
||||||
fail "runtime version migration must enable component update checks"
|
fail "runtime version migration must enable component update checks"
|
||||||
grep -Fq 'tachyon.settings.applied_migrations=interface_sections enable_component_checks http_connection_urls dns_hosts_to_option global_hosts_to_section' "$WORK_DIR/runtime-version.state" ||
|
grep -Fq 'tachyon.settings.applied_migrations=interface_sections enable_component_checks http_connection_urls dns_hosts_to_option global_hosts_to_section orphan_section_interface_cleanup ensure_dns_server_defaults' "$WORK_DIR/runtime-version.state" ||
|
||||||
fail "runtime migration must record stable migration names"
|
fail "runtime migration must record stable migration names"
|
||||||
grep -Eq '^tachyon\.main\.outbound_jsons=\{ "type": "http", "tag": "http", "server": "proxy\.example", "server_port": 8080 \}$' "$WORK_DIR/runtime-version.state" ||
|
grep -Eq '^tachyon\.main\.outbound_jsons=\{ "type": "http", "tag": "http", "server": "proxy\.example", "server_port": 8080 \}$' "$WORK_DIR/runtime-version.state" ||
|
||||||
fail "runtime migration must convert native HTTP proxy links to JSON outbounds"
|
fail "runtime migration must convert native HTTP proxy links to JSON outbounds"
|
||||||
|
|||||||
Reference in New Issue
Block a user