()
| 641 | |
| 642 | #[tokio::test] |
| 643 | async fn policy_get_by_version() { |
| 644 | let store = test_store().await; |
| 645 | |
| 646 | let policy_v1 = SandboxPolicy::default().encode_to_vec(); |
| 647 | let policy_v2 = SandboxPolicy { |
| 648 | version: 2, |
| 649 | ..SandboxPolicy::default() |
| 650 | } |
| 651 | .encode_to_vec(); |
| 652 | store |
| 653 | .put_policy_revision("p1", "sandbox-1", 1, &policy_v1, "h1") |
| 654 | .await |
| 655 | .unwrap(); |
| 656 | store |
| 657 | .put_policy_revision("p2", "sandbox-1", 2, &policy_v2, "h2") |
| 658 | .await |
| 659 | .unwrap(); |
| 660 | |
| 661 | let v1 = store |
| 662 | .get_policy_by_version("sandbox-1", 1) |
| 663 | .await |
| 664 | .unwrap() |
| 665 | .unwrap(); |
| 666 | assert_eq!(v1.version, 1); |
| 667 | assert_eq!(v1.policy_hash, "h1"); |
| 668 | |
| 669 | let v2 = store |
| 670 | .get_policy_by_version("sandbox-1", 2) |
| 671 | .await |
| 672 | .unwrap() |
| 673 | .unwrap(); |
| 674 | assert_eq!(v2.version, 2); |
| 675 | assert_eq!(v2.policy_hash, "h2"); |
| 676 | |
| 677 | let none = store.get_policy_by_version("sandbox-1", 99).await.unwrap(); |
| 678 | assert!(none.is_none()); |
| 679 | } |
| 680 | |
| 681 | #[tokio::test] |
| 682 | async fn policy_update_status_and_get_loaded() { |
nothing calls this directly
no test coverage detected