Public release release-e7c2b3ac175d
Source commit: e7c2b3ac175db426791c02779841c5df1d0ffdff Public tree identity: sha256:4f0b7cd828932c06d56f2406788f89b2050ef56c1e1a4f76f55341d387d78e46
This commit is contained in:
parent
9f43c6276a
commit
cfd4f19da2
16 changed files with 1386 additions and 313 deletions
|
|
@ -1,9 +1,10 @@
|
|||
use std::net::TcpListener;
|
||||
use std::time::Duration;
|
||||
|
||||
use clusterflux_client::{
|
||||
ApiErrorCategory, ApiErrorCode, ArtifactDownloadPoll, ArtifactId, ClientError,
|
||||
ClusterfluxClient, MockTransport, ProjectId, SessionCredential, TenantId, UserId,
|
||||
CLIENT_API_VERSION,
|
||||
ClusterfluxClient, ControlTransport, MockTransport, ProjectId, SessionCredential, TenantId,
|
||||
UserId, CLIENT_API_VERSION,
|
||||
};
|
||||
use clusterflux_control::CONTROL_API_PATH;
|
||||
use clusterflux_coordinator::service::CoordinatorService;
|
||||
|
|
@ -181,3 +182,47 @@ async fn typed_client_runs_against_the_real_strict_control_endpoint() {
|
|||
drop(client);
|
||||
server.join().unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn concurrent_requests_expand_the_bounded_pool_without_serializing() {
|
||||
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let address = listener.local_addr().unwrap();
|
||||
let server = std::thread::spawn(move || {
|
||||
let handlers = (0..2)
|
||||
.map(|_| {
|
||||
let (stream, _) = listener.accept().unwrap();
|
||||
std::thread::spawn(move || {
|
||||
let mut service = CoordinatorService::new(7);
|
||||
service
|
||||
.issue_cli_session(
|
||||
TenantId::from("tenant-one"),
|
||||
ProjectId::from("project-one"),
|
||||
UserId::from("user-one"),
|
||||
"concurrent-session",
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
service.handle_stream(stream).unwrap();
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
for handler in handlers {
|
||||
handler.join().unwrap();
|
||||
}
|
||||
});
|
||||
|
||||
let transport = ControlTransport::with_timeouts(
|
||||
format!("clusterflux+tcp://{address}"),
|
||||
Duration::from_secs(2),
|
||||
Duration::from_secs(5),
|
||||
)
|
||||
.unwrap();
|
||||
let client = ClusterfluxClient::with_transport(transport)
|
||||
.with_session_credential(&SessionCredential::from_secret("concurrent-session"));
|
||||
let (first, second) = tokio::join!(client.account_status(), client.account_status());
|
||||
assert!(first.unwrap().authenticated);
|
||||
assert!(second.unwrap().authenticated);
|
||||
|
||||
drop(client);
|
||||
server.join().unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue