|
388 | 388 | ;; reindexed when ingest detects the acl hash has change. |
389 | 389 | (deftest acl-change-test |
390 | 390 | (let [coll1 (d/ingest "PROV1" (dc/collection-dif10 {:entry-title "coll1"}) {:format :dif10 :validate-keywords false}) |
391 | | - ;_ (println "coll1 = " coll1) |
392 | | - ;coll2-umm (dc/collection {:entry-title "coll2" :short-name "short1"}) |
393 | | - ;coll2-1 (d/ingest "PROV1" coll2-umm {:validate-keywords false}) |
394 | | - ;;; 2 versions of collection 2 will allow us to test the force reindex option after we |
395 | | - ;;; force delete the latest version of coll2-2 |
396 | | - ;coll2-2 (d/ingest "PROV1" (assoc-in coll2-umm [:product :short-name] "short2") {:validate-keywords false}) |
| 391 | + coll2-umm (dc/collection {:entry-title "coll2" :short-name "short1"}) |
| 392 | + coll2-1 (d/ingest "PROV1" coll2-umm {:validate-keywords false}) |
| 393 | + ;; 2 versions of collection 2 will allow us to test the force reindex option after we |
| 394 | + ;; force delete the latest version of coll2-2 |
| 395 | + coll2-2 (d/ingest "PROV1" (assoc-in coll2-umm [:product :short-name] "short2") {:validate-keywords false}) |
397 | 396 | coll3 (d/ingest "PROV2" (dc/collection-dif10 {:entry-title "coll3"}) {:format :dif10 :validate-keywords false}) |
398 | | - ;_ (println "coll3 = " coll3) |
399 | | - ;coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false}) |
400 | | - ; |
401 | | - ;_ (index/wait-until-indexed) |
| 397 | + coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false}) |
| 398 | + |
| 399 | + _ (index/wait-until-indexed) |
402 | 400 | acl1 (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV1" (e/coll-id ["coll1"]))) |
403 | | - acl2 (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll3"]))) |
404 | | - ] |
| 401 | + acl2 (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll3"])))] |
405 | 402 |
|
406 | 403 | (testing "normal reindex collection permitted groups" |
407 | | - (println "TEST start") |
408 | | - ;(ingest/reindex-collection-permitted-groups (tc/echo-system-token)) |
409 | | - ;(index/wait-until-indexed) |
410 | | - ; |
411 | | - ;(println "TEST finished reindex-collection-permitted-groups") |
412 | | - ; |
413 | | - ;;; before acls change |
| 404 | + (ingest/reindex-collection-permitted-groups (tc/echo-system-token)) |
| 405 | + (index/wait-until-indexed) |
| 406 | + |
| 407 | + ;; before acls change |
| 408 | + (d/assert-refs-match [coll1 coll3] (search/find-refs :collection {})) |
| 409 | + |
| 410 | + ; Grant collection 2 |
| 411 | + (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV1" (e/coll-id ["coll2"]))) |
| 412 | + |
| 413 | + ; Ungrant collection 3 |
| 414 | + (e/ungrant (s/context) acl2) |
| 415 | + |
| 416 | + ; Try searching again before the reindexing |
414 | 417 | (d/assert-refs-match [coll1 coll3] (search/find-refs :collection {})) |
415 | | - ;(println "TEST finished first refs-match") |
416 | 418 |
|
417 | | - ;; EXPECTED |
418 | | - ;; {{:id "C1200000013-PROV1", |
419 | | - ; :location "http://localhost:3003/concepts/C1200000013-PROV1/1", |
420 | | - ; :name "coll1", |
421 | | - ; :revision-id 1} |
422 | | - ; {:id "C1200000015-PROV2", |
423 | | - ; :location "http://localhost:3003/concepts/C1200000015-PROV2/1", |
424 | | - ; :name "coll3", |
425 | | - ; :revision-id 1}} |
| 419 | + ; Reindex collection permitted groups |
| 420 | + (ingest/reindex-collection-permitted-groups (tc/echo-system-token)) |
| 421 | + (index/wait-until-indexed) |
426 | 422 |
|
427 | | - ;; Grant collection 2 |
428 | | - ;(e/grant-guest (s/context) (e/coll-catalog-item-id "PROV1" (e/coll-id ["coll2"]))) |
429 | | - ;(println "TEST finished grant guest") |
| 423 | + ; Search after reindexing |
| 424 | + (d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {}))) |
430 | 425 |
|
431 | | - ;; Ungrant collection 3 |
432 | | - ;(e/ungrant (s/context) acl2) |
433 | | - ;(println "TEST finished ungrant") |
| 426 | + (testing "reindex all collections" |
434 | 427 |
|
435 | | - ;; Try searching again before the reindexing |
436 | | - ;(d/assert-refs-match [coll1 coll3] (search/find-refs :collection {})) |
437 | | - ;(println "TEST finished refs match 2") |
| 428 | + ;; Grant collection 4 |
| 429 | + (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll4"]))) |
438 | 430 |
|
439 | | - ;; Reindex collection permitted groups |
440 | | - ;(ingest/reindex-collection-permitted-groups (tc/echo-system-token)) |
441 | | - ;(index/wait-until-indexed) |
442 | | - ; |
443 | | - ;(println "TEST finished reindex-collection-permitted-groups 2") |
| 431 | + ;; Try before reindexing |
| 432 | + (d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {})) |
444 | 433 |
|
| 434 | + ;; Reindex all collections |
| 435 | + ;; Manually check the logs. It should say it's reindexing provider 1 and provider 3 as well. |
| 436 | + (ingest/reindex-all-collections) |
| 437 | + (index/wait-until-indexed) |
445 | 438 |
|
446 | 439 | ;; Search after reindexing |
447 | | - ;(d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {})) |
448 | | - ;(println "TEST finished assert-refs-match 3") |
449 | | - |
450 | | - ) |
451 | | - |
452 | | - ;(testing "reindex all collections" |
453 | | - ; |
454 | | - ; ;; Grant collection 4 |
455 | | - ; (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll4"]))) |
456 | | - ; |
457 | | - ; ;; Try before reindexing |
458 | | - ; (d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {})) |
459 | | - ; |
460 | | - ; ;; Reindex all collections |
461 | | - ; ;; Manually check the logs. It should say it's reindexing provider 1 and provider 3 as well. |
462 | | - ; (ingest/reindex-all-collections) |
463 | | - ; (index/wait-until-indexed) |
464 | | - ; |
465 | | - ; ;; Search after reindexing |
466 | | - ; (d/assert-refs-match [coll1 coll2-2 coll4] (search/find-refs :collection {}))) |
467 | | - |
468 | | - )) |
| 440 | + (d/assert-refs-match [coll1 coll2-2 coll4] (search/find-refs :collection {}))))) |
469 | 441 |
|
470 | 442 | ;; Verifies that tokens are cached by checking that a logged out token still works after it was |
471 | 443 | ;; used. This isn't the desired behavior. It's just a side effect that shows it's working. |
|
0 commit comments