You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let test_json = r#"{"nvidia":{"pass-device-specs":true,"device-id-strategy":"index","device-list-strategy":"volume-mounts"}}"#;
1483
+
let test_json = r#"{"nvidia":{"pass-device-specs":true,"device-id-strategy":"index","device-list-strategy":"volume-mounts","max-sharing-per-gpu":10,"rename-shared-gpu":true}}"#;
1481
1484
1482
1485
let device_plugins:K8sDevicePluginsSettings = serde_json::from_str(test_json).unwrap();
let test_json = r#"{"pass-device-specs":false,"device-id-strategy":"uuid","device-list-strategy":"envvar"}"#;
1505
+
let test_json = r#"{"pass-device-specs":false,"device-id-strategy":"uuid","device-list-strategy":"envvar","max-sharing-per-gpu":10,"rename-shared-gpu":false}"#;
1501
1506
let nvidia_device_plugins:NvidiaDevicePluginSettings =
let results = serde_json::to_string(&nvidia_device_plugins).unwrap();
1513
1520
assert_eq!(results, test_json);
1514
1521
}
1522
+
#[test]
1523
+
fntest_invalid_max_sharing_per_gpu(){
1524
+
let test_json = r#"{"pass-device-specs":false,"device-id-strategy":"uuid","device-list-strategy":"envvar","max-sharing-per-gpu":0,"rename-shared-gpu":false}"#;
1525
+
let result:Result<NvidiaDevicePluginSettings,_> = serde_json::from_str(test_json);
1526
+
assert!(result.is_err(),"The JSON should not be parsed successfully as it contains an invalid value for 'max-sharing-per-gpu'.");
0 commit comments