Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Sep 13, 2024
1 parent 19f87fc commit 54e8fcd
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 20 deletions.
60 changes: 40 additions & 20 deletions src/query/service/tests/it/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ async fn test_auth_mgr_with_jwt_multi_sources() -> Result<()> {
.with_subject(user2.to_string());
let token2 = pair2.sign(claims)?;
let res = auth_mgr
.auth(&mut session, &Credential::Jwt {
token: token2,
client_ip: None,
})
.auth(
&mut session,
&Credential::Jwt {
token: token2,
client_ip: None,
},
true,
)
.await;
assert!(res.is_ok());

Expand Down Expand Up @@ -245,10 +249,14 @@ async fn test_auth_mgr_with_jwt() -> Result<()> {
let token = key_pair.sign(claims)?;

let res = auth_mgr
.auth(&mut session, &Credential::Jwt {
token,
client_ip: None,
})
.auth(
&mut session,
&Credential::Jwt {
token,
client_ip: None,
},
true,
)
.await;
assert!(res.is_err());

Expand All @@ -266,10 +274,14 @@ async fn test_auth_mgr_with_jwt() -> Result<()> {
let token = key_pair.sign(claims)?;

let res = auth_mgr
.auth(&mut session, &Credential::Jwt {
token,
client_ip: None,
})
.auth(
&mut session,
&Credential::Jwt {
token,
client_ip: None,
},
true,
)
.await;
assert!(res.is_err());
assert!(
Expand All @@ -288,10 +300,14 @@ async fn test_auth_mgr_with_jwt() -> Result<()> {
let token = key_pair.sign(claims)?;

let res = auth_mgr
.auth(&mut session, &Credential::Jwt {
token,
client_ip: None,
})
.auth(
&mut session,
&Credential::Jwt {
token,
client_ip: None,
},
true,
)
.await;
assert!(res.is_err());
assert!(
Expand All @@ -310,10 +326,14 @@ async fn test_auth_mgr_with_jwt() -> Result<()> {
let token = key_pair.sign(claims)?;

auth_mgr
.auth(&mut session, &Credential::Jwt {
token,
client_ip: None,
})
.auth(
&mut session,
&Credential::Jwt {
token,
client_ip: None,
},
true,
)
.await?;
let user_info = session.get_current_user()?;
assert_eq!(user_info.grants.roles().len(), 0);
Expand Down
10 changes: 10 additions & 0 deletions src/query/service/tests/it/servers/http/http_query_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,8 @@ async fn test_affect() -> Result<()> {
("timezone".to_string(), "Asia/Shanghai".to_string()),
])),
txn_state: Some(TxnState::AutoCommit),
need_sticky: false,
need_refresh: false,
last_server_info: None,
last_query_ids: vec![],
internal: None,
Expand All @@ -1414,6 +1416,8 @@ async fn test_affect() -> Result<()> {
"6".to_string(),
)])),
txn_state: Some(TxnState::AutoCommit),
need_sticky: false,
need_refresh: false,
last_server_info: None,
last_query_ids: vec![],
internal: None,
Expand All @@ -1432,6 +1436,8 @@ async fn test_affect() -> Result<()> {
"6".to_string(),
)])),
txn_state: Some(TxnState::AutoCommit),
need_sticky: false,
need_refresh: false,
last_server_info: None,
last_query_ids: vec![],
internal: None,
Expand All @@ -1452,6 +1458,8 @@ async fn test_affect() -> Result<()> {
"6".to_string(),
)])),
txn_state: Some(TxnState::AutoCommit),
need_sticky: false,
need_refresh: false,
last_server_info: None,
last_query_ids: vec![],
internal: None,
Expand All @@ -1474,6 +1482,8 @@ async fn test_affect() -> Result<()> {
"Asia/Shanghai".to_string(),
)])),
txn_state: Some(TxnState::AutoCommit),
need_sticky: false,
need_refresh: false,
last_server_info: None,
last_query_ids: vec![],
internal: None,
Expand Down

0 comments on commit 54e8fcd

Please sign in to comment.