feat: release Dever 0.1.5 with direct workers and long transactions
This commit is contained in:
1 parent
89629c2197
commit
a900d7e8db
153 files changed
+3676
-3708
No files matched your search
@@ -37,54 +37,20 @@ fn project(setting: &str) -> support::temp::TemporaryDirectory {
|
||||
root
|
||||
}
|
||||
|
||||
#[cfg(feature = "external")]
|
||||
#[test]
|
||||
fn worker_file_grants_are_explicit_and_cannot_write_executable_cache() {
|
||||
let setting = |path: &str, write: bool| {
|
||||
serde_json::json!({
|
||||
"adapter": {"sample.worker": {"files": {"content": {"path": path, "write": write}}}}
|
||||
})
|
||||
.to_string()
|
||||
};
|
||||
let capabilities = vec!["file".into()];
|
||||
let root = project(&setting("data/upload", true));
|
||||
let settings = Settings::load_project(root.path()).unwrap();
|
||||
let grants = settings
|
||||
.external_grants("sample.worker", &capabilities)
|
||||
.unwrap();
|
||||
assert_eq!(grants.len(), 1);
|
||||
assert_eq!(grants[0].source, root.path().join("data/upload"));
|
||||
assert_eq!(grants[0].destination, std::path::Path::new("/data/content"));
|
||||
assert!(grants[0].writable);
|
||||
assert!(
|
||||
settings
|
||||
.external_grants("sample.worker", &[])
|
||||
.unwrap_err()
|
||||
.contains("file capability")
|
||||
);
|
||||
for path in [
|
||||
"data",
|
||||
"data/cache",
|
||||
"data/cache/lib",
|
||||
"data/cache/lib/worker",
|
||||
] {
|
||||
let root = project(&setting(path, true));
|
||||
let settings = Settings::load_project(root.path()).unwrap();
|
||||
assert!(
|
||||
settings
|
||||
.external_grants("sample.worker", &capabilities)
|
||||
.unwrap_err()
|
||||
.contains("executable resource cache")
|
||||
fn obsolete_worker_mount_and_gpu_grants_are_rejected() {
|
||||
for field in ["files", "gpu"] {
|
||||
let root = project(
|
||||
&serde_json::json!({
|
||||
"adapter": {"sample.worker": {field: {}}}
|
||||
})
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
for path in ["../private", "/etc", ""] {
|
||||
let root = project(&setting(path, false));
|
||||
let settings = Settings::load_project(root.path()).unwrap();
|
||||
assert!(
|
||||
settings
|
||||
.external_grants("sample.worker", &capabilities)
|
||||
.unwrap_err()
|
||||
.contains("relative to the application")
|
||||
Settings::load_project(root.path())
|
||||
.unwrap()
|
||||
.select_adapter("sample.worker", &["default"])
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user