Проект переехал в Gitea StackWorks: обновления, установка одной командой и ISO берут код с git.stackworks.ru, запасной ZIP скачивается оттуда же, ноды со старым адресом GitHub переключаются сами
Этот коммит содержится в:
@@ -4,6 +4,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
import network_core
|
||||
from conftest import ROOT
|
||||
import restore_network
|
||||
import update_core
|
||||
|
||||
@@ -104,6 +105,59 @@ def test_update_not_offered_when_local_is_newer(tmp_path, monkeypatch, data_dirs
|
||||
assert update_core.check_updates(fetch=True)["has_update"] is True
|
||||
|
||||
|
||||
GITEA = "https://git.stackworks.ru/viktor/virtuality"
|
||||
|
||||
|
||||
def make_source(path):
|
||||
import subprocess
|
||||
|
||||
def git(*args):
|
||||
return subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], cwd=path, check=True, capture_output=True, text=True).stdout.strip()
|
||||
|
||||
path.mkdir()
|
||||
git("init", "-q", "-b", "main")
|
||||
git("commit", "-q", "--allow-empty", "-m", "base")
|
||||
git("remote", "add", "origin", "https://github.com/viktor138irk/virtuality.git")
|
||||
return git
|
||||
|
||||
|
||||
def test_migrate_remote_moves_only_the_old_github_address(tmp_path, monkeypatch, data_dirs):
|
||||
git = make_source(tmp_path / "source")
|
||||
monkeypatch.setattr(update_core, "SOURCE_DIR", tmp_path / "source")
|
||||
assert update_core.migrate_remote() is True
|
||||
assert git("remote", "get-url", "origin") == GITEA + ".git"
|
||||
assert update_core.migrate_remote() is False
|
||||
git("remote", "set-url", "origin", "https://example.org/me/fork.git")
|
||||
assert update_core.migrate_remote() is False
|
||||
assert git("remote", "get-url", "origin") == "https://example.org/me/fork.git"
|
||||
|
||||
|
||||
def test_update_target_script_downloads_from_gitea(tmp_path):
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
source = tmp_path / "source"
|
||||
git = make_source(source)
|
||||
|
||||
def target(channel, script="resolve_update_target"):
|
||||
env = {**os.environ, "VIRTUALITY_UPDATE_CHANNEL": channel}
|
||||
code = f'SOURCE_DIR="{source}"; REMOTE=origin; BRANCH=main; . "{ROOT}/scripts/update_target.sh"; {script}; echo "$TARGET_LABEL $TARGET_ZIP_URL"'
|
||||
return subprocess.run(["bash", "-c", code], env=env, check=True, capture_output=True, text=True).stdout.strip().splitlines()
|
||||
|
||||
moved, result = target("main", "migrate_update_remote; resolve_update_target")
|
||||
assert moved == f"update remote moved: https://github.com/viktor138irk/virtuality.git -> {GITEA}.git"
|
||||
assert result == f"main {GITEA}/archive/main.zip"
|
||||
assert git("remote", "get-url", "origin") == GITEA + ".git"
|
||||
git("tag", "v0.11.1")
|
||||
assert target("stable") == [f"v0.11.1 {GITEA}/archive/v0.11.1.zip"]
|
||||
assert target("main") == [f"main {GITEA}/archive/main.zip"]
|
||||
# A fork downloads from itself; a non-https remote falls back to the project's address.
|
||||
git("remote", "set-url", "origin", "https://example.org/me/fork.git")
|
||||
assert target("stable", "migrate_update_remote; resolve_update_target") == ["v0.11.1 https://example.org/me/fork/archive/v0.11.1.zip"]
|
||||
git("remote", "set-url", "origin", "git@example.org:me/fork.git")
|
||||
assert target("stable") == [f"v0.11.1 {GITEA}/archive/v0.11.1.zip"]
|
||||
|
||||
|
||||
def test_stable_channel_follows_release_tags(tmp_path, monkeypatch, data_dirs):
|
||||
import subprocess
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user