|
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 | | - 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}) |
| 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}) |
396 | 397 | coll3 (d/ingest "PROV2" (dc/collection-dif10 {:entry-title "coll3"}) {:format :dif10 :validate-keywords false}) |
397 | | - coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false}) |
398 | | - |
399 | | - _ (index/wait-until-indexed) |
| 398 | + ;_ (println "coll3 = " coll3) |
| 399 | + ;coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false}) |
| 400 | + ; |
| 401 | + ;_ (index/wait-until-indexed) |
400 | 402 | acl1 (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV1" (e/coll-id ["coll1"]))) |
401 | | - acl2 (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll3"])))] |
| 403 | + acl2 (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll3"]))) |
| 404 | + ] |
| 405 | + |
| 406 | + (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 |
| 414 | + (d/assert-refs-match [coll1 coll3] (search/find-refs :collection {})) |
| 415 | + ;(println "TEST finished first refs-match") |
| 416 | + |
| 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}} |
| 426 | + |
| 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") |
| 430 | + |
| 431 | + ;; Ungrant collection 3 |
| 432 | + ;(e/ungrant (s/context) acl2) |
| 433 | + ;(println "TEST finished ungrant") |
| 434 | + |
| 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") |
| 438 | + |
| 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") |
402 | 444 |
|
403 | | - ;(testing "normal reindex collection permitted groups" |
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 {})) |
| 445 | + |
| 446 | + ;; 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" |
409 | 453 | ; |
410 | | - ; ;; Grant collection 2 |
411 | | - ; (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV1" (e/coll-id ["coll2"]))) |
412 | | - ; ;; Ungrant collection 3 |
413 | | - ; (e/ungrant (s/context) acl2) |
| 454 | + ; ;; Grant collection 4 |
| 455 | + ; (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll4"]))) |
414 | 456 | ; |
415 | | - ; ;; Try searching again before the reindexing |
416 | | - ; (d/assert-refs-match [coll1 coll3] (search/find-refs :collection {})) |
| 457 | + ; ;; Try before reindexing |
| 458 | + ; (d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {})) |
417 | 459 | ; |
418 | | - ; ;; Reindex collection permitted groups |
419 | | - ; (ingest/reindex-collection-permitted-groups (tc/echo-system-token)) |
| 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) |
420 | 463 | ; (index/wait-until-indexed) |
421 | 464 | ; |
422 | 465 | ; ;; Search after reindexing |
423 | | - ; (d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {}))) |
424 | | - |
425 | | - (testing "reindex all collections" |
426 | | - |
427 | | - ;; Grant collection 4 |
428 | | - (e/grant-guest (s/context) (e/coll-catalog-item-id "PROV2" (e/coll-id ["coll4"]))) |
| 466 | + ; (d/assert-refs-match [coll1 coll2-2 coll4] (search/find-refs :collection {}))) |
429 | 467 |
|
430 | | - ;; Try before reindexing |
431 | | - (d/assert-refs-match [coll1 coll2-2] (search/find-refs :collection {})) |
432 | | - |
433 | | - ;; Reindex all collections |
434 | | - ;; Manually check the logs. It should say it's reindexing provider 1 and provider 3 as well. |
435 | | - (ingest/reindex-all-collections) |
436 | | - (index/wait-until-indexed) |
437 | | - |
438 | | - ;; Search after reindexing |
439 | | - (d/assert-refs-match [coll1 coll2-2 coll4] (search/find-refs :collection {}))))) |
| 468 | + )) |
440 | 469 |
|
441 | 470 | ;; Verifies that tokens are cached by checking that a logged out token still works after it was |
442 | 471 | ;; used. This isn't the desired behavior. It's just a side effect that shows it's working. |
|
0 commit comments