Skip to content

Commit

Permalink
remove granule changes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaeng72 committed Nov 27, 2024
1 parent a351803 commit b1caea8
Show file tree
Hide file tree
Showing 23 changed files with 237 additions and 326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
(deftest ^:oracle rebalance-collection-error-test
(s/only-with-real-database
(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})
_ (d/ingest "PROV1" (dg/granule coll1 {:granule-ur "gran1"}))
coll2 (d/ingest "PROV1" (dc/collection {:entry-title "coll2"}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule coll2 {:granule-ur "gran2"}) {:validate-keywords false})]
_ (d/ingest "PROV1" (dg/granule coll2 {:granule-ur "gran2"}))]
(index/wait-until-indexed)
(testing "no permission for start-rebalance-collection"
(is (= {:status 401
Expand Down Expand Up @@ -149,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}) {:validate-keywords false})))
(d/ingest (:provider-id coll) (dg/granule coll {:granule-ur granule-ur}))))

(defn inc-provider-holdings-for-coll
"Increments the number of granules expected for a collection in the expected provider holdings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@
granule-ur (svm/sample-source-granule-urs
[provider-id entry-title])]
(vp/ingest-source-granule provider-id
(dg/granule source-coll {:granule-ur granule-ur})
:validate-keywords false)))
(dg/granule source-coll {:granule-ur granule-ur}))))
all-expected-granule-urs (concat (mapcat vp/source-granule->virtual-granule-urs source-granules)
(map :granule-ur source-granules))]
(index/wait-until-indexed)
Expand Down Expand Up @@ -170,8 +169,7 @@
granule-ur "SC:AST_L1A.003:2006227720"
ast-l1a-gran (vp/ingest-source-granule "LP_ALIAS"
(dg/granule ast-coll {:granule-ur granule-ur
:project-refs ["proj1"]})
:validate-keywords false)
:project-refs ["proj1"]}))
virtual-granule-urs (vp/source-granule->virtual-granule-urs ast-l1a-gran)
all-expected-granule-urs (cons (:granule-ur ast-l1a-gran) virtual-granule-urs)]
(index/wait-until-indexed)
Expand Down Expand Up @@ -223,8 +221,7 @@
granule-ur "SC:AST_L1A.003:2006227720"
ast-l1a-gran (vp/ingest-source-granule "LPDAAC_ECS"
(dg/granule ast-coll {:granule-ur granule-ur
:project-refs ["proj1"]})
:validate-keywords false)
:project-refs ["proj1"]}))
virtual-granule-urs (vp/source-granule->virtual-granule-urs ast-l1a-gran)
all-expected-granule-urs (cons (:granule-ur ast-l1a-gran) virtual-granule-urs)]
(index/wait-until-indexed)
Expand Down Expand Up @@ -265,8 +262,7 @@
"LPDAAC_ECS"
(dg/granule ast-coll
{:granule-ur (format "SC:AST_L1A.003:%d" n)
:revision-id 5})
:validate-keywords false)))
:revision-id 5}))))
_ (bootstrap-and-index)
v-granules (mapcat #(:refs
(search/find-refs :granule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@
;; ingest the collections/granules for test
_ (data-core/ingest-umm-spec-collection "PROV1" coll1-1 {:format :dif :validate-keywords false})
coll3 (data-core/ingest-umm-spec-collection "PROV1" coll1-3 {:format :dif :validate-keywords false})
gran1 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll3 (:concept-id coll3) {:granule-ur "Granule1"}) {:validate-keywords false})
gran2 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll3 (:concept-id coll3) {:granule-ur "Granule2"}) {:validate-keywords false})]
gran1 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll3 (:concept-id coll3) {:granule-ur "Granule1"}))
gran2 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll3 (:concept-id coll3) {:granule-ur "Granule2"}))]
(index/wait-until-indexed)

(testing "update the collection with a different entry-id is OK"
Expand Down Expand Up @@ -446,12 +446,12 @@
(let [coll1 (data-core/ingest-umm-spec-collection "PROV1"
(data-umm-c/collection {:EntryTitle "E1" :ShortName "S1"})
{:validate-keywords false})
gran1 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll1 (:concept-id coll1)) {:validate-keywords false})
gran2 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll1 (:concept-id coll1)) {:validate-keywords false})
gran1 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll1 (:concept-id coll1)))
gran2 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll1 (:concept-id coll1)))
coll2 (data-core/ingest-umm-spec-collection "PROV1"
(data-umm-c/collection {:EntryTitle "E2":ShortName "S2"})
{:validate-keywords false})
gran3 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll2 (:concept-id coll2)) {:validate-keywords false})]
gran3 (data-core/ingest "PROV1" (granule/granule-with-umm-spec-collection coll2 (:concept-id coll2)))]
(index/wait-until-indexed)

