Skip to content

Commit

Permalink
Merge pull request #170 from NASA-PDS/i169
Browse files Browse the repository at this point in the history
Adds a new set of test data `naif3` in order to avoid dependency on a remote web server that may be down for an extended period of time
  • Loading branch information
jordanpadams committed Jun 6, 2024
2 parents c085ac1 + 05ababf commit 93858cc
Show file tree
Hide file tree
Showing 43 changed files with 6,291 additions and 41 deletions.
66 changes: 65 additions & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,71 @@
"is_verified": false,
"line_number": 32
}
],
"test/data/naif3/spice_kernels/m2020_168_sclkscet_00007.tsc": [
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_00007.tsc",
"hashed_secret": "34af3d6f31b0b9c0d5bbbeb8d2e27a7623f8f481",
"is_verified": false,
"line_number": 67
},
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_00007.tsc",
"hashed_secret": "dbfbf317dd33075578e4165b8741dc04cb833d78",
"is_verified": false,
"line_number": 71
}
],
"test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v01.tsc": [
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v01.tsc",
"hashed_secret": "34af3d6f31b0b9c0d5bbbeb8d2e27a7623f8f481",
"is_verified": false,
"line_number": 72
},
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v01.tsc",
"hashed_secret": "dbfbf317dd33075578e4165b8741dc04cb833d78",
"is_verified": false,
"line_number": 76
}
],
"test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v02.tsc": [
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v02.tsc",
"hashed_secret": "34af3d6f31b0b9c0d5bbbeb8d2e27a7623f8f481",
"is_verified": false,
"line_number": 72
},
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v02.tsc",
"hashed_secret": "dbfbf317dd33075578e4165b8741dc04cb833d78",
"is_verified": false,
"line_number": 76
}
],
"test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v03.tsc": [
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v03.tsc",
"hashed_secret": "34af3d6f31b0b9c0d5bbbeb8d2e27a7623f8f481",
"is_verified": false,
"line_number": 72
},
{
"type": "Email Address",
"filename": "test/data/naif3/spice_kernels/m2020_168_sclkscet_refit_v03.tsc",
"hashed_secret": "dbfbf317dd33075578e4165b8741dc04cb833d78",
"is_verified": false,
"line_number": 76
}
]
},
"generated_at": "2024-04-19T15:04:19Z"
"generated_at": "2024-06-06T14:31:55Z"
}
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,29 @@ All users and developers of the NASA-PDS software are expected to abide by our [
- Wiki: https://github.com/NASA-PDS/deep-archive/wiki


### 💽 Getting Test Data

If you need to mirror a part of a website to add to the test data, try this handy invocation of `wget`:
```console
$ wget \
--quiet \
--execute robots=off \
--cut-dirs=2 \
--reject='index.html*' \
--no-host-directories \
--mirror \
--no-parent \
--relative \
--timestamping \
--no-check-certificate \
--recursive \
"https://whatever/some/path"
```
Note ⑴: Although the author typically reaches for `curl`, it lacks a direct mirroring option—hence `wget` here.

Note ⑵: This is mostly a "note-to-self" for the author of this subsection 😉.


## 💁‍♀️ Support

If you are having issues file a bug report in Github: https://github.com/NASA-PDS/deep-archive/issues
Expand Down
105 changes: 65 additions & 40 deletions src/pds2/aipgen/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,37 +67,6 @@ def getsiteid(self):
return "PDS_ATM"


class LADEESIPWithBadbaseurlTest(LADEESIPTest):
"""This is the test fixture for LADEE SIPs but with bad base URLS."""

def setUp(self):
"""Set up this text fixture."""
super(LADEESIPWithBadbaseurlTest, self).setUp()
from zope.component import provideUtility # type: ignore
from pds2.aipgen.utils import URLValidator

self.validator = URLValidator()
provideUtility(self.validator)

def tearDown(self):
"""Tear down this text fixture."""
del self.validator
super(LADEESIPWithBadbaseurlTest, self).tearDown()

def getbaseurl(self):
"""Get the base URL."""
# This should always be a non-existent path no matter where this test is being run.
# If you go out of your way to actually create this path on your system, please take
# a moment to question your other life choices 🧐
return "file:/definitely/a/non/exist/int/path/prefix/"

# https://github.com/NASA-PDS/pds-deep-archive/issues/102
def test_sip(self):
"""Make sure that the SIP generation fails with a URLError due to a non-existent base URL."""
with self.assertRaises(URLError):
super(LADEESIPWithBadbaseurlTest, self).test_sip()


class LADEEAIPTest(AIPFunctionalTestCase):
"""Test case for AIP generation for all collections from the LADEE test bundle."""

Expand Down Expand Up @@ -325,21 +294,77 @@ def getmanifests(self):
return (base + "checksum_manifest_v1.0.tab", base + "transfer_manifest_v1.0.tab")


class NAIF3SIPWithBadbaseurlTest(SIPFunctionalTestCase):
"""This is the test fixture for NAIF3 SIPs but with bad base URLs."""

@classmethod
def setUpClass(cls):
"""Override the abstract base class which just skips itself."""
pass

def getbundlefile(self):
"""Get the bundle file."""
return "data/naif3/bundle_mars2020_spice_v003.xml"

def getallcollectionsflag(self):
"""Get the all collections flag."""
return True

def getvalidsipfilename(self):
"""Get the valid SIP file name.
This doesn't really matter because the goal is to raise a URLError when the SIP
is generated.
"""
return "does/not/matter.tab"

def getsiteid(self):
"""Get the site ID."""
return "PDS_ATM"

def setUp(self):
"""Set up this text fixture."""
super().setUp()
from zope.component import provideUtility # type: ignore
from pds2.aipgen.utils import URLValidator

self.validator = URLValidator()
provideUtility(self.validator)

def tearDown(self):
"""Tear down this text fixture."""
del self.validator
super().tearDown()

def getbaseurl(self):
"""Get the base URL."""
# This should always be a non-existent path no matter where this test is being run.
# If you go out of your way to actually create this path on your system, please take
# a moment to question your other life choices 🧐
return "file:/definitely/a/non/exist/int/path/prefix/"

# https://github.com/NASA-PDS/pds-deep-archive/issues/102
def test_sip(self):
"""Make sure that the SIP generation fails with a URLError due to a non-existent base URL."""
with self.assertRaises(URLError):
super().test_sip()


def test_suite():
"""Return a suite of tests, duh flake8."""
return unittest.TestSuite(
[
unittest.defaultTestLoader.loadTestsFromTestCase(LADEESIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(LADEEAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SensitivitySIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SensitivityAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(InsightAllSIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(DuplicateTabFileTest),
unittest.defaultTestLoader.loadTestsFromTestCase(InsightAllAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(InsightLatestSIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(InsightAllSIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(InsightLatestAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SecondaryCollectionSIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(InsightLatestSIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(LADEEAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(LADEESIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(NAIF3SIPWithBadbaseurlTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SecondaryCollectionAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(LADEESIPWithBadbaseurlTest),
unittest.defaultTestLoader.loadTestsFromTestCase(DuplicateTabFileTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SecondaryCollectionSIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SensitivityAIPTest),
unittest.defaultTestLoader.loadTestsFromTestCase(SensitivitySIPTest),
]
)
88 changes: 88 additions & 0 deletions test/data/naif3/bundle_mars2020_spice_v001.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1500.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>

<Product_Bundle xmlns="http://pds.nasa.gov/pds4/pds/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1 http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1500.xsd">
<Identification_Area>
<logical_identifier>urn:nasa:pds:mars2020.spice</logical_identifier>
<version_id>1.0</version_id>
<title>Mars 2020 Perseverance Rover Mission SPICE Kernel Archive Bundle</title>
<information_model_version>1.5.0.0</information_model_version>
<product_class>Product_Bundle</product_class>
<Citation_Information>
<author_list>Costa Sitja M.; Semenov B. V.; Barnes M. J.</author_list>
<publication_year>2021</publication_year>
<keyword>Observation Geometry</keyword>
<description>This bundle contains Mars 2020 Perseverance Rover Mission SPICE kernels and related documentation.</description>
</Citation_Information>
</Identification_Area>
<Context_Area>
<Time_Coordinates>
<start_date_time>2020-07-30T12:51:34Z</start_date_time>
<stop_date_time>2021-05-21T15:47:08Z</stop_date_time>
</Time_Coordinates>
<Primary_Result_Summary>
<purpose>Observation Geometry</purpose>
<processing_level>Derived</processing_level>
</Primary_Result_Summary>
<Investigation_Area>
<name>Mars 2020 Perseverance Rover Mission</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.mars2020</lid_reference>
<reference_type>bundle_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Mars 2020 Perseverance Rover</name>
<type>Spacecraft</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument_host:spacecraft.mars2020</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>MARS</name>
<type>Planet</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:planet.mars</lid_reference>
<reference_type>bundle_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
</Context_Area>
<Reference_List>
<Internal_Reference>
<lid_reference>urn:nasa:pds:mars2020.spice:document:spiceds</lid_reference>
<reference_type>bundle_to_document</reference_type>
</Internal_Reference>
</Reference_List>
<Bundle>
<bundle_type>Archive</bundle_type>
<description>This bundle contains Mars 2020 Perseverance Rover Mission SPICE kernels and related documentation.</description>
</Bundle>
<File_Area_Text>
<File>
<file_name>readme.txt</file_name>
<creation_date_time>2021-08-20T11:52:01</creation_date_time>
<file_size unit="byte">1365</file_size>
<md5_checksum>03fb547e38c7f87d33d48123ae01d8b2</md5_checksum>
</File>
<Stream_Text>
<offset unit="byte">0</offset>
<parsing_standard_id>7-Bit ASCII Text</parsing_standard_id>
<record_delimiter>Carriage-Return Line-Feed</record_delimiter>
</Stream_Text>
</File_Area_Text>
<Bundle_Member_Entry>
<lidvid_reference>urn:nasa:pds:mars2020.spice:spice_kernels::1.0</lidvid_reference>
<member_status>Primary</member_status>
<reference_type>bundle_has_spice_kernel_collection</reference_type>
</Bundle_Member_Entry>
<Bundle_Member_Entry>
<lidvid_reference>urn:nasa:pds:mars2020.spice:document::1.0</lidvid_reference>
<member_status>Primary</member_status>
<reference_type>bundle_has_document_collection</reference_type>
</Bundle_Member_Entry>
</Product_Bundle>
Loading

0 comments on commit 93858cc

Please sign in to comment.