Skip to content

Commit

Permalink
wait for caches to finish clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaeng72 committed Jan 13, 2025
1 parent 9c19464 commit 9922dde
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,16 @@
(def minimal-umm-c
"This is the minimal valid UMM-C."
{:Platforms [(umm-cmn/map->PlatformType
{:ShortName "Airplane"
:LongName "Airplane"
:Type "Jet"})]
:ProcessingLevel (umm-c/map->ProcessingLevelType {:Id "1T"})
{:ShortName "A340-600" :LongName "Airbus A340-600" :Type "Jet"})]
:ProcessingLevel (umm-c/map->ProcessingLevelType {:Id "3"})
:DataCenters [(umm-cmn/map->DataCenterType
{:Roles ["ARCHIVER"]
:ShortName "AARHUS-HYDRO"
:LongName "Hydrogeophysics Group, Aarhus University "})]
:ScienceKeywords [(umm-cmn/map->ScienceKeywordType
{:Category "EARTH SCIENCE"
:Topic "ATMOSPHERE"
:Term "AIR QUALITY",
:VariableLevel1 "CARBON MONOXIDE"})]
{:Category "EARTH SCIENCE SERVICES"
:Topic "DATA ANALYSIS AND VISUALIZATION"
:Term "GEOGRAPHIC INFORMATION SYSTEMS"})]
:SpatialExtent (umm-c/map->SpatialExtentType {:GranuleSpatialRepresentation "NO_SPATIAL"})
:ShortName "short"
:Version "V1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,84 +19,84 @@
"Executes the given function with the concept and client-id and make sure the status code
is correct. It will print out the executed function name when test fails."
[func-var concept client-id]
(let [{:keys [status errors]} ((var-get func-var) concept {:client-id client-id})
_ (println "Status returned = " status)
_ (println "Errors returned = " errors)]
(let [{:keys [status errors]} ((var-get func-var) concept {:client-id client-id})]
(is (#{200 201} status) (format "Failed in %s. with errors: %s" func-var errors))))

(deftest collection-cmr-only-client-id-test
(testing "ingest operations on CMR-ONLY provider can be submitted by client Echo"
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (dissoc (d/item->concept coll1) :revision-id)]
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "ECHO"))))
(testing "ingest operations on CMR-ONLY provider can be submitted by client other than Echo"
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (dissoc (d/item->concept coll1) :revision-id)]
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "any"))))
;; TODO this test fails too sometimes
(testing "ingest operations on non CMR-ONLY provider can be submitted by client Echo"
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (dissoc (d/item->concept coll1) :revision-id)]
(ingest/update-ingest-provider {:provider-id "PROV1"
:short-name "PROV1"
:cmr-only false
:small false})
(ingest/clear-caches)
(Thread/sleep 3000)
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "ECHO"))))
;; TODO this is the problem test
(testing "ingest operations on non CMR-ONLY provider can be submitted by client other than Echo"
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (dissoc (d/item->concept coll1) :revision-id)]
(ingest/update-ingest-provider {:provider-id "PROV1"
:short-name "PROV1"
:cmr-only false
:small false})
(ingest/clear-caches)
(Thread/sleep 3000)
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "any")))))

(deftest granule-cmr-only-client-id-test
(testing "ingest operations on CMR-ONLY provider can be submitted by client Echo"
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (d/item->concept (dg/granule-with-umm-spec-collection collection "C1-PROV1"))]
(ingest/ingest-concept concept)
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "ECHO"))))
(testing "ingest operations on CMR-ONLY provider can be submitted by client other than Echo"
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (d/item->concept (dg/granule-with-umm-spec-collection collection "C1-PROV1"))]
(ingest/ingest-concept concept)
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "any"))))
(testing "ingest operations on non CMR-ONLY provider can be submitted by client Echo"
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (d/item->concept (dg/granule-with-umm-spec-collection collection "C1-PROV1"))]
(ingest/ingest-concept concept)
(ingest/update-ingest-provider {:provider-id "PROV1"
:short-name "PROV1"
:cmr-only false
:small false})
(ingest/clear-caches)
(Thread/sleep 3000)
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "ECHO"))))
(testing "ingest operations on non CMR-ONLY provider can be submitted by client other than Echo"
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
concept (d/item->concept (dg/granule-with-umm-spec-collection collection "C1-PROV1"))]
(ingest/ingest-concept concept)
(ingest/update-ingest-provider {:provider-id "PROV1"
:short-name "PROV1"
:cmr-only false
:small false})
(ingest/clear-caches)
(Thread/sleep 3000)
(doseq [func ingest-functions-to-test]
(assert-ingest-success func concept "any")))))

(deftest granule-virtual-product-service-ingest-test
(testing "ingest with Virtual-Product-Service as client-id should succeed for cmr-only provider"
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
granule (dg/granule-with-umm-spec-collection collection "C1-PROV1")
concept (d/item->concept granule)]
(assert-ingest-success #'ingest/validate-concept concept "Virtual-Product-Service")
Expand All @@ -109,14 +109,15 @@
(is (= 0 (:hits (search/find-refs :granule {:granule-ur (:granule-ur granule)
:page-size 50}))))))
(testing "ingest with Virtual-Product-Service as client-id should succeed for non cmr-only provider"
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}) {:validate-keywords false})
(let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "ET1"}))
granule (dg/granule-with-umm-spec-collection collection "C1-PROV1")
concept (d/item->concept granule)]
(ingest/update-ingest-provider {:provider-id "PROV1"
:short-name "PROV1"
:cmr-only false
:small false})
(ingest/clear-caches)
(Thread/sleep 3000)
(assert-ingest-success #'ingest/validate-concept concept "Virtual-Product-Service")
(assert-ingest-success #'ingest/ingest-concept concept "Virtual-Product-Service")
(index/wait-until-indexed)
Expand Down

0 comments on commit 9922dde

Please sign in to comment.