Skip to main content

max / makenotwork

tests: give ota release fixtures a valid-length signature The release-create route rejects signatures shorter than 40 chars (added with the minisign-signature hardening), but the ota tests still posted "s"/"sig"/etc., so every release-creating test 400'd. Add a TEST_SIGNATURE constant of realistic length and use it on the success paths; the semver-reject tests keep their empty signatures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-02 22:15 UTC
Commit: 5af43c0b6220cc5ba0740dec2e9c0bbefe386738
Parent: 896ba43
1 file changed, +18 insertions, -11 deletions
@@ -6,6 +6,13 @@ use serde::Deserialize;
6 6 use serde_json::json;
7 7 use sqlx::PgPool;
8 8
9 + /// The release-create route rejects signatures shorter than 40 chars (a real
10 + /// base64-encoded minisign signature is well over that), so any test that
11 + /// creates a release must supply a plausible-length one. Tests that assert the
12 + /// *reject* path use their own short/empty values inline.
13 + const TEST_SIGNATURE: &str =
14 + "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHNpZ25hdHVyZQoxYWJjZGVmZ2hpamtsbW5vcA==";
15 +
9 16 // ── Response types ──
10 17
11 18 #[derive(Deserialize)]
@@ -291,7 +298,7 @@ async fn create_and_list_releases() {
291 298 &json!({
292 299 "version": "0.2.1",
293 300 "notes": "Bug fixes",
294 - "signature": "dW50cnVzdGVkIGNvbW1lbnQ6..."
301 + "signature": TEST_SIGNATURE
295 302 })
296 303 .to_string(),
297 304 )
@@ -347,7 +354,7 @@ async fn duplicate_version() {
347 354 .client
348 355 .post_json(
349 356 &format!("/api/sync/ota/apps/{}/releases", app_id),
350 - &json!({ "version": "1.0.0", "notes": "first", "signature": "s" }).to_string(),
357 + &json!({ "version": "1.0.0", "notes": "first", "signature": TEST_SIGNATURE }).to_string(),
351 358 )
352 359 .await;
353 360 assert_eq!(resp.status, 201);
@@ -357,7 +364,7 @@ async fn duplicate_version() {
357 364 .client
358 365 .post_json(
359 366 &format!("/api/sync/ota/apps/{}/releases", app_id),
360 - &json!({ "version": "1.0.0", "notes": "duplicate", "signature": "s" }).to_string(),
367 + &json!({ "version": "1.0.0", "notes": "duplicate", "signature": TEST_SIGNATURE }).to_string(),
361 368 )
362 369 .await;
363 370 assert_eq!(resp.status, 409, "Duplicate version should return 409 Conflict: {}", resp.text);
@@ -376,7 +383,7 @@ async fn upload_artifact() {
376 383 &json!({
377 384 "version": "0.3.0",
378 385 "notes": "New release",
379 - "signature": "sig123"
386 + "signature": TEST_SIGNATURE
380 387 })
381 388 .to_string(),
382 389 )
@@ -436,7 +443,7 @@ async fn updater_check_newer_version() {
436 443 &json!({
437 444 "version": "1.2.0",
438 445 "notes": "Big update",
439 - "signature": "update-sig"
446 + "signature": TEST_SIGNATURE
440 447 })
441 448 .to_string(),
442 449 )
@@ -468,7 +475,7 @@ async fn updater_check_newer_version() {
468 475 assert_eq!(resp.status, 200, "Should return update: {}", resp.text);
469 476 let update: TauriUpdaterResponse = resp.json();
470 477 assert_eq!(update.version, "1.2.0");
471 - assert_eq!(update.signature, "update-sig");
478 + assert_eq!(update.signature, TEST_SIGNATURE);
472 479 assert_eq!(update.notes, "Big update");
473 480 assert!(update.url.contains("/download/"));
474 481 }
@@ -502,7 +509,7 @@ async fn updater_check_gated_until_artifact_clean() {
502 509 .client
503 510 .post_json(
504 511 &format!("/api/sync/ota/apps/{}/releases", app_id),
505 - &json!({ "version": "1.5.0", "notes": "", "signature": "sig" }).to_string(),
512 + &json!({ "version": "1.5.0", "notes": "", "signature": TEST_SIGNATURE }).to_string(),
506 513 )
507 514 .await;
508 515 assert_eq!(resp.status, 201);
@@ -555,7 +562,7 @@ async fn updater_check_no_update() {
555 562 .client
556 563 .post_json(
557 564 &format!("/api/sync/ota/apps/{}/releases", app_id),
558 - &json!({ "version": "1.0.0", "notes": "", "signature": "sig" }).to_string(),
565 + &json!({ "version": "1.0.0", "notes": "", "signature": TEST_SIGNATURE }).to_string(),
559 566 )
560 567 .await;
561 568 assert_eq!(resp.status, 201);
@@ -616,7 +623,7 @@ async fn updater_check_missing_platform() {
616 623 .client
617 624 .post_json(
618 625 &format!("/api/sync/ota/apps/{}/releases", app_id),
619 - &json!({ "version": "2.0.0", "notes": "", "signature": "s" }).to_string(),
626 + &json!({ "version": "2.0.0", "notes": "", "signature": TEST_SIGNATURE }).to_string(),
620 627 )
621 628 .await;
622 629 assert_eq!(resp.status, 201);
@@ -672,7 +679,7 @@ async fn artifact_download_redirect() {
672 679 .client
673 680 .post_json(
674 681 &format!("/api/sync/ota/apps/{}/releases", app_id),
675 - &json!({ "version": "1.0.0", "notes": "", "signature": "s" }).to_string(),
682 + &json!({ "version": "1.0.0", "notes": "", "signature": TEST_SIGNATURE }).to_string(),
676 683 )
677 684 .await;
678 685 assert_eq!(resp.status, 201);
@@ -726,7 +733,7 @@ async fn delete_release_cascades() {
726 733 .client
727 734 .post_json(
728 735 &format!("/api/sync/ota/apps/{}/releases", app_id),
729 - &json!({ "version": "1.0.0", "notes": "", "signature": "s" }).to_string(),
736 + &json!({ "version": "1.0.0", "notes": "", "signature": TEST_SIGNATURE }).to_string(),
730 737 )
731 738 .await;
732 739 assert_eq!(resp.status, 201);