Skip to content

Commit

Permalink
add validate-keyword as false to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaeng72 committed Nov 21, 2024
1 parent bf2009f commit b109b11
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 104 deletions.
2 changes: 1 addition & 1 deletion system-int-test/src/cmr/system_int_test/data2/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
:native-id (or native-id "native-id")
:metadata metadata
:format (or format (mime-types/format->mime-type format-key))}
response (ingest/ingest-concept concept)]
response (ingest/ingest-concept concept {:validate-keywords false})]
(if (= concept-type :granule)
(merge (umm-legacy/parse-concept context concept) response)
(merge (umm-spec/parse-metadata context concept) response))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
(dc/collection
{:entry-title "ASTER L1A Reconstructed Unprocessed Instrument Data V003"
:short-name "AST_L1A"})
:provider-id "LPDAAC_ECS")])))
:provider-id "LPDAAC_ECS")] {:validate-keywords false})))

;;; Functions for use in assertions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@

(deftest ^:oracle bulk-index-collections-with-service-association-test
(s/only-with-real-database
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}))
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}) {:validate-keywords false})
coll1-concept-id (:concept-id coll1)
token (e/login (s/context) "user1")
{serv1-concept-id :concept-id} (service/ingest-service-with-attrs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(deftest ^:oracle bulk-index-collections-with-tag-association-test
(s/only-with-real-database
(let [[coll1 coll2] (for [n (range 1 3)]
(d/ingest "PROV1" (dc/collection {:entry-title (str "coll" n)})))
(d/ingest "PROV1" (dc/collection {:entry-title (str "coll" n)}) {:validate-keywords false}))
;; Wait until collections are indexed so tags can be associated with them
_ (index/wait-until-indexed)
user1-token (e/login (s/context) "user1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@

(deftest bulk-index-collections-with-tool-association-test
(system/only-with-real-database
(let [coll1 (data-core/ingest "PROV1" (data-collection/collection {:entry-title "coll1"}))
(let [coll1 (data-core/ingest "PROV1" (data-collection/collection {:entry-title "coll1"}) {:validate-keywords false})
coll1-concept-id (:concept-id coll1)
token (echo-util/login (system/context) "user1")
{tool1-concept-id :concept-id} (tool/ingest-tool-with-attrs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
coll2 (data2-core/ingest
"PROV2"
(data2-collection/collection {:entry-title "ET2"
:short-name "S2"
:version-id "V2"}))
:version-id "V2"})
{:validate-keywords false})
_ (index/wait-until-indexed)
var1 (variable/make-variable-concept
{:Name "Variable1"}
Expand All @@ -47,7 +49,7 @@
_ (core/disable-automatic-indexing)
;; The following is saved, but not indexed due to the above call
{var1-concept-id :concept-id} (variable/ingest-variable-with-association var1)
{var2-concept-id :concept-id} (variable/ingest-variable-with-association var2)
{_ :concept-id} (variable/ingest-variable-with-association var2)
{:keys [status errors]} (bootstrap/bulk-index-variables "PROV1" nil)]

(is (= [401 ["You do not have permission to perform that action."]]
Expand Down Expand Up @@ -103,17 +105,20 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
coll2 (data2-core/ingest
"PROV2"
(data2-collection/collection {:entry-title "ET2"
:short-name "S2"
:version-id "V2"}))
:version-id "V2"})
{:validate-keywords false})
coll3 (data2-core/ingest
"PROV3"
(data2-collection/collection {:entry-title "ET3"
:short-name "S3"
:version-id "V3"}))
:version-id "V3"})
{:validate-keywords false})
_ (index/wait-until-indexed)
var1 (variable/make-variable-concept
{:Name "Variable1"}
Expand Down Expand Up @@ -167,17 +172,20 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
coll2 (data2-core/ingest
"PROV2"
(data2-collection/collection {:entry-title "ET2"
:short-name "S2"
:version-id "V2"}))
:version-id "V2"})
{:validate-keywords false})
coll3 (data2-core/ingest
"PROV3"
(data2-collection/collection {:entry-title "ET3"
:short-name "S3"
:version-id "V3"}))
:version-id "V3"})
{:validate-keywords false})
_ (index/wait-until-indexed)
var1 (variable/make-variable-concept
{:Name "Variable1"}
Expand Down Expand Up @@ -215,17 +223,20 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
coll2 (data2-core/ingest
"PROV2"
(data2-collection/collection {:entry-title "ET2"
:short-name "S2"
:version-id "V2"}))
:version-id "V2"})
{:validate-keywords false})
coll3 (data2-core/ingest
"PROV3"
(data2-collection/collection {:entry-title "ET3"
:short-name "S3"
:version-id "V3"}))
:version-id "V3"})
{:validate-keywords false})
_ (index/wait-until-indexed)
;; Disable message publishing so items are not indexed.
_ (core/disable-automatic-indexing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
_ (index/wait-until-indexed)
var1 (variable/make-variable-concept
{:Name "Variable1"}
Expand Down Expand Up @@ -82,7 +83,7 @@
(get-in latest-revision-concept [:extra-fields :fingerprint]))))))

