Skip to content

Commit 6488b3c

Browse files
jschwesylvestre
authored andcommitted
Fix Config tests and docs
Commit 2d1e749 was out of date. Based on the config errors, I did my best to update the configuration. Signed-off-by: Jonathan Schwender <[email protected]>
1 parent bc17166 commit 6488b3c

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

docs/Configuration.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ dir = "/tmp/.cache/sccache"
2525
size = 7516192768 # 7 GiBytes
2626

2727
[cache.gcs]
28-
# optional url
29-
url = "..."
28+
# optional oauth url
29+
oauth_url = "..."
30+
# optional deprecated url
31+
deprecated_url = "..."
3032
rw_mode = "READ_ONLY"
3133
# rw_mode = "READ_WRITE"
3234
cred_path = "/psst/secret/cred"
3335
bucket = "bucket"
36+
key_prefix = "prefix"
3437

3538
[cache.memcached]
3639
url = "..."
@@ -42,6 +45,7 @@ url = "redis://user:[email protected]:6379/1"
4245
bucket = "name"
4346
endpoint = "s3-us-east-1.amazonaws.com"
4447
use_ssl = true
48+
key_prefix = "s3prefix"
4549
```
4650

4751
## env

src/config.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -939,8 +939,6 @@ fn test_gcs_oauth_url() {
939939
};
940940
}
941941

942-
943-
944942
#[test]
945943
fn full_toml_parse() {
946944
const CONFIG_STR: &str = r#"
@@ -967,11 +965,12 @@ size = 7516192768 # 7 GiBytes
967965
968966
[cache.gcs]
969967
# optional url
970-
url = "..."
968+
deprecated_url = "..."
971969
rw_mode = "READ_ONLY"
972970
# rw_mode = "READ_WRITE"
973971
cred_path = "/psst/secret/cred"
974972
bucket = "bucket"
973+
key_prefix = "prefix"
975974
976975
[cache.memcached]
977976
url = "..."
@@ -983,10 +982,12 @@ url = "redis://user:[email protected]:6379/1"
983982
bucket = "name"
984983
endpoint = "s3-us-east-1.amazonaws.com"
985984
use_ssl = true
985+
key_prefix = "s3prefix"
986986
"#;
987987

988988
let file_config: FileConfig = toml::from_str(CONFIG_STR).expect("Is valid toml.");
989-
assert_eq!(file_config,
989+
assert_eq!(
990+
file_config,
990991
FileConfig {
991992
cache: CacheConfigs {
992993
azure: None, // TODO not sure how to represent a unit struct in TOML Some(AzureCacheConfig),
@@ -995,11 +996,12 @@ use_ssl = true
995996
size: 7 * 1024 * 1024 * 1024,
996997
}),
997998
gcs: Some(GCSCacheConfig {
998-
url: Some("...".to_owned()),
999+
oauth_url: None,
1000+
deprecated_url: Some("...".to_owned()),
9991001
bucket: "bucket".to_owned(),
10001002
cred_path: Some(PathBuf::from("/psst/secret/cred")),
10011003
rw_mode: GCSCacheRWMode::ReadOnly,
1002-
1004+
key_prefix: "prefix".into(),
10031005
}),
10041006
redis: Some(RedisCacheConfig {
10051007
url: "redis://user:[email protected]:6379/1".to_owned(),
@@ -1011,12 +1013,19 @@ use_ssl = true
10111013
bucket: "name".to_owned(),
10121014
endpoint: "s3-us-east-1.amazonaws.com".to_owned(),
10131015
use_ssl: true,
1016+
key_prefix: "s3prefix".into()
10141017
}),
10151018
},
10161019
dist: DistConfig {
1017-
auth: DistAuth::Token { token: "secrettoken".to_owned() } ,
1020+
auth: DistAuth::Token {
1021+
token: "secrettoken".to_owned()
1022+
},
10181023
#[cfg(any(feature = "dist-client", feature = "dist-server"))]
1019-
scheduler_url: Some(parse_http_url("http://1.2.3.4:10600").map(|url| { HTTPUrl::from_url(url)}).expect("Scheduler url must be valid url str")),
1024+
scheduler_url: Some(
1025+
parse_http_url("http://1.2.3.4:10600")
1026+
.map(|url| { HTTPUrl::from_url(url) })
1027+
.expect("Scheduler url must be valid url str")
1028+
),
10201029
#[cfg(not(any(feature = "dist-client", feature = "dist-server")))]
10211030
scheduler_url: Some("http://1.2.3.4:10600".to_owned()),
10221031
cache_dir: PathBuf::from("/home/user/.cache/sccache-dist-client"),
@@ -1026,4 +1035,4 @@ use_ssl = true
10261035
},
10271036
}
10281037
)
1029-
}
1038+
}

0 commit comments

Comments
 (0)