mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
13,838 upstream commits, forward from the 26.6.1.1 fork point. 129 conflicts: 37 resolved mechanically (take upstream's file, re-apply the brand sweep) and 92 by hand where our fork and upstream had both changed the same code. The rule throughout: upstream owns the engine, we own the naming and a small set of deliberate deviations. Never resolve by discarding an upstream change — a dropped rename or a missed new parameter becomes a compile error a thousand files away. Deviations verified intact after the merge: ENABLE_XRAY still defaults OFF (CMakeLists.txt:105) X-Datastore-User read by the server (authenticateUserByHTTP.cpp) X-ClickHouse-* in src/ 0 hanzo/research present system.*_log retention bound present ArrowFlight rip held against upstream re-adding it Two things worth naming, because neither shows up as a conflict: src/CMakeLists.txt gained an UNGUARDED `add_object_library(datastore_storages_arrowflight Storages/ArrowFlight)` from upstream, for a directory our gRPC rip deleted. It sat outside every conflict hunk, so a resolver reading only the markers would sail straight past it into a CMake configure error. Removed; the Server/ArrowFlight sibling at line 474 stays because it is inside `if (TARGET ch_contrib::arrow_flight)`. The brand sweep had rewritten github.com/ClickHouse/ClickHouse issue links to github.com/Datastore/Datastore — a dead host. Those point at upstream's own tracker and are restored, alongside the contributors list, sql.clickhouse.com and the ClickHouse Inc copyright: attribution is theirs, not ours to rename. base/glibc-compatibility/memcpy/memcpy.h is deleted, not kept: upstream dropped it for LLVM-libc's, and our only change to it was a comment rebrand.
104 lines
3.1 KiB
Python
104 lines
3.1 KiB
Python
"""
|
|
Tests for `ci.jobs.scripts.clickhouse_version.CHVersion.get_current_version`.
|
|
|
|
The version is read from `cmake/autogenerated_versions.txt`: the release triple
|
|
and revision from the `SET(...)` lines, the `version_type` from the
|
|
`VERSION_DESCRIBE` suffix, and the tweak as the first-parent commit count since
|
|
the file's githash. The tweak requires git history, so on a shallow checkout it
|
|
raises unless the caller opts into `no_strict`.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../.."))
|
|
|
|
from ci.jobs.scripts.clickhouse_version import CHVersion
|
|
|
|
_FILE = {
|
|
"major": 26,
|
|
"minor": 6,
|
|
"patch": 1,
|
|
"revision": "54511",
|
|
"githash": "cdee4c67ae5d33f5d1853693325b23ed88a36cfc",
|
|
"describe": "v26.6.1.1-testing",
|
|
"string": "26.6.1.1",
|
|
}
|
|
|
|
_HEAD = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
|
|
|
|
|
|
def _patch(monkeypatch, rev_list_output="123"):
|
|
monkeypatch.setattr(
|
|
"ci.jobs.scripts.clickhouse_version._read_versions", lambda: dict(_FILE)
|
|
)
|
|
calls = []
|
|
|
|
def fake_get_output(command, verbose=False):
|
|
calls.append(command)
|
|
if "rev-list" in command:
|
|
return rev_list_output
|
|
if "rev-parse" in command:
|
|
return _HEAD
|
|
return ""
|
|
|
|
monkeypatch.setattr(
|
|
"ci.jobs.scripts.clickhouse_version.Shell.get_output", fake_get_output
|
|
)
|
|
return calls
|
|
|
|
|
|
def test_reads_type_from_file_and_tweak_from_git(monkeypatch):
|
|
# version_type comes from the file's describe suffix, tweak from the commit
|
|
# count; no PR / non-PR distinction.
|
|
_patch(monkeypatch, rev_list_output="106")
|
|
version = CHVersion.get_current_version()
|
|
assert version.tweak == 106
|
|
assert version.version_type == "testing"
|
|
assert version.string == "26.6.1.106"
|
|
assert version.describe == "v26.6.1.106-testing"
|
|
assert version.githash == _HEAD
|
|
|
|
|
|
def test_without_tweak_keeps_one_and_skips_git(monkeypatch):
|
|
calls = _patch(monkeypatch)
|
|
version = CHVersion.get_current_version(with_tweak=False)
|
|
assert version.tweak == 1
|
|
assert version.string == "26.6.1.1"
|
|
assert not any("rev-list" in c for c in calls)
|
|
|
|
|
|
def test_shallow_checkout_fails_explicitly(monkeypatch):
|
|
# git rev-list yields nothing on a shallow checkout: raise instead of
|
|
# silently returning a default tweak.
|
|
_patch(monkeypatch, rev_list_output="")
|
|
with pytest.raises(ValueError):
|
|
CHVersion.get_current_version()
|
|
|
|
|
|
def test_no_strict_keeps_tweak_one_on_shallow(monkeypatch):
|
|
_patch(monkeypatch, rev_list_output="")
|
|
version = CHVersion.get_current_version(no_strict=True)
|
|
assert version.tweak == 1
|
|
assert version.string == "26.6.1.1"
|
|
|
|
|
|
def test_to_dict_is_fully_populated(monkeypatch):
|
|
_patch(monkeypatch, rev_list_output="5")
|
|
version_dict = CHVersion.get_current_version().to_dict()
|
|
assert version_dict["string"] == "26.6.1.5"
|
|
assert version_dict["describe"] == "v26.6.1.5-testing"
|
|
assert version_dict["githash"] == _HEAD
|
|
assert set(version_dict) == {
|
|
"revision",
|
|
"major",
|
|
"minor",
|
|
"patch",
|
|
"tweak",
|
|
"githash",
|
|
"describe",
|
|
"string",
|
|
}
|