(testing "update fingerprint of a deleted variable"
(let [{:keys [concept-id revision-id]} (ingest/delete-concept var2-concept)
(let [{:keys [_ _]} (ingest/delete-concept var2-concept)
latest-revision-concept (mdb/get-concept var2-concept-id)]
(is (= var2-concept-id (:concept-id latest-revision-concept)))
(is (= 2 (:revision-id latest-revision-concept)))
Expand Down Expand Up @@ -110,12 +111,14 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
coll2 (data2-core/ingest
"PROV2"
(data2-collection/collection {:entry-title "ET2"
:short-name "S2"
:version-id "V2"}))
:version-id "V2"})
{:validate-keywords false})
_ (index/wait-until-indexed)
var1 (variable/make-variable-concept
{:Name "Variable1"}
Expand All @@ -137,7 +140,7 @@
var2-concept (mdb/get-concept var2-concept-id)
var2-fingerprint (get-in var2-concept [:extra-fields :fingerprint])
var3-concept (mdb/get-concept var3-concept-id)
var3-fingerprint (get-in var3-concept [:extra-fields :fingerprint])
_ (get-in var3-concept [:extra-fields :fingerprint])
;; now change the fingerprint of var1 and var3 to a different vaule
latest-var1 (-> var1-concept
(assoc :revision-id (inc (:revision-id var1-concept)))
Expand Down Expand Up @@ -202,12 +205,14 @@
"PROV1"
(data2-collection/collection {:entry-title "ET1"
:short-name "S1"
:version-id "V1"}))
:version-id "V1"})
{:validate-keywords false})
coll2 (data2-core/ingest
"PROV2"
(data2-collection/collection {:entry-title "ET2"
:short-name "S2"
:version-id "V2"}))
:version-id "V2"})
{:validate-keywords false})
_ (index/wait-until-indexed)
var1 (variable/make-variable-concept
{:Name "Variable1"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
index to separate collection indexes"
(:require
[clojure.test :refer :all]
[clj-http.client :as client]
[cmr.common-app.test.side-api :as side]
[cmr.common.time-keeper :as tk]
[cmr.system-int-test.data2.collection :as dc]
Expand All @@ -29,10 +28,10 @@

(deftest ^:oracle rebalance-collection-error-test
(s/only-with-real-database
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}))
gran1 (d/ingest "PROV1" (dg/granule coll1 {:granule-ur "gran1"}))
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}))
gran2 (d/ingest "PROV1" (dg/granule coll2 {:granule-ur "gran2"}))]
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule coll1 {:granule-ur "gran1"}) {:validate-keywords false})
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule coll2 {:granule-ur "gran2"}) {:validate-keywords false})]
(index/wait-until-indexed)
(testing "no permission for start-rebalance-collection"
(is (= {:status 401
Expand Down Expand Up @@ -150,7 +149,7 @@
(defn ingest-granule-for-coll
[coll n]
(let [granule-ur (str (:entry-title coll) "_gran_" n)]
(d/ingest (:provider-id coll) (dg/granule coll {:granule-ur granule-ur}))))
(d/ingest (:provider-id coll) (dg/granule coll {:granule-ur granule-ur}) {:validate-keywords false})))

(defn inc-provider-holdings-for-coll
"Increments the number of granules expected for a collection in the expected provider holdings"
Expand All @@ -163,8 +162,8 @@
;; Rebalances a single collection with a single granule
(deftest ^:oracle simple-rebalance-collection-test
(s/only-with-real-database
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}))
gran1 (ingest-granule-for-coll coll1 1)
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}) {:validate-keywords false})
_ (ingest-granule-for-coll coll1 1)
expected-provider-holdings (-> coll1
(select-keys [:provider-id :concept-id :entry-title])
(assoc :granule-count 1)
Expand Down Expand Up @@ -209,11 +208,11 @@

(deftest ^:oracle rebalance-collection-test
(s/only-with-real-database
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}))
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}))
coll3 (d/ingest "PROV2" (dc/collection {:entry-title "coll3"}))
coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}))
granules (doall (for [coll [coll1 coll2 coll3 coll4]
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}) {:validate-keywords false})
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}) {:validate-keywords false})
coll3 (d/ingest "PROV2" (dc/collection {:entry-title "coll3"}) {:validate-keywords false})
coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false})
_ (doall (for [coll [coll1 coll2 coll3 coll4]
n (range 4)]
(ingest-granule-for-coll coll n)))

