Runtime: reset stale Core baseline on upgrade
This commit is contained in:
1 parent
978930f4d2
commit
2fba7d2dea
5 files changed
+310
-31
No files matched your search
@@ -250,6 +250,57 @@ int main()
|
||||
};
|
||||
|
||||
TemporaryTree tree;
|
||||
const auto startupState = tree.path() / "startup-state";
|
||||
const auto bundledStartupCore =
|
||||
tree.path() / "startup-runtime" / "lib" / "Echoion.ts";
|
||||
check(writeFile(bundledStartupCore, "runtime-core"),
|
||||
"failed to write startup Core fixture");
|
||||
const auto startupStore = startupState / "updates" / "components" / "core";
|
||||
check(publishHistoricalVersion(startupStore, "1.1.0", "Echoion.ts",
|
||||
"stale-managed-core"),
|
||||
"failed to publish stale managed Core fixture");
|
||||
check(activatePublishedVersion(startupStore, "1.1.0"),
|
||||
"failed to activate stale managed Core fixture");
|
||||
|
||||
auto firstRuntimeSelection =
|
||||
Echoion::Standalone::selectManagedCoreForStartup(
|
||||
startupState, bundledStartupCore, std::string_view{"2.0.0"});
|
||||
check(firstRuntimeSelection.has_value(),
|
||||
"runtime Core baseline selection failed");
|
||||
if (firstRuntimeSelection) {
|
||||
check(firstRuntimeSelection->corePath == bundledStartupCore,
|
||||
"new runtime did not prefer its bundled Core");
|
||||
check(firstRuntimeSelection->runtimeBaselineChanged,
|
||||
"new runtime did not report a Core baseline change");
|
||||
check(firstRuntimeSelection->archivedStore.has_value() &&
|
||||
std::filesystem::is_regular_file(
|
||||
*firstRuntimeSelection->archivedStore / "versions" /
|
||||
"1.1.0" / "Echoion.ts"),
|
||||
"stale managed Core store was not archived");
|
||||
}
|
||||
|
||||
check(publishHistoricalVersion(startupStore, "1.1.0", "Echoion.ts",
|
||||
"runtime-core"),
|
||||
"failed to seed the new runtime Core store");
|
||||
check(activatePublishedVersion(startupStore, "1.1.0"),
|
||||
"failed to activate the new runtime Core baseline");
|
||||
auto sameRuntimeSelection =
|
||||
Echoion::Standalone::selectManagedCoreForStartup(
|
||||
startupState, bundledStartupCore, std::string_view{"2.0.0"});
|
||||
check(sameRuntimeSelection.has_value() &&
|
||||
sameRuntimeSelection->corePath ==
|
||||
startupStore / "versions" / "1.1.0" / "Echoion.ts" &&
|
||||
!sameRuntimeSelection->runtimeBaselineChanged,
|
||||
"same runtime did not retain its managed Core selection");
|
||||
|
||||
auto nextRuntimeSelection =
|
||||
Echoion::Standalone::selectManagedCoreForStartup(
|
||||
startupState, bundledStartupCore, std::string_view{"2.1.0"});
|
||||
check(nextRuntimeSelection.has_value() &&
|
||||
nextRuntimeSelection->corePath == bundledStartupCore &&
|
||||
nextRuntimeSelection->runtimeBaselineChanged,
|
||||
"next runtime did not invalidate the prior managed Core baseline");
|
||||
|
||||
const auto state = tree.path() / "state";
|
||||
const auto incoming = tree.path() / "incoming";
|
||||
const auto currentCore = tree.path() / "installed" / "Echoion.ts";
|
||||
|
||||
Reference in new issue
Block a user