Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,54 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_upgrade_replaces_the_canonical_container_without_versioned_copies():
|
||||
script = (ROOT / 'scripts' / 'upgrade_single_1216.sh').read_text(encoding='utf-8')
|
||||
|
||||
assert 'assert_single_canonical_container' in script
|
||||
assert 'docker rm "$SOURCE_CONTAINER_NAME"' in script
|
||||
assert 'run_canonical_container "$TARGET_IMAGE"' in script
|
||||
assert 'run_canonical_container "$CURRENT_IMAGE_ID"' in script
|
||||
assert 'unraid-appops-gateway:rollback' in script
|
||||
assert 'docker rename' not in script
|
||||
assert 'OLD_CONTAINER' not in script
|
||||
assert '${CONTAINER_NAME}-pre-' not in script
|
||||
assert '${CONTAINER_NAME}-failed-' not in script
|
||||
assert 'CONTAINER_NAME="${CONTAINER_NAME:-Unraid-AppOps-Gateway}"' in script
|
||||
assert '--hostname unraid-appops-gateway' in script
|
||||
assert 'net.unraid.docker.icon' in script
|
||||
assert 'net.unraid.docker.webui' in script
|
||||
assert 'urlopen(req, timeout=30)' in script
|
||||
assert 'previous-container-name.txt' in script
|
||||
assert 'umask 077' in script
|
||||
assert 'trap \'rm -f "$ENV_FILE" "$ENV_FILE_RAW"\' EXIT' in script
|
||||
assert 'value[key] = $0' in script
|
||||
assert 'for (position = 1; position <= count; position++)' in script
|
||||
assert 'for (index = 1;' not in script
|
||||
assert '/^APPOPS_ADMIN_TOKEN=/d' in script
|
||||
assert '/^VITE_APPOPS_ADMIN_TOKEN=/d' in script
|
||||
assert '/^VITE_APPOPS_VOICE_TOKEN=/d' in script
|
||||
assert '/^APPOPS_PORT=/d' in script
|
||||
assert '/^APPOPS_FRONTEND_ORIGIN=/d' in script
|
||||
assert 'attempt ${attempt}/3 failed; retrying' in script
|
||||
assert 'if ! check_endpoint "$path"' in script
|
||||
assert 'return 1' in script
|
||||
|
||||
|
||||
def test_upgrade_retention_is_scoped_to_appops_timestamped_backups_and_images():
|
||||
script = (ROOT / 'scripts' / 'upgrade_single_1216.sh').read_text(encoding='utf-8')
|
||||
|
||||
assert 'BACKUP_RETENTION="${BACKUP_RETENTION:-20}"' in script
|
||||
assert '^[0-9]{8}T[0-9]{6}Z$' in script
|
||||
assert 'rm -rf -- "$candidate"' in script
|
||||
assert "docker image ls unraid-appops-gateway" in script
|
||||
assert 'unraid-appops-gateway:production|unraid-appops-gateway:rollback' in script
|
||||
|
||||
|
||||
def test_powershell_wrapper_requires_explicit_execute_confirmation():
|
||||
script = (ROOT / 'scripts' / 'upgrade_single_1216.ps1').read_text(encoding='utf-8')
|
||||
|
||||
assert 'throw "Execute requires -Confirm UPGRADE_APPOPS_1216"' in script
|
||||
assert '$Confirm = "UPGRADE_APPOPS_1216"' not in script
|
||||
Reference in new issue
Block a user