updates: shell bridge tests, host test that a start never reaches the update step, install hint
This commit is contained in:
1 parent
5a8985620c
commit
d949d600f8
3 files changed
+51
-1
No files matched your search
@@ -200,3 +200,41 @@ pub fn apply_env(cmd: &mut std::process::Command, app: &AppHandle, bridge: Optio
|
||||
cmd.env("STRATA_SHELL_BRIDGE", &bridge.url).env("STRATA_SHELL_TOKEN", &bridge.token);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn token_comparison_needs_every_byte() {
|
||||
assert!(same("abc123", "abc123"));
|
||||
assert!(!same("abc123", "abc124"));
|
||||
assert!(!same("abc123", "abc12"));
|
||||
assert!(!same("", "x"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn progress_reports_idle_until_something_starts() {
|
||||
let idle = Progress::default().json();
|
||||
assert_eq!(idle["state"], "idle");
|
||||
let p = Progress { state: "downloading", downloaded: 10, total: 100, version: Some("0.2.0".into()), error: None };
|
||||
assert_eq!(p.json()["downloaded"], 10);
|
||||
assert_eq!(p.json()["version"], "0.2.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_https_or_loopback_endpoints_may_override_the_configured_one() {
|
||||
for (value, ok) in [
|
||||
("https://updates.example.com/latest.json", true),
|
||||
("http://127.0.0.1:19080/app/latest.json", true),
|
||||
("http://localhost:19080/latest.json", true),
|
||||
("http://example.com/latest.json", false),
|
||||
("file:///etc/passwd", false),
|
||||
] {
|
||||
std::env::set_var(ENDPOINT_ENV, value);
|
||||
assert_eq!(endpoint_override().is_some(), ok, "{value}");
|
||||
}
|
||||
std::env::remove_var(ENDPOINT_ENV);
|
||||
assert!(endpoint_override().is_none());
|
||||
}
|
||||
}
|
||||
@@ -263,3 +263,14 @@ test('without the shell bridge "Update Strata" still updates Control and says no
|
||||
assert.doesNotMatch(job.summary, /Strata 0\.2\.0/);
|
||||
} finally { await f.native.close(); f.cleanup(); }
|
||||
});
|
||||
|
||||
test('packaged: opening the app, listing models and loading one never reach the update step', async () => {
|
||||
const f = fixture();
|
||||
try {
|
||||
await f.native.refresh(true);
|
||||
const load = await finish(f.native, f.native.operation('load', { model: 'iq2_xs' }).id);
|
||||
assert.equal(load.state, 'done', load.error);
|
||||
assert.deepEqual(f.calls, [], 'no update, check or rollback call: downloads happen only when the user presses Update');
|
||||
assert.equal(f.spawned.length, 0);
|
||||
} finally { await f.native.close(); f.cleanup(); }
|
||||
});
|
||||
+2
-1
@@ -1716,7 +1716,8 @@ def _install(a: argparse.Namespace) -> int:
|
||||
if not installer.is_file():
|
||||
return _error("this folder has no installer (setup.py). Engines, models and updates are installed from a "
|
||||
"full Strata folder with SETUP.bat / ./setup.sh and UPDATE.bat / ./update.sh; "
|
||||
"set STRATA_INSTALL_DIR to that folder to run it from here", 5)
|
||||
"set STRATA_INSTALL_DIR to that folder to run it from here. To update the engine and Control "
|
||||
"from the signed update feed, run `strata update`", 5)
|
||||
extra = [x for x in a.setup_args if x != "--"]
|
||||
return subprocess.call([sys.executable, str(installer), "--update" if a.update else "--setup", *extra],
|
||||
cwd=str(installer.parent))
|
||||
|
||||
Reference in new issue
Block a user