Skip to content

Commit 31f5afb

Browse files
committed
CMR-11368 - bamboo test 4
1 parent feb2b98 commit 31f5afb

2 files changed

Lines changed: 26 additions & 38 deletions

File tree

system-int-test/test/cmr/system_int_test/access_control/acl_search_test.clj

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
(fixtures/grant-all-acl-fixture))
2121
(use-fixtures :once (fixtures/int-test-fixtures))
2222

23-
(deftest ^:disruptive ^:serial invalid-search-test
23+
(deftest ^:serial invalid-search-test
2424
(testing "Accept header"
2525
(testing "Other than JSON is rejected"
2626
(is (= {:status 400
@@ -59,14 +59,7 @@
5959
[{} 0]
6060
(partition 2 group-permissions))))
6161

62-
(comment
63-
64-
(generate-query-map-for-group-permissions
65-
["guest" "read" "AG10000-PROV1" "create" "registered" "order"])
66-
67-
)
68-
69-
(deftest ^:disruptive ^:serial acl-search-order-test
62+
(deftest ^:serial acl-search-order-test
7063
;; Conforms to requirements set out in CMR-3590, alphabetical order regardless of case
7164
(let [token (e/login (u/conn-context) "user1")
7265
acl1 (u/ingest-acl token {:group_permissions [{:user_type "registered" :permissions ["read"]}]
@@ -92,7 +85,7 @@
9285
"System - GROUP"]
9386
(map :name (:items (ac/search-for-acls (merge {:token token} (u/conn-context)) {})))))))
9487

95-
(deftest ^:disruptive ^:serial acl-search-permission-test
88+
(deftest ^:serial acl-search-permission-test
9689
(let [_token (e/login (u/conn-context) "user1")
9790
admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
9891
group1 (u/ingest-group admin-token
@@ -171,7 +164,7 @@
171164
(is (= (u/acls->search-response 1 [acl7])
172165
(dissoc response :took)))))))
173166

174-
(deftest ^:disruptive ^:serial acl-search-test
167+
(deftest ^:serial acl-search-test
175168
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
176169
group1 (u/ingest-group admin-token
177170
{:name "group1"}
@@ -278,7 +271,7 @@
278271
{:page_size 3 :page_num 2}
279272
{:token admin-token}) :took))))))
280273

281-
(deftest ^:disruptive ^:serial acl-search-by-any-id-test
274+
(deftest ^:serial acl-search-by-any-id-test
282275
(let [token (e/login (u/conn-context) "user1")
283276
acl1 (u/ingest-acl token (u/catalog-item-acl "All Collections"))
284277
acl2 (u/ingest-acl token (u/catalog-item-acl "All Granules"))
@@ -304,14 +297,10 @@
304297
(:concept-id acl2)
305298
"acl3-legacy-guid"]})))
306299

307-
(deftest ^:disruptive ^:serial acl-search-permitted-group-test
300+
(deftest ^:serial acl-search-permitted-group-test
308301
(declare group-permissions acls query-map)
309302
(u/without-publishing-messages
310-
(println "🚀 --------------------------------")
311-
(println "🚀 - here outside of let")
312-
(let [_ (println "🚀 - here inside of let")
313-
token (e/login (u/conn-context) "user1")
314-
_ (println "🚀 - here about to do things")
303+
(let [token (e/login (u/conn-context) "user1")
315304
acl1 (u/ingest-acl token (assoc (u/system-acl "SYSTEM_AUDIT_REPORT")
316305
:group_permissions
317306
[{:user_type "guest" :permissions ["read"]}]))
@@ -349,8 +338,7 @@
349338
AG10000-acls [acl8]
350339
read-acls (into [fixtures/*fixture-system-acl* fixtures/*fixture-provider-acl* acl1 acl2 acl3 acl4 acl8] provider-group-acls)
351340
create-acls (into [fixtures/*fixture-system-acl* fixtures/*fixture-provider-acl* acl3 acl5 acl7 acl8] provider-group-acls)
352-
all-acls-no-admin [fixtures/*fixture-system-acl* fixtures/*fixture-provider-acl* acl1 acl2 acl3 acl4 acl5 acl6 acl7 acl8]
353-
_ (println "🚀 - last thing in let")]
341+
all-acls-no-admin [fixtures/*fixture-system-acl* fixtures/*fixture-provider-acl* acl1 acl2 acl3 acl4 acl5 acl6 acl7 acl8]]
354342

355343
;; AI note: passes
356344
(testing "Search ACLs by permitted group"
@@ -384,7 +372,7 @@
384372
["GUEST"] {"options[permitted_group][ignore_case]" false} []))
385373

386374
;; AI note: not passing
387-
(comment testing "Search ACLs by group permission"
375+
(testing "Search ACLs by group permission"
388376
(are3 [group-permissions acls]
389377
(let [query-map (generate-query-map-for-group-permissions group-permissions)
390378
response (ac/search-for-acls (u/conn-context) query-map {:token token})]
@@ -430,7 +418,7 @@
430418

431419
;; AI note: failing
432420
;; CMR-3154 acceptance criterium 3
433-
(comment testing "Search ACLs by group permission just group or permission"
421+
(testing "Search ACLs by group permission just group or permission"
434422
(are3 [msg query-map acls]
435423
(let [response (ac/search-for-acls (u/conn-context)
436424
{:group-permission {:0 query-map} :page_size 20}
@@ -464,22 +452,22 @@
464452

465453
;; AI note: failing
466454
;; CMR-3154 acceptance criterium 5
467-
(comment testing "Search ACLS by group permission with subfield other than permitted_group or permission is an error"
455+
(testing "Search ACLS by group permission with subfield other than permitted_group or permission is an error"
468456
(let [query {:group-permission {:0 {:allowed-group "guest" :permission "read"}}}]
469457
(is (= {:status 400
470458
:body {:errors ["Parameter group_permission has invalid subfield [allowed_group]. Only 'permitted_group' and 'permission' are allowed."]}
471459
:content-type :json}
472460
(ac/search-for-acls (u/conn-context) query {:token token :raw? true})))))
473461

474462
;; AI note: failing
475-
(comment testing "Searching ACLS by group permission with permission values other than read, create, update, delete, or order is an error"
463+
(testing "Searching ACLS by group permission with permission values other than read, create, update, delete, or order is an error"
476464
(let [query {:group-permission {:0 {:permitted_group "guest" :permission "foo"}}}]
477465
(is (= {:status 400
478466
:body {:errors ["Sub-parameter permission of parameter group_permissions has invalid values [foo]. Only 'read', 'update', 'create', 'delete', or 'order' may be specified."]}
479467
:content-type :json}
480468
(ac/search-for-acls (u/conn-context) query {:token token :raw? true}))))))))
481469

482-
(deftest ^:disruptive ^:serial acl-search-by-identity-type-test
470+
(deftest ^:serial acl-search-by-identity-type-test
483471
(declare identity-types expected-acls)
484472
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
485473
group1 (u/ingest-group admin-token
@@ -528,7 +516,7 @@
528516
"Identity type searches are always case-insensitive"
529517
["PrOvIdEr"] (concat [fixtures/*fixture-provider-acl*] provider-group-acls)))))
530518

531-
(deftest ^:disruptive ^:serial acl-search-by-target-test
519+
(deftest ^:serial acl-search-by-target-test
532520
(declare target)
533521
(let [token (e/login (u/conn-context) "user1")
534522
single-instance-acl (u/ingest-acl token
@@ -552,7 +540,7 @@
552540
"Provider target, case insensitive"
553541
["catalog_item_acl"] [fixtures/*fixture-provider-acl*])))
554542

555-
(deftest ^:disruptive ^:serial acl-search-by-permitted-user-test
543+
(deftest ^:serial acl-search-by-permitted-user-test
556544
(declare user users)
557545
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
558546
group1 (u/ingest-group admin-token {:name "group1"} ["user1"])
@@ -616,7 +604,7 @@
616604
"User names are case-insensitive"
617605
["USER1"] [fixtures/*fixture-system-acl* fixtures/*fixture-provider-acl* acl-registered-1 acl-registered-2 acl-group1 acl-group2]))))
618606

619-
(deftest ^:disruptive ^:serial acl-search-provider-test
607+
(deftest ^:serial acl-search-provider-test
620608
(declare options provider-ids)
621609
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
622610
group1 (u/ingest-group admin-token {:name "group1"} ["user1"])
@@ -698,7 +686,7 @@
698686
"Multiple providers with empty results using ignore_case=false option"
699687
["prov1"] {"options[provider][ignore_case]" false} []))))
700688

701-
(deftest ^:disruptive ^:serial acl-search-multiple-criteria
689+
(deftest ^:serial acl-search-multiple-criteria
702690
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
703691
group1 (u/ingest-group admin-token {:name "group1"} ["user1"])
704692
group2 (u/ingest-group admin-token {:name "group2"} ["user2"])
@@ -766,7 +754,7 @@
766754
:permitted-user "user2"}
767755
[acl3 fixtures/*fixture-provider-acl* acl5 acl7]))))
768756

769-
(deftest ^:disruptive ^:serial acl-search-with-legacy-group-guid-test
757+
(deftest ^:serial acl-search-with-legacy-group-guid-test
770758
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
771759
group1-legacy-guid "group1-legacy-guid"
772760
group1 (u/ingest-group admin-token
@@ -827,7 +815,7 @@
827815
(is (= (u/acls->search-response (count expected-acls) expected-acls {:include-full-acl true})
828816
(dissoc response :took)))))))
829817

830-
(deftest ^:disruptive ^:serial acl-reindexing-test
818+
(deftest ^:serial acl-reindexing-test
831819
(u/without-publishing-messages
832820
(let [token (e/login (u/conn-context) "user1")
833821
acl1 (u/ingest-acl token (assoc (u/system-acl "METRIC_DATA_POINT_SAMPLE")
@@ -873,7 +861,7 @@
873861
(count expected-acls-after-reindexing) expected-acls-after-reindexing)))
874862
(set (:items actual-response))))))))
875863

876-
(deftest ^:disruptive ^:serial acl-search-by-target-group-id-test
864+
(deftest ^:serial acl-search-by-target-group-id-test
877865
(let [admin-token (e/login (u/conn-context) "admin" ["AG1200000000-CMR"])
878866
group1 (u/ingest-group admin-token
879867
{:name "group1"}

system-int-test/test/cmr/system_int_test/access_control/enable_disable_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
(e/login (u/conn-context) username))
4646

4747

48-
(deftest ^:disruptive ^:serial enable-disable-re-enable-write-acl
48+
(deftest ^:serial enable-disable-re-enable-write-acl
4949
(let [token (get-token "admin")
5050
first-resp (ac/create-acl (u/conn-context) system-acl {:raw? true :token token})
5151
concept-id (get-in first-resp [:body :concept_id])
@@ -63,7 +63,7 @@
6363

6464
;; disable writes for access control service
6565
(u/disable-access-control-writes post-options)
66-
(Thread/sleep 1000)
66+
(Thread/sleep 500)
6767

6868
(testing "save, update, and delete acl fails after disable"
6969
(try
@@ -77,7 +77,7 @@
7777
(finally
7878
;; always re-enable writes for access control service
7979
(u/enable-access-control-writes post-options)
80-
(Thread/sleep 1000))))
80+
(Thread/sleep 500))))
8181

8282
(testing "save, upate, and delete acl works after re-enable"
8383
(let [resp (ac/create-acl (u/conn-context) system-acl {:raw? true :token token})]
@@ -88,7 +88,7 @@
8888
;; test delete
8989
(is (= 200 (:status (ac/delete-acl (u/conn-context) concept-id2 {:token token :raw? true}))))))))
9090

91-
(deftest ^:disruptive ^:serial enable-disable-re-enable-write-group
91+
(deftest ^:serial enable-disable-re-enable-write-group
9292
(let [token (get-token "admin")
9393
group (u/make-group)
9494
{:keys [status concept_id]} (u/create-group token group)
@@ -106,7 +106,7 @@
106106

107107
;; disable writes for access control service and give threads time to catch up
108108
(u/disable-access-control-writes post-options)
109-
(Thread/sleep 5000)
109+
(Thread/sleep 500)
110110

111111
(testing "save, update, and delete group fails after disable"
112112
(try
@@ -121,7 +121,7 @@
121121
(finally
122122
;; Allways re-eneable writes for access control service, even if there was an exception
123123
(u/enable-access-control-writes post-options)
124-
(Thread/sleep 1000))))
124+
(Thread/sleep 500))))
125125

126126
(testing "save, update, and delete group succeeds after re-enable"
127127
(let [group3 (u/make-group {:name "group4" :members ["user1" "user5"]})

0 commit comments

Comments
 (0)