MCPcopy Index your code
hub / github.com/AI45Lab/Code / live_config

Function live_config

core/tests/test_s3_backend.rs:32–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30}
31
32fn live_config() -> Option<S3BackendConfig> {
33 let endpoint = env_required("A3S_S3_TEST_ENDPOINT")?;
34 let bucket = env_required("A3S_S3_TEST_BUCKET")?;
35 let access_key_id = env_required("A3S_S3_TEST_ACCESS_KEY_ID")?;
36 let secret_access_key = env_required("A3S_S3_TEST_SECRET_ACCESS_KEY")?;
37 let prefix = format!(
38 "{}/{}",
39 env_required("A3S_S3_TEST_PREFIX").unwrap_or_else(|| "a3s-code-tests".to_string()),
40 Uuid::new_v4()
41 );
42
43 let mut cfg = S3BackendConfig::new(bucket, prefix, access_key_id, secret_access_key)
44 .endpoint(endpoint)
45 .request_timeout(Duration::from_secs(10));
46
47 if let Some(region) = env_required("A3S_S3_TEST_REGION") {
48 cfg = cfg.region(region);
49 } else {
50 cfg = cfg.region("us-east-1");
51 }
52 if let Some(force) = env_required("A3S_S3_TEST_FORCE_PATH_STYLE") {
53 cfg = cfg.force_path_style(force.parse().unwrap_or(true));
54 } else {
55 cfg = cfg.force_path_style(true);
56 }
57 if let Some(token) = env_required("A3S_S3_TEST_SESSION_TOKEN") {
58 cfg = cfg.session_token(token);
59 }
60 Some(cfg)
61}
62
63#[tokio::test]
64#[ignore = "requires A3S_S3_TEST_ENDPOINT and friends"]

Calls 7

env_requiredFunction · 0.85
regionMethod · 0.80
force_path_styleMethod · 0.80
session_tokenMethod · 0.80
request_timeoutMethod · 0.45
endpointMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected