Skip to content

Commit

Permalink
CMR-5098: Fix issue with test not deleting revisions from the databas…
Browse files Browse the repository at this point in the history
…e and remove validation from call to index-collections that prevented removing collection indexes for collections which do not exist in Oracle.
  • Loading branch information
chris-durbin authored and mschmele committed Sep 5, 2018
1 parent 87b2a13 commit a2785c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions bootstrap-app/src/cmr/bootstrap/api/bulk_index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
(let [dispatcher (api-util/get-dispatcher context params :index-collection)
provider-id (get provider-id-collection-map "provider_id")
collection-id (get provider-id-collection-map "collection_id")
_ (service/validate-collection context provider-id collection-id)
result (service/index-collection
context dispatcher provider-id collection-id)]
{:status 202
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
:bad-request
[(format "Provider: [%s] does not exist in the system" provider-id)])))

(defn- validate-collection
(defn validate-collection
"Validates to be bulk_indexed collection exists in cmr else an exception is thrown."
[context provider-id collection-id]
(let [provider (get-provider context provider-id)]
Expand All @@ -76,7 +76,6 @@
([context dispatcher provider-id collection-id]
(index-collection context dispatcher provider-id collection-id nil))
([context dispatcher provider-id collection-id options]
(validate-collection context provider-id collection-id)
(dispatch/index-collection dispatcher context provider-id collection-id options)))

(defn index-system-concepts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
(is (= {:status 400
:errors ["Provider: [NON_EXIST] does not exist in the system"]}
(bootstrap/start-rebalance-collection "C1-NON_EXIST" {:synchronous false}))))
(testing "Non existent collection"
(testing "Non existent collection cannot be moved to a separate index"
(is (= {:status 400
:errors ["Collection [C1-PROV1] does not exist."]}
(bootstrap/start-rebalance-collection "C1-PROV1" {:synchronous false}))))
Expand Down Expand Up @@ -481,11 +481,14 @@

(dev-sys-util/clear-caches)

; Delete collection and remove the tombstone
;; Delete collection and remove the tombstone
(ingest/delete-concept deleted-coll-concept)
(index/wait-until-indexed)
(side/eval-form `(tk/advance-time! ~(* (concept-service/days-to-keep-tombstone) 24 3600)))
(side/eval-form `(tk/advance-time! ~(* (inc (concept-service/days-to-keep-tombstone)) 24 3600)))
(is (= 204 (:status (mdb/cleanup-old-revisions))))
;; Verify collection revisions are all removed from the database to make sure test is valid
(is (= 404 (:status (search/retrieve-concept (:concept-id deleted-coll) 1))))
(is (= 404 (:status (search/retrieve-concept (:concept-id deleted-coll) 2))))

;; Rebalance to small-collections
(bootstrap/start-rebalance-collection (:concept-id deleted-coll) {:target "small-collections"})
Expand Down

0 comments on commit a2785c2

Please sign in to comment.