;; delete collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,11 @@
:ShortName "S3"
:Projects (data-umm-cmn/projects "USGS_SOFIA")})
{:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:project-refs ["p1"]}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:project-refs ["p2" "p3"]}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:project-refs ["p3"]}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:project-refs ["p4"]}) {:validate-keywords false})
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll3 "C1-PROV1" {:project-refs ["USGS_SOFIA"]}) {:validate-keywords false})]
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:project-refs ["p1"]}))
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:project-refs ["p2" "p3"]}))
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:project-refs ["p3"]}))
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:project-refs ["p4"]}))
_ (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll3 "C1-PROV1" {:project-refs ["USGS_SOFIA"]}))]

(cache-util/refresh-cache (url/refresh-humanizer-alias-cache-url) (transmit-config/echo-system-token))
(index/wait-until-indexed)
Expand Down Expand Up @@ -532,9 +532,8 @@
:SpatialExtent (when spatial-params (data-umm-c/spatial spatial-params))})
{:validate-keywords false}))
make-gran (fn [coll spatial]
(d/ingest "PROV1"
(dg/granule-with-umm-spec-collection coll "C1-PROV1" {:spatial-coverage (when spatial (dg/spatial spatial))})
{:validate-keywords false}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:spatial-coverage
(when spatial (dg/spatial spatial))})))

;; Geodetic test collections
coll-geodetic-no-grans (make-coll "coll-geodetic-no-grans" {:gsr "GEODETIC"})
Expand Down Expand Up @@ -791,12 +790,12 @@
:Platforms (data-umm-cmn/platforms "p4" "Terra")})
{:validate-keywords false})]
;; CMR-3926 We need to make sure granules with no platfrom ref do not inherit their parent collection's instrument
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1") {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs (dg/platform-refs "p1")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs (dg/platform-refs "p2" "AM-1")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs (dg/platform-refs "AM-1")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs (dg/platform-refs "p4")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs (dg/platform-refs "Terra")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1"))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs (dg/platform-refs "p1")}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs (dg/platform-refs "p2" "AM-1")}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs (dg/platform-refs "AM-1")}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs (dg/platform-refs "p4")}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs (dg/platform-refs "Terra")}))
(cache-util/refresh-cache (url/refresh-humanizer-alias-cache-url) (transmit-config/echo-system-token))
(index/wait-until-indexed)

Expand Down Expand Up @@ -850,9 +849,9 @@
:Version "V1"
:TilingIdentificationSystems (data-umm-c/tiling-identification-systems "CALIPSO" "MISR" "WRS-1" "WRS-2")})
{:validate-keywords false})]
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:two-d-coordinate-system (dg/two-d "MISR")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:two-d-coordinate-system (dg/two-d "MISR")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:two-d-coordinate-system (dg/two-d "CALIPSO")}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:two-d-coordinate-system (dg/two-d "MISR")}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:two-d-coordinate-system (dg/two-d "MISR")}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:two-d-coordinate-system (dg/two-d "CALIPSO")}))
(index/wait-until-indexed)
(testing "Update collection successful cases"
(are3
Expand Down Expand Up @@ -912,12 +911,12 @@
:Platforms [(data-umm-cmn/platform-with-instrument-and-childinstruments "p2" "i2" "s1" "GPS RECEIVERS")]})
{:validate-keywords false})]
;; CMR-3926 We need to make sure granules with no instrument ref or sensor ref do not inherit their parent collection's instrument or sensor
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1") {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-refs "p1-1" "i1")]}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-refs "p1-1" "i2" "GPS")]}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-refs "p1-1" "GPS")]}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-ref-and-sensor-refs "p2" "i2" "s1")]}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-ref-and-sensor-refs "p2" "i2" "GPS RECEIVERS")]}) {:validate-keywords false})
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1"))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-refs "p1-1" "i1")]}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-refs "p1-1" "i2" "GPS")]}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-refs "p1-1" "GPS")]}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-ref-and-sensor-refs "p2" "i2" "s1")]}))
(d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 "C1-PROV1" {:platform-refs [(dg/platform-ref-with-instrument-ref-and-sensor-refs "p2" "i2" "GPS RECEIVERS")]}))
(index/wait-until-indexed)
(cache-util/refresh-cache (url/refresh-humanizer-alias-cache-url) (transmit-config/echo-system-token))
(testing "Update collection successful cases"
Expand Down Expand Up @@ -1001,12 +1000,12 @@
(dg/psa "DTS" ["2012-01-01T01:02:03Z"])]}

coll (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection collection-map) {:validate-keywords false})
gran (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" granule-map) {:validate-keywords false})]
gran (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" granule-map))]

(are3
[coll-map gran-map]
(let [response (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection coll-map) {:validate-keywords false})
response2 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" gran-map) {:validate-keywords false})
response2 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll "C1-PROV1" gran-map))
{:keys [status errors]} response]
(is (= [200 nil] [status errors]))
(is (= [201 nil] [(:status response2) (:errors response2)])))
Expand Down
Loading

0 comments on commit b1caea8

Please sign in to comment.