diff options
Diffstat (limited to 'tests/substitute.scm')
| -rw-r--r-- | tests/substitute.scm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/substitute.scm b/tests/substitute.scm index 8f32bfa7281..b749561347a 100644 --- a/tests/substitute.scm +++ b/tests/substitute.scm | |||
| @@ -357,6 +357,29 @@ Deriver: foo.drv") | |||
| 357 | (lambda () | 357 | (lambda () |
| 358 | (guix-substitute "--query"))))))))) | 358 | (guix-substitute "--query"))))))))) |
| 359 | 359 | ||
| 360 | (test-equal "query narinfo that returns different store path" | ||
| 361 | ;; The narinfo is valid and authorized but its 'StorePath' field points to a | ||
| 362 | ;; different store item. | ||
| 363 | "" | ||
| 364 | |||
| 365 | (let ((prefix (string-append "StorePath: " (%store-prefix) | ||
| 366 | "/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-BAR | ||
| 367 | NarHash: sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | ||
| 368 | References: bar baz\n"))) | ||
| 369 | (with-narinfo (string-append prefix | ||
| 370 | "Signature: " (signature-field prefix) " | ||
| 371 | URL: example.nar | ||
| 372 | Compression: none | ||
| 373 | NarSize: 42 | ||
| 374 | Deriver: foo.drv") | ||
| 375 | (string-trim-both | ||
| 376 | (with-output-to-string | ||
| 377 | (lambda () | ||
| 378 | (with-input-from-string (string-append "have " (%store-prefix) | ||
| 379 | "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") | ||
| 380 | (lambda () | ||
| 381 | (guix-substitute "--query"))))))))) | ||
| 382 | |||
| 360 | (test-equal "query narinfo signed with authorized key" | 383 | (test-equal "query narinfo signed with authorized key" |
| 361 | (string-append (%store-prefix) "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") | 384 | (string-append (%store-prefix) "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") |
| 362 | 385 | ||
| @@ -893,6 +916,18 @@ System: mips64el-linux\n"))) | |||
| 893 | (lambda () | 916 | (lambda () |
| 894 | (false-if-exception (delete-file "substitute-retrieved"))))))) | 917 | (false-if-exception (delete-file "substitute-retrieved"))))))) |
| 895 | 918 | ||
| 919 | (test-quit "substitute, narinfo does not match requested store item" | ||
| 920 | "no valid substitute" | ||
| 921 | (with-http-server `((200 ,(string-append %narinfo "Signature: " | ||
| 922 | (signature-field %narinfo)))) | ||
| 923 | (parameterize ((substitute-urls (list (%local-url)))) | ||
| 924 | ;; Narinfo is valid, signed, and authorized but requested item is | ||
| 925 | ;; /bbb…-bar and narinfo is for /aaa…-foo. | ||
| 926 | (request-substitution (string-append (%store-prefix) | ||
| 927 | "/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-bar") | ||
| 928 | "substitute-retrieved") | ||
| 929 | #f))) | ||
| 930 | |||
| 896 | (test-end "substitute") | 931 | (test-end "substitute") |
| 897 | 932 | ||
| 898 | ;;; Local Variables: | 933 | ;;; Local Variables: |
