Skip to content

Commit a1cdb6b

Browse files
committed
bump runtime limits due to slow github actions workers
1 parent b852ee0 commit a1cdb6b

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

biscuit-auth/examples/third_party.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
use std::time::Duration;
2+
13
use biscuit_auth::{
24
builder::{Algorithm, AuthorizerBuilder, BlockBuilder},
35
builder_ext::AuthorizerExt,
4-
datalog::SymbolTable,
6+
datalog::{RunLimits, SymbolTable},
57
Biscuit, KeyPair,
68
};
79
use rand::{prelude::StdRng, SeedableRng};
@@ -36,6 +38,10 @@ fn main() {
3638

3739
let mut authorizer = AuthorizerBuilder::new()
3840
.allow_all()
41+
.limits(RunLimits {
42+
max_time: Duration::from_secs(10),
43+
..Default::default()
44+
})
3945
.build(&biscuit1)
4046
.unwrap();
4147

@@ -44,6 +50,10 @@ fn main() {
4450

4551
let mut authorizer = AuthorizerBuilder::new()
4652
.allow_all()
53+
.limits(RunLimits {
54+
max_time: Duration::from_secs(10),
55+
..Default::default()
56+
})
4757
.build(&biscuit2)
4858
.unwrap();
4959

biscuit-auth/src/token/authorizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ mod tests {
10931093
)
10941094
.unwrap()
10951095
.limits(AuthorizerLimits {
1096-
max_time: Duration::from_millis(10), //Set 10 milliseconds as the maximum time allowed for the authorization due to "cheap" worker on GitHub Actions
1096+
max_time: Duration::from_secs(10), //Set 10 seconds as the maximum time allowed for the authorization due to "cheap" worker on GitHub Actions
10971097
..Default::default()
10981098
})
10991099
.build(&biscuit2)

biscuit-auth/src/token/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,10 @@ mod tests {
13841384
.check("check if bytes($0), { hex:00000000, hex:0102AB }.contains($0)")
13851385
.unwrap()
13861386
.allow_all()
1387+
.limits(AuthorizerLimits {
1388+
max_time: Duration::from_secs(10),
1389+
..Default::default()
1390+
})
13871391
.build(&biscuit2)
13881392
.unwrap();
13891393

biscuit-auth/tests/macros.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ fn authorizer_macro() {
7575
"#
7676
);
7777

78-
let authorizer = b.build_unauthenticated().unwrap();
78+
let authorizer = b
79+
.limits(RunLimits {
80+
max_time: Duration::from_secs(10),
81+
..Default::default()
82+
})
83+
.build_unauthenticated()
84+
.unwrap();
7985
assert_eq!(
8086
authorizer.dump_code(),
8187
r#"appended(true);
@@ -95,6 +101,10 @@ allow if true;
95101
#[test]
96102
fn authorizer_macro_trailing_comma() {
97103
let a = authorizer!(r#"fact("test", {my_key});"#, my_key = "my_value",)
104+
.limits(RunLimits {
105+
max_time: Duration::from_secs(10),
106+
..Default::default()
107+
})
98108
.build_unauthenticated()
99109
.unwrap();
100110
assert_eq!(
@@ -261,6 +271,10 @@ fn json() {
261271
$value.get("id") == $id,
262272
$value.get("roles").contains("admin");"#
263273
)
274+
.limits(RunLimits {
275+
max_time: Duration::from_secs(10),
276+
..Default::default()
277+
})
264278
.build(&biscuit)
265279
.unwrap();
266280
assert_eq!(

0 commit comments

Comments
 (0)