diff --git a/apps/admin-api/tests/migration_command.rs b/apps/admin-api/tests/migration_command.rs index 59c427d..ed16681 100644 --- a/apps/admin-api/tests/migration_command.rs +++ b/apps/admin-api/tests/migration_command.rs @@ -3,7 +3,8 @@ use std::process::{Command, Output}; use crank_community_auth::{hash_password, verify_password}; use crank_core::{Secret, SecretId, SecretKind, SecretStatus, UserSessionId, WorkspaceId}; use crank_registry::{ - CreateSecretRequest, MASTER_KEY_CIPHER_CONTRACT, MasterKeyIdentityCandidate, PostgresRegistry, + CreateSecretRequest, MASTER_KEY_CIPHER_CONTRACT, MasterKeyIdentityCandidate, + MigrationAuthority, PostgresRegistry, }; use crank_runtime::SecretCrypto; use serde_json::json; @@ -40,7 +41,10 @@ fn plan_is_deterministic_and_committed_contract_is_current() { ); assert_eq!(first.stdout, second.stdout); let plan: serde_json::Value = serde_json::from_slice(&first.stdout).unwrap(); - assert_eq!(plan["sequence"].as_array().unwrap().len(), 23); + assert_eq!( + plan["sequence"].as_array().unwrap().len(), + MigrationAuthority::sequence().len() + ); let target = command(&["plan", "--target-version"], None); assert!( target.status.success(), @@ -104,7 +108,11 @@ async fn database_only_config_can_apply_and_preflight_a_fresh_schema() { ); let result: serde_json::Value = serde_json::from_slice(&preflight.stdout).unwrap(); assert_eq!(result["status"], "current"); - assert_eq!(result["version"], 23); + let canonical_version = MigrationAuthority::sequence() + .last() + .expect("canonical migration sequence is nonempty") + .version; + assert_eq!(result["version"].as_i64(), Some(canonical_version)); } #[tokio::test]