| 291 |
291 |
|
/// Max concurrent active sandboxes per IP.
|
| 292 |
292 |
|
pub const SANDBOX_MAX_PER_IP: i64 = 3;
|
| 293 |
293 |
|
|
|
294 |
+ |
// ── Compile-time invariants on the constants above ───────────────────────────
|
|
295 |
+ |
//
|
|
296 |
+ |
// Encoded as `const _: () = assert!(...)` rather than `#[test]` functions: these
|
|
297 |
+ |
// are checked when the crate is COMPILED, so a bad constant fails the build
|
|
298 |
+ |
// (not just a test run), and the whole invariant set sits next to the values.
|
|
299 |
+ |
|
|
300 |
+ |
// Price constants
|
|
301 |
+ |
const _: () = assert!(MAX_PRICE_CENTS > 0);
|
|
302 |
+ |
const _: () = assert!(MAX_PRICE_CENTS <= 10_000_000); // <= $100,000
|
|
303 |
+ |
const _: () = assert!(MIN_SUBSCRIPTION_PRICE_CENTS > 0);
|
|
304 |
+ |
const _: () = assert!(MIN_SUBSCRIPTION_PRICE_CENTS < MAX_PRICE_CENTS);
|
|
305 |
+ |
|
|
306 |
+ |
// Stripe fee constants
|
|
307 |
+ |
const _: () = assert!(STRIPE_FEE_PERCENTAGE > 0.0 && STRIPE_FEE_PERCENTAGE < 0.5);
|
|
308 |
+ |
const _: () = assert!(STRIPE_FEE_FIXED_CENTS > 0.0);
|
|
309 |
+ |
|
|
310 |
+ |
// Database pool
|
|
311 |
+ |
const _: () = assert!(DB_POOL_MAX_CONNECTIONS > DB_POOL_MIN_CONNECTIONS);
|
|
312 |
+ |
const _: () = assert!(DB_POOL_MIN_CONNECTIONS > 0);
|
|
313 |
+ |
const _: () = assert!(DB_ACQUIRE_TIMEOUT_SECS > 0);
|
|
314 |
+ |
const _: () = assert!(DB_MAX_LIFETIME_SECS > DB_IDLE_TIMEOUT_SECS);
|
|
315 |
+ |
|
|
316 |
+ |
// Session constants
|
|
317 |
+ |
const _: () = assert!(SESSION_EXPIRY_DAYS > 0 && SESSION_EXPIRY_DAYS <= 365);
|
|
318 |
+ |
const _: () = assert!(SESSION_TOUCH_CACHE_SECS > 0 && SESSION_TOUCH_CACHE_SECS < 86400);
|
|
319 |
+ |
|
|
320 |
+ |
// Login security
|
|
321 |
+ |
const _: () = assert!(MAX_LOGIN_ATTEMPTS > 0);
|
|
322 |
+ |
const _: () = assert!(LOCKOUT_MINUTES > 0);
|
|
323 |
+ |
|
|
324 |
+ |
// Email link expiry ordering
|
|
325 |
+ |
const _: () = assert!(PASSWORD_RESET_EXPIRY_SECS > 0);
|
|
326 |
+ |
const _: () = assert!(EMAIL_VERIFICATION_EXPIRY_SECS > PASSWORD_RESET_EXPIRY_SECS);
|
|
327 |
+ |
const _: () = assert!(ACCOUNT_DELETION_EXPIRY_SECS > 0);
|
|
328 |
+ |
|
|
329 |
+ |
// Scheduler
|
|
330 |
+ |
const _: () = assert!(SCHEDULER_INTERVAL_SECS > 0);
|
|
331 |
+ |
|
|
332 |
+ |
// Rate-limit bursts all positive
|
|
333 |
+ |
const _: () = assert!(AUTH_RATE_LIMIT_BURST > 0);
|
|
334 |
+ |
const _: () = assert!(VALIDATE_RATE_LIMIT_BURST > 0);
|
|
335 |
+ |
const _: () = assert!(API_WRITE_RATE_LIMIT_BURST > 0);
|
|
336 |
+ |
const _: () = assert!(API_READ_RATE_LIMIT_BURST > 0);
|
|
337 |
+ |
const _: () = assert!(API_EXPORT_RATE_LIMIT_BURST > 0);
|
|
338 |
+ |
const _: () = assert!(LICENSE_KEY_RATE_LIMIT_BURST > 0);
|
|
339 |
+ |
const _: () = assert!(UPLOAD_RATE_LIMIT_BURST > 0);
|
|
340 |
+ |
const _: () = assert!(OAUTH_RATE_LIMIT_BURST > 0);
|
|
341 |
+ |
const _: () = assert!(OAUTH_TOKEN_RATE_LIMIT_BURST > 0);
|
|
342 |
+ |
|
|
343 |
+ |
// Rate-limit burst ordering: read > write > auth
|
|
344 |
+ |
const _: () = assert!(API_READ_RATE_LIMIT_BURST > API_WRITE_RATE_LIMIT_BURST);
|
|
345 |
+ |
const _: () = assert!(API_WRITE_RATE_LIMIT_BURST > AUTH_RATE_LIMIT_BURST);
|
|
346 |
+ |
|
|
347 |
+ |
// Rate-limit intervals positive
|
|
348 |
+ |
const _: () = assert!(AUTH_RATE_LIMIT_MS > 0);
|
|
349 |
+ |
const _: () = assert!(API_WRITE_RATE_LIMIT_MS > 0);
|
|
350 |
+ |
const _: () = assert!(API_READ_RATE_LIMIT_MS > 0);
|
|
351 |
+ |
|
|
352 |
+ |
// File size limits
|
|
353 |
+ |
const _: () = assert!(SCAN_MAX_MEMORY_BYTES > 0);
|
|
354 |
+ |
const _: () = assert!(SCAN_SPOOL_FREE_RESERVE_BYTES < SCAN_SPOOL_MAX_BYTES);
|
|
355 |
+ |
const _: () = assert!(SCAN_SPOOL_MAX_BYTES > SCAN_MAX_MEMORY_BYTES as u64);
|
|
356 |
+ |
const _: () = assert!(SCAN_JOB_RETENTION_DAYS >= 7); // no same-day purge race
|
|
357 |
+ |
const _: () = assert!(BROADCAST_PARALLELISM > 0 && BROADCAST_PARALLELISM <= 64);
|
|
358 |
+ |
const _: () = assert!(SCAN_ZIP_MAX_UNCOMPRESSED > SCAN_MAX_MEMORY_BYTES as u64);
|
|
359 |
+ |
const _: () = assert!(GIT_RAW_MAX_BYTES > GIT_MAX_FILE_SIZE_BYTES);
|
|
360 |
+ |
const _: () = assert!(SCAN_ZIP_MAX_RATIO > 0.0);
|
|
361 |
+ |
const _: () = assert!(SCAN_ZIP_MAX_DEPTH > 0);
|
|
362 |
+ |
|
|
363 |
+ |
// SyncKit
|
|
364 |
+ |
const _: () = assert!(SYNCKIT_PUSH_MAX_CHANGES > 0);
|
|
365 |
+ |
const _: () = assert!(SYNCKIT_PULL_PAGE_SIZE > 0);
|
|
366 |
+ |
const _: () = assert!(SYNCKIT_MAX_BLOB_SIZE_BYTES > 0);
|
|
367 |
+ |
const _: () = assert!(SYNCKIT_JWT_EXPIRY_SECS > 0);
|
|
368 |
+ |
|
|
369 |
+ |
// TOTP
|
|
370 |
+ |
const _: () = assert!(TOTP_DIGITS == 6);
|
|
371 |
+ |
const _: () = assert!(TOTP_STEP == 30);
|
|
372 |
+ |
const _: () = assert!(BACKUP_CODE_COUNT > 0);
|
|
373 |
+ |
const _: () = assert!(BACKUP_CODE_LENGTH > 0);
|
|
374 |
+ |
|
|
375 |
+ |
// Pagination
|
|
376 |
+ |
const _: () = assert!(DISCOVER_PAGE_SIZE > 0);
|
|
377 |
+ |
const _: () = assert!(FEED_PAGE_SIZE > 0);
|
|
378 |
+ |
const _: () = assert!(PAGINATION_WINDOW_SIZE > 0);
|
|
379 |
+ |
|
|
380 |
+ |
// String constants non-empty
|
|
381 |
+ |
const _: () = assert!(!DATE_FMT_SHORT.is_empty());
|
|
382 |
+ |
const _: () = assert!(!DATE_FMT_FULL.is_empty());
|
|
383 |
+ |
const _: () = assert!(!DATE_FMT_ISO.is_empty());
|
|
384 |
+ |
const _: () = assert!(!DATE_FMT_DATETIME.is_empty());
|
|
385 |
+ |
const _: () = assert!(!DATE_FMT_DATETIME_UTC.is_empty());
|
|
386 |
+ |
const _: () = assert!(!CHANGELOG_PROJECT_SLUG.is_empty());
|
|
387 |
+ |
const _: () = assert!(!BUILD_ALLOWED_TARGETS.is_empty());
|
|
388 |
+ |
|
|
389 |
+ |
// Collections
|
|
390 |
+ |
const _: () = assert!(MAX_COLLECTIONS_PER_USER > 0);
|
|
391 |
+ |
const _: () = assert!(MAX_ITEMS_PER_COLLECTION > 0);
|
|
392 |
+ |
|
|
393 |
+ |
// Build pipeline
|
|
394 |
+ |
const _: () = assert!(BUILD_TIMEOUT_SECS > 0);
|
|
395 |
+ |
const _: () = assert!(BUILD_MAX_LOG_BYTES > 0);
|
|
396 |
+ |
|
|
397 |
+ |
// Health monitoring
|
|
398 |
+ |
const _: () = assert!(HEALTH_CHECK_INTERVAL_SECS > 0);
|
|
399 |
+ |
const _: () = assert!(ALERT_COOLDOWN_SECS > HEALTH_CHECK_INTERVAL_SECS);
|
|
400 |
+ |
|
|
401 |
+ |
// Sandbox
|
|
402 |
+ |
const _: () = assert!(SANDBOX_EXPIRY_SECS > 0);
|
|
403 |
+ |
const _: () = assert!(SANDBOX_CLEANUP_INTERVAL_SECS > 0);
|
|
404 |
+ |
const _: () = assert!(SANDBOX_CLEANUP_INTERVAL_SECS < SANDBOX_EXPIRY_SECS as u64);
|
|
405 |
+ |
const _: () = assert!(SANDBOX_MAX_PER_IP > 0);
|
|
406 |
+ |
|
|
407 |
+ |
// Webhook
|
|
408 |
+ |
const _: () = assert!(WEBHOOK_TIMESTAMP_TOLERANCE_SECS > 0);
|
|
409 |
+ |
|
|
410 |
+ |
// OAuth
|
|
411 |
+ |
const _: () = assert!(OAUTH_CODE_EXPIRY_SECS > 0);
|
|
412 |
+ |
const _: () = assert!(OAUTH_CODE_LENGTH > 0);
|
|
413 |
+ |
|
|
414 |
+ |
// Buffer limits
|
|
415 |
+ |
const _: () = assert!(USER_AGENT_MAX_LENGTH > 0);
|
|
416 |
+ |
const _: () = assert!(SYNCKIT_MAX_KEY_ENVELOPE_BYTES > 0);
|
|
417 |
+ |
|
| 294 |
418 |
|
#[cfg(test)]
|
| 295 |
419 |
|
mod tests {
|
| 296 |
420 |
|
use super::*;
|
| 297 |
421 |
|
|
| 298 |
|
- |
// -- Price constants --
|
| 299 |
|
- |
|
|
422 |
+ |
/// The build-target FORMAT check uses `str::contains`, which isn't const —
|
|
423 |
+ |
/// so this invariant stays a runtime test (the rest are compile-time above).
|
| 300 |
424 |
|
#[test]
|
| 301 |
|
- |
fn max_price_cents_is_positive() {
|
| 302 |
|
- |
assert!(MAX_PRICE_CENTS > 0);
|
| 303 |
|
- |
}
|
| 304 |
|
- |
|
| 305 |
|
- |
#[test]
|
| 306 |
|
- |
fn max_price_cents_sane_upper_bound() {
|
| 307 |
|
- |
// Should not exceed $100,000
|
| 308 |
|
- |
assert!(MAX_PRICE_CENTS <= 10_000_000);
|
| 309 |
|
- |
}
|
| 310 |
|
- |
|
| 311 |
|
- |
#[test]
|
| 312 |
|
- |
fn min_subscription_price_positive() {
|
| 313 |
|
- |
assert!(MIN_SUBSCRIPTION_PRICE_CENTS > 0);
|
| 314 |
|
- |
}
|
| 315 |
|
- |
|
| 316 |
|
- |
#[test]
|
| 317 |
|
- |
fn min_subscription_price_below_max() {
|
| 318 |
|
- |
assert!(MIN_SUBSCRIPTION_PRICE_CENTS < MAX_PRICE_CENTS);
|
| 319 |
|
- |
}
|
| 320 |
|
- |
|
| 321 |
|
- |
// -- Stripe fee constants --
|
| 322 |
|
- |
|
| 323 |
|
- |
#[test]
|
| 324 |
|
- |
fn stripe_fee_percentage_reasonable() {
|
| 325 |
|
- |
assert!(STRIPE_FEE_PERCENTAGE > 0.0);
|
| 326 |
|
- |
assert!(STRIPE_FEE_PERCENTAGE < 0.5); // less than 50%
|
| 327 |
|
- |
}
|
| 328 |
|
- |
|
| 329 |
|
- |
#[test]
|
| 330 |
|
- |
fn stripe_fee_fixed_positive() {
|
| 331 |
|
- |
assert!(STRIPE_FEE_FIXED_CENTS > 0.0);
|
| 332 |
|
- |
}
|
| 333 |
|
- |
|
| 334 |
|
- |
// -- Database pool --
|
| 335 |
|
- |
|
| 336 |
|
- |
#[test]
|
| 337 |
|
- |
fn db_pool_max_exceeds_min() {
|
| 338 |
|
- |
assert!(DB_POOL_MAX_CONNECTIONS > DB_POOL_MIN_CONNECTIONS);
|
| 339 |
|
- |
}
|
| 340 |
|
- |
|
| 341 |
|
- |
#[test]
|
| 342 |
|
- |
fn db_pool_min_positive() {
|
| 343 |
|
- |
assert!(DB_POOL_MIN_CONNECTIONS > 0);
|
| 344 |
|
- |
}
|
| 345 |
|
- |
|
| 346 |
|
- |
#[test]
|
| 347 |
|
- |
fn db_acquire_timeout_positive() {
|
| 348 |
|
- |
assert!(DB_ACQUIRE_TIMEOUT_SECS > 0);
|
| 349 |
|
- |
}
|
| 350 |
|
- |
|
| 351 |
|
- |
#[test]
|
| 352 |
|
- |
fn db_max_lifetime_exceeds_idle_timeout() {
|
| 353 |
|
- |
assert!(DB_MAX_LIFETIME_SECS > DB_IDLE_TIMEOUT_SECS);
|
| 354 |
|
- |
}
|
| 355 |
|
- |
|
| 356 |
|
- |
// -- Session constants --
|
| 357 |
|
- |
|
| 358 |
|
- |
#[test]
|
| 359 |
|
- |
fn session_expiry_positive() {
|
| 360 |
|
- |
assert!(SESSION_EXPIRY_DAYS > 0);
|
| 361 |
|
- |
}
|
| 362 |
|
- |
|
| 363 |
|
- |
#[test]
|
| 364 |
|
- |
fn session_expiry_not_absurd() {
|
| 365 |
|
- |
assert!(SESSION_EXPIRY_DAYS <= 365);
|
| 366 |
|
- |
}
|
| 367 |
|
- |
|
| 368 |
|
- |
#[test]
|
| 369 |
|
- |
fn session_touch_cache_positive() {
|
| 370 |
|
- |
assert!(SESSION_TOUCH_CACHE_SECS > 0);
|
| 371 |
|
- |
}
|
| 372 |
|
- |
|
| 373 |
|
- |
#[test]
|
| 374 |
|
- |
fn session_touch_cache_less_than_one_day() {
|
| 375 |
|
- |
assert!(SESSION_TOUCH_CACHE_SECS < 86400);
|
| 376 |
|
- |
}
|
| 377 |
|
- |
|
| 378 |
|
- |
// -- Login security --
|
| 379 |
|
- |
|
| 380 |
|
- |
#[test]
|
| 381 |
|
- |
fn max_login_attempts_positive() {
|
| 382 |
|
- |
assert!(MAX_LOGIN_ATTEMPTS > 0);
|
| 383 |
|
- |
}
|
| 384 |
|
- |
|
| 385 |
|
- |
#[test]
|
| 386 |
|
- |
fn lockout_minutes_positive() {
|
| 387 |
|
- |
assert!(LOCKOUT_MINUTES > 0);
|
| 388 |
|
- |
}
|
| 389 |
|
- |
|
| 390 |
|
- |
// -- Email link expiry ordering --
|
| 391 |
|
- |
|
| 392 |
|
- |
#[test]
|
| 393 |
|
- |
fn password_reset_expiry_positive() {
|
| 394 |
|
- |
assert!(PASSWORD_RESET_EXPIRY_SECS > 0);
|
| 395 |
|
- |
}
|
| 396 |
|
- |
|
| 397 |
|
- |
#[test]
|
| 398 |
|
- |
fn email_verification_longer_than_password_reset() {
|
| 399 |
|
- |
assert!(EMAIL_VERIFICATION_EXPIRY_SECS > PASSWORD_RESET_EXPIRY_SECS);
|
| 400 |
|
- |
}
|
| 401 |
|
- |
|
| 402 |
|
- |
#[test]
|
| 403 |
|
- |
fn account_deletion_expiry_positive() {
|
| 404 |
|
- |
assert!(ACCOUNT_DELETION_EXPIRY_SECS > 0);
|
| 405 |
|
- |
}
|
| 406 |
|
- |
|
| 407 |
|
- |
// -- Scheduler --
|
| 408 |
|
- |
|
| 409 |
|
- |
#[test]
|
| 410 |
|
- |
fn scheduler_interval_positive() {
|
| 411 |
|
- |
assert!(SCHEDULER_INTERVAL_SECS > 0);
|
| 412 |
|
- |
}
|
| 413 |
|
- |
|
| 414 |
|
- |
// -- Rate limit bursts all positive --
|
| 415 |
|
- |
|
| 416 |
|
- |
#[test]
|
| 417 |
|
- |
fn auth_rate_limit_burst_positive() {
|
| 418 |
|
- |
assert!(AUTH_RATE_LIMIT_BURST > 0);
|
| 419 |
|
- |
}
|
| 420 |
|
- |
|
| 421 |
|
- |
#[test]
|
| 422 |
|
- |
fn validate_rate_limit_burst_positive() {
|
| 423 |
|
- |
assert!(VALIDATE_RATE_LIMIT_BURST > 0);
|
| 424 |
|
- |
}
|
| 425 |
|
- |
|
| 426 |
|
- |
#[test]
|
| 427 |
|
- |
fn api_write_rate_limit_burst_positive() {
|
| 428 |
|
- |
assert!(API_WRITE_RATE_LIMIT_BURST > 0);
|
| 429 |
|
- |
}
|
| 430 |
|
- |
|
| 431 |
|
- |
#[test]
|
| 432 |
|
- |
fn api_read_rate_limit_burst_positive() {
|
| 433 |
|
- |
assert!(API_READ_RATE_LIMIT_BURST > 0);
|
| 434 |
|
- |
}
|
| 435 |
|
- |
|
| 436 |
|
- |
#[test]
|
| 437 |
|
- |
fn api_export_rate_limit_burst_positive() {
|
| 438 |
|
- |
assert!(API_EXPORT_RATE_LIMIT_BURST > 0);
|
| 439 |
|
- |
}
|
| 440 |
|
- |
|
| 441 |
|
- |
#[test]
|
| 442 |
|
- |
fn license_key_rate_limit_burst_positive() {
|
| 443 |
|
- |
assert!(LICENSE_KEY_RATE_LIMIT_BURST > 0);
|
| 444 |
|
- |
}
|
| 445 |
|
- |
|
| 446 |
|
- |
#[test]
|
| 447 |
|
- |
fn upload_rate_limit_burst_positive() {
|
| 448 |
|
- |
assert!(UPLOAD_RATE_LIMIT_BURST > 0);
|
| 449 |
|
- |
}
|
| 450 |
|
- |
|
| 451 |
|
- |
#[test]
|
| 452 |
|
- |
fn oauth_rate_limit_burst_positive() {
|
| 453 |
|
- |
assert!(OAUTH_RATE_LIMIT_BURST > 0);
|
| 454 |
|
- |
}
|
| 455 |
|
- |
|
| 456 |
|
- |
#[test]
|
| 457 |
|
- |
fn oauth_token_rate_limit_burst_positive() {
|
| 458 |
|
- |
assert!(OAUTH_TOKEN_RATE_LIMIT_BURST > 0);
|
| 459 |
|
- |
}
|
| 460 |
|
- |
|
| 461 |
|
- |
// -- Rate limit burst ordering: read > write > auth --
|
| 462 |
|
- |
|
| 463 |
|
- |
#[test]
|
| 464 |
|
- |
fn api_read_burst_exceeds_write_burst() {
|
| 465 |
|
- |
assert!(API_READ_RATE_LIMIT_BURST > API_WRITE_RATE_LIMIT_BURST);
|
| 466 |
|
- |
}
|
| 467 |
|
- |
|
| 468 |
|
- |
#[test]
|
| 469 |
|
- |
fn api_write_burst_exceeds_auth_burst() {
|
| 470 |
|
- |
assert!(API_WRITE_RATE_LIMIT_BURST > AUTH_RATE_LIMIT_BURST);
|
| 471 |
|
- |
}
|
| 472 |
|
- |
|
| 473 |
|
- |
// -- Rate limit intervals positive --
|
| 474 |
|
- |
|
| 475 |
|
- |
#[test]
|
| 476 |
|
- |
fn auth_rate_limit_ms_positive() {
|
| 477 |
|
- |
assert!(AUTH_RATE_LIMIT_MS > 0);
|
| 478 |
|
- |
}
|
| 479 |
|
- |
|
| 480 |
|
- |
#[test]
|
| 481 |
|
- |
fn api_write_rate_limit_ms_positive() {
|
| 482 |
|
- |
assert!(API_WRITE_RATE_LIMIT_MS > 0);
|
| 483 |
|
- |
}
|
| 484 |
|
- |
|
| 485 |
|
- |
#[test]
|
| 486 |
|
- |
fn api_read_rate_limit_ms_positive() {
|
| 487 |
|
- |
assert!(API_READ_RATE_LIMIT_MS > 0);
|
| 488 |
|
- |
}
|
| 489 |
|
- |
|
| 490 |
|
- |
// -- File size limits --
|
| 491 |
|
- |
|
| 492 |
|
- |
#[test]
|
| 493 |
|
- |
fn scan_max_memory_positive() {
|
| 494 |
|
- |
assert!(SCAN_MAX_MEMORY_BYTES > 0);
|
| 495 |
|
- |
}
|
| 496 |
|
- |
|
| 497 |
|
- |
#[test]
|
| 498 |
|
- |
fn scan_spool_reserve_below_max() {
|
| 499 |
|
- |
assert!(SCAN_SPOOL_FREE_RESERVE_BYTES < SCAN_SPOOL_MAX_BYTES);
|
| 500 |
|
- |
}
|
| 501 |
|
- |
|
| 502 |
|
- |
#[test]
|
| 503 |
|
- |
fn scan_spool_max_exceeds_memory_threshold() {
|
| 504 |
|
- |
assert!(SCAN_SPOOL_MAX_BYTES > SCAN_MAX_MEMORY_BYTES as u64);
|
| 505 |
|
- |
}
|
| 506 |
|
- |
|
| 507 |
|
- |
#[test]
|
| 508 |
|
- |
fn scan_job_retention_days_safe_floor() {
|
| 509 |
|
- |
// Guards against an accidental same-day purge that would race the
|
| 510 |
|
- |
// worker stamping completed_at.
|
| 511 |
|
- |
assert!(SCAN_JOB_RETENTION_DAYS >= 7);
|
| 512 |
|
- |
}
|
| 513 |
|
- |
|
| 514 |
|
- |
#[test]
|
| 515 |
|
- |
fn broadcast_parallelism_sane() {
|
| 516 |
|
- |
assert!(BROADCAST_PARALLELISM > 0 && BROADCAST_PARALLELISM <= 64);
|
| 517 |
|
- |
}
|
| 518 |
|
- |
|
| 519 |
|
- |
#[test]
|
| 520 |
|
- |
fn scan_zip_max_uncompressed_exceeds_memory_threshold() {
|
| 521 |
|
- |
assert!(SCAN_ZIP_MAX_UNCOMPRESSED > SCAN_MAX_MEMORY_BYTES as u64);
|
| 522 |
|
- |
}
|
| 523 |
|
- |
|
| 524 |
|
- |
#[test]
|
| 525 |
|
- |
fn git_raw_max_exceeds_file_display_limit() {
|
| 526 |
|
- |
assert!(GIT_RAW_MAX_BYTES > GIT_MAX_FILE_SIZE_BYTES);
|
| 527 |
|
- |
}
|
| 528 |
|
- |
|
| 529 |
|
- |
#[test]
|
| 530 |
|
- |
fn scan_zip_max_ratio_positive() {
|
| 531 |
|
- |
assert!(SCAN_ZIP_MAX_RATIO > 0.0);
|
| 532 |
|
- |
}
|
| 533 |
|
- |
|
| 534 |
|
- |
#[test]
|
| 535 |
|
- |
fn scan_zip_max_depth_positive() {
|
| 536 |
|
- |
assert!(SCAN_ZIP_MAX_DEPTH > 0);
|
| 537 |
|
- |
}
|
| 538 |
|
- |
|
| 539 |
|
- |
// -- SyncKit --
|
| 540 |
|
- |
|
| 541 |
|
- |
#[test]
|
| 542 |
|
- |
fn synckit_push_max_changes_positive() {
|
| 543 |
|
- |
assert!(SYNCKIT_PUSH_MAX_CHANGES > 0);
|
| 544 |
|
- |
}
|
| 545 |
|
- |
|
| 546 |
|
- |
#[test]
|
| 547 |
|
- |
fn synckit_pull_page_size_positive() {
|
| 548 |
|
- |
assert!(SYNCKIT_PULL_PAGE_SIZE > 0);
|
| 549 |
|
- |
}
|
| 550 |
|
- |
|
| 551 |
|
- |
#[test]
|
| 552 |
|
- |
fn synckit_max_blob_size_positive() {
|
| 553 |
|
- |
assert!(SYNCKIT_MAX_BLOB_SIZE_BYTES > 0);
|
| 554 |
|
- |
}
|
| 555 |
|
- |
|
| 556 |
|
- |
#[test]
|
| 557 |
|
- |
fn synckit_jwt_expiry_positive() {
|
| 558 |
|
- |
assert!(SYNCKIT_JWT_EXPIRY_SECS > 0);
|
| 559 |
|
- |
}
|
| 560 |
|
- |
|
| 561 |
|
- |
// -- TOTP --
|
| 562 |
|
- |
|
| 563 |
|
- |
#[test]
|
| 564 |
|
- |
fn totp_digits_is_six() {
|
| 565 |
|
- |
assert_eq!(TOTP_DIGITS, 6);
|
| 566 |
|
- |
}
|
| 567 |
|
- |
|
| 568 |
|
- |
#[test]
|
| 569 |
|
- |
fn totp_step_is_30() {
|
| 570 |
|
- |
assert_eq!(TOTP_STEP, 30);
|
| 571 |
|
- |
}
|
| 572 |
|
- |
|
| 573 |
|
- |
#[test]
|
| 574 |
|
- |
fn backup_code_count_positive() {
|
| 575 |
|
- |
assert!(BACKUP_CODE_COUNT > 0);
|
| 576 |
|
- |
}
|
| 577 |
|
- |
|
| 578 |
|
- |
#[test]
|
| 579 |
|
- |
fn backup_code_length_positive() {
|
| 580 |
|
- |
assert!(BACKUP_CODE_LENGTH > 0);
|
| 581 |
|
- |
}
|
| 582 |
|
- |
|
| 583 |
|
- |
// -- Pagination --
|
| 584 |
|
- |
|
| 585 |
|
- |
#[test]
|
| 586 |
|
- |
fn discover_page_size_positive() {
|
| 587 |
|
- |
assert!(DISCOVER_PAGE_SIZE > 0);
|
| 588 |
|
- |
}
|
| 589 |
|
- |
|
| 590 |
|
- |
#[test]
|
| 591 |
|
- |
fn feed_page_size_positive() {
|
| 592 |
|
- |
assert!(FEED_PAGE_SIZE > 0);
|
| 593 |
|
- |
}
|
| 594 |
|
- |
|
| 595 |
|
- |
#[test]
|
| 596 |
|
- |
fn pagination_window_size_positive() {
|
| 597 |
|
- |
assert!(PAGINATION_WINDOW_SIZE > 0);
|
| 598 |
|
- |
}
|
| 599 |
|
- |
|
| 600 |
|
- |
// -- String constants non-empty --
|
| 601 |
|
- |
|
| 602 |
|
- |
#[test]
|
| 603 |
|
- |
fn date_formats_non_empty() {
|
| 604 |
|
- |
assert!(!DATE_FMT_SHORT.is_empty());
|
| 605 |
|
- |
assert!(!DATE_FMT_FULL.is_empty());
|
| 606 |
|
- |
assert!(!DATE_FMT_ISO.is_empty());
|
| 607 |
|
- |
assert!(!DATE_FMT_DATETIME.is_empty());
|
| 608 |
|
- |
assert!(!DATE_FMT_DATETIME_UTC.is_empty());
|
| 609 |
|
- |
}
|
| 610 |
|
- |
|
| 611 |
|
- |
#[test]
|
| 612 |
|
- |
fn changelog_project_slug_non_empty() {
|
| 613 |
|
- |
assert!(!CHANGELOG_PROJECT_SLUG.is_empty());
|
| 614 |
|
- |
}
|
| 615 |
|
- |
|
| 616 |
|
- |
#[test]
|
| 617 |
|
- |
fn build_allowed_targets_non_empty() {
|
| 618 |
|
- |
assert!(!BUILD_ALLOWED_TARGETS.is_empty());
|
|
425 |
+ |
fn build_allowed_targets_are_os_slash_arch() {
|
| 619 |
426 |
|
for target in BUILD_ALLOWED_TARGETS {
|
| 620 |
427 |
|
assert!(!target.is_empty());
|
| 621 |
|
- |
assert!(target.contains('/'), "target should be os/arch format: {}", target);
|
|
428 |
+ |
assert!(target.contains('/'), "target should be os/arch format: {target}");
|
| 622 |
429 |
|
}
|
| 623 |
430 |
|
}
|
| 624 |
|
- |
|
| 625 |
|
- |
// -- Collections --
|
| 626 |
|
- |
|
| 627 |
|
- |
#[test]
|
| 628 |
|
- |
fn max_collections_per_user_positive() {
|
| 629 |
|
- |
assert!(MAX_COLLECTIONS_PER_USER > 0);
|
| 630 |
|
- |
}
|
| 631 |
|
- |
|
| 632 |
|
- |
#[test]
|
| 633 |
|
- |
fn max_items_per_collection_positive() {
|
| 634 |
|
- |
assert!(MAX_ITEMS_PER_COLLECTION > 0);
|
| 635 |
|
- |
}
|
| 636 |
|
- |
|
| 637 |
|
- |
// -- Build pipeline --
|
| 638 |
|
- |
|
| 639 |
|
- |
#[test]
|
| 640 |
|
- |
fn build_timeout_positive() {
|
| 641 |
|
- |
assert!(BUILD_TIMEOUT_SECS > 0);
|
| 642 |
|
- |
}
|
| 643 |
|
- |
|
| 644 |
|
- |
#[test]
|
| 645 |
|
- |
fn build_max_log_bytes_positive() {
|
| 646 |
|
- |
assert!(BUILD_MAX_LOG_BYTES > 0);
|
| 647 |
|
- |
}
|
| 648 |
|
- |
|
| 649 |
|
- |
// -- Health monitoring --
|
| 650 |
|
- |
|
| 651 |
|
- |
#[test]
|
| 652 |
|
- |
fn health_check_interval_positive() {
|
| 653 |
|
- |
assert!(HEALTH_CHECK_INTERVAL_SECS > 0);
|
| 654 |
|
- |
}
|
| 655 |
|
- |
|
| 656 |
|
- |
#[test]
|
| 657 |
|
- |
fn alert_cooldown_exceeds_health_check() {
|
| 658 |
|
- |
assert!(ALERT_COOLDOWN_SECS > HEALTH_CHECK_INTERVAL_SECS);
|
| 659 |
|
- |
}
|
| 660 |
|
- |
|
| 661 |
|
- |
// -- Sandbox --
|
| 662 |
|
- |
|