Beispiel #1
0
def other_dataset(integration_test_data: Path,
                  test_dataset: DatasetForTests) -> DatasetForTests:
    """
    A dataset matching the same collection as test_dataset, but not indexed.
    """

    ds_id = uuid.UUID("5294efa6-348d-11e7-a079-185e0f80a5c0")
    paths.write_files(
        {
            'LS8_INDEXED_ALREADY': {
                'ga-metadata.yaml': (dedent(f"""\
                                     id: {str(ds_id)}
                                     platform:
                                         code: LANDSAT_8
                                     instrument:
                                         name: OLI_TIRS
                                     format:
                                         name: GeoTIFF
                                     product_type: level1
                                     product_level: L1T
                                     image:
                                         bands: {{}}
                                     lineage:
                                         source_datasets: {{}}""")),
                'dummy-file.txt':
                ''
            }
        },
        containing_dir=integration_test_data)

    return DatasetForTests(collection=test_dataset.collection,
                           id_=ds_id,
                           base_path=integration_test_data,
                           path_offset=('LS8_INDEXED_ALREADY',
                                        'ga-metadata.yaml'))
Beispiel #2
0
def do_an_archive():
    # Create dummy dataset

    test_uuid = 'a3bc7620-dd02-11e6-a5c0-185e0f80a5c0'
    d = write_files({
        'LS7_TEST': {
            'ga-metadata.yaml':
            # There's only one field it cares about in the metadata
            ('id: %s\n' % test_uuid),
            'product': {
                'SOME_DATA.tif': ''
            },
            'package.sha1':
            # Expected sha1sums calculated from command line (eg. sha1sum /tmp/test-dataset/ga-metadata.yaml)
            # Empty file shasum
            'da39a3ee5e6b4b0d3255bfef95601890afd80709\tproduct/SOME_DATA.tif\n'
            # contents of above id line
            'a3bc7620-dd02-11e6-a5c0-185e0f80a5c0\tga-metadata.yaml\n'
        }
    })
    input_path = d.joinpath('ga-metadata.yaml')
Beispiel #3
0
def test_load_from_file():
    root = write_files({
        'outputs.jsonl':
        """
{"name":"archived_dataset_on_disk","dataset_id":"582e9a74-d343-42d2-9105-a248b4b04f4a",\
"uri":"file:///g/data/fk4/datacube/002/LS5_TM_FC/-10_-39/LS5_TM_FC_3577_-10_-39_19990918011811500000.nc"}
{"name":"unreadable_dataset", "dataset_id":"None","uri":\
"file:///g/data/fk4/datacube/002/LS5_TM_FC/0_-30/LS5_TM_FC_3577_0_-30_20080331005819500000.nc"}
        """
    })

    mismatches = list(mismatches_from_file(root.joinpath('outputs.jsonl')))

    assert mismatches == [
        ArchivedDatasetOnDisk(
            DatasetLite(UUID('582e9a74-d343-42d2-9105-a248b4b04f4a')),
            'file:///g/data/fk4/datacube/002/LS5_TM_FC/-10_-39/LS5_TM_FC_3577_-10_-39_19990918011811500000.nc'
        ),
        UnreadableDataset(
            None,
            'file:///g/data/fk4/datacube/002/LS5_TM_FC/0_-30/LS5_TM_FC_3577_0_-30_20080331005819500000.nc'
        )
    ]