Expand Down Expand Up @@ -284,11 +283,11 @@
;; Tests rebalancing multiple collections at the same time.
(deftest ^:oracle rebalance-multiple-collections-test
(s/only-with-real-database
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}))
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}))
coll3 (d/ingest "PROV2" (dc/collection {:entry-title "coll3"}))
coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}))
granules (doall (for [coll [coll1 coll2 coll3 coll4]
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}) {:validate-keywords false})
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}) {:validate-keywords false})
coll3 (d/ingest "PROV2" (dc/collection {:entry-title "coll3"}) {:validate-keywords false})
coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false})
_ (doall (for [coll [coll1 coll2 coll3 coll4]
n (range 4)]
(ingest-granule-for-coll coll n)))

Expand Down Expand Up @@ -345,11 +344,11 @@

(deftest ^:oracle rebalance-collection-after-other-collections-test
(s/only-with-real-database
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}))
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}))
coll3 (d/ingest "PROV2" (dc/collection {:entry-title "coll3"}))
coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}))
granules (doall (for [coll [coll1 coll2 coll3 coll4]
(let [coll1 (d/ingest "PROV1" (dc/collection {:entry-title "coll1"}) {:validate-keywords false})
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}) {:validate-keywords false})
coll3 (d/ingest "PROV2" (dc/collection {:entry-title "coll3"}) {:validate-keywords false})
coll4 (d/ingest "PROV2" (dc/collection {:entry-title "coll4"}) {:validate-keywords false})
_ (doall (for [coll [coll1 coll2 coll3 coll4]
n (range 4)]
(ingest-granule-for-coll coll n)))

Expand Down Expand Up @@ -475,7 +474,7 @@
(side/eval-form `(tk/set-time-override! (tk/now)))
(s/only-with-real-database
(let [deleted-coll (d/ingest "PROV1" (dc/collection {:entry-title "deleted-coll"}))
granules (doseq [n (range 2)]
_ (doseq [n (range 2)]
(ingest-granule-for-coll deleted-coll n))
deleted-coll-concept (mdb/get-concept (:concept-id deleted-coll))]

Expand Down
Loading

0 comments on commit b109b11

Please sign in to comment.