diff --git a/justfile b/justfile index ba9bfdd6a..a8aacc642 100644 --- a/justfile +++ b/justfile @@ -217,7 +217,7 @@ git-pre-push: stop start # Update sqlite database schema. prepare-sqlite: install-sqlx mkdir -p martin-mbtiles/.sqlx - cd martin-mbtiles && cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/files/world_cities.mbtiles -- --lib --tests + cd martin-mbtiles && cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/mbtiles/world_cities.mbtiles -- --lib --tests # Install SQLX cli if not already installed. [private] diff --git a/martin-mbtiles/src/mbtiles.rs b/martin-mbtiles/src/mbtiles.rs index 574cf0035..a3d350dc9 100644 --- a/martin-mbtiles/src/mbtiles.rs +++ b/martin-mbtiles/src/mbtiles.rs @@ -609,7 +609,7 @@ mod tests { #[actix_rt::test] async fn mbtiles_meta() { - let filepath = "../tests/fixtures/files/geography-class-jpg.mbtiles"; + let filepath = "../tests/fixtures/mbtiles/geography-class-jpg.mbtiles"; let mbt = Mbtiles::new(filepath).unwrap(); assert_eq!(mbt.filepath(), filepath); assert_eq!(mbt.filename(), "geography-class-jpg"); @@ -617,7 +617,7 @@ mod tests { #[actix_rt::test] async fn metadata_jpeg() { - let (mut conn, mbt) = open("../tests/fixtures/files/geography-class-jpg.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/geography-class-jpg.mbtiles").await; let metadata = mbt.get_metadata(&mut conn).await.unwrap(); let tj = metadata.tilejson; @@ -634,7 +634,7 @@ mod tests { #[actix_rt::test] async fn metadata_mvt() { - let (mut conn, mbt) = open("../tests/fixtures/files/world_cities.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/world_cities.mbtiles").await; let metadata = mbt.get_metadata(&mut conn).await.unwrap(); let tj = metadata.tilejson; @@ -665,7 +665,7 @@ mod tests { #[actix_rt::test] async fn metadata_get_key() { - let (mut conn, mbt) = open("../tests/fixtures/files/world_cities.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/world_cities.mbtiles").await; let res = mbt.get_metadata_value(&mut conn, "bounds").await.unwrap(); assert_eq!(res.unwrap(), "-123.123590,-37.818085,174.763027,59.352706"); @@ -725,15 +725,15 @@ mod tests { #[actix_rt::test] async fn detect_type() { - let (mut conn, mbt) = open("../tests/fixtures/files/world_cities.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/world_cities.mbtiles").await; let res = mbt.detect_type(&mut conn).await.unwrap(); assert_eq!(res, MbtType::Flat); - let (mut conn, mbt) = open("../tests/fixtures/files/zoomed_world_cities.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/zoomed_world_cities.mbtiles").await; let res = mbt.detect_type(&mut conn).await.unwrap(); assert_eq!(res, MbtType::FlatWithHash); - let (mut conn, mbt) = open("../tests/fixtures/files/geography-class-jpg.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/geography-class-jpg.mbtiles").await; let res = mbt.detect_type(&mut conn).await.unwrap(); assert_eq!(res, MbtType::Normalized); @@ -744,7 +744,7 @@ mod tests { #[actix_rt::test] async fn validate_valid_file() { - let (mut conn, mbt) = open("../tests/fixtures/files/zoomed_world_cities.mbtiles").await; + let (mut conn, mbt) = open("../tests/fixtures/mbtiles/zoomed_world_cities.mbtiles").await; mbt.check_integrity(&mut conn, IntegrityCheckType::Quick) .await @@ -754,7 +754,7 @@ mod tests { #[actix_rt::test] async fn validate_invalid_file() { let (mut conn, mbt) = - open("../tests/fixtures/files/invalid/invalid_zoomed_world_cities.mbtiles").await; + open("../tests/fixtures/files/invalid_zoomed_world_cities.mbtiles").await; let result = mbt.check_agg_tiles_hashes(&mut conn).await; assert!(matches!(result, Err(MbtError::AggHashMismatch(..)))); } diff --git a/martin-mbtiles/src/tile_copier.rs b/martin-mbtiles/src/tile_copier.rs index 6827f410f..8e8ced1b5 100644 --- a/martin-mbtiles/src/tile_copier.rs +++ b/martin-mbtiles/src/tile_copier.rs @@ -603,14 +603,14 @@ mod tests { #[actix_rt::test] async fn copy_flat_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from("file:copy_flat_tables_mem_db?mode=memory&cache=shared"); verify_copy_all(src, dst, None, Flat).await } #[actix_rt::test] async fn copy_flat_from_flat_with_hash_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/zoomed_world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/zoomed_world_cities.mbtiles"); let dst = PathBuf::from( "file:copy_flat_from_flat_with_hash_tables_mem_db?mode=memory&cache=shared", ); @@ -619,7 +619,7 @@ mod tests { #[actix_rt::test] async fn copy_flat_from_normalized_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/geography-class-png.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/geography-class-png.mbtiles"); let dst = PathBuf::from("file:copy_flat_from_normalized_tables_mem_db?mode=memory&cache=shared"); verify_copy_all(src, dst, Some(Flat), Flat).await @@ -627,14 +627,14 @@ mod tests { #[actix_rt::test] async fn copy_flat_with_hash_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/zoomed_world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/zoomed_world_cities.mbtiles"); let dst = PathBuf::from("file:copy_flat_with_hash_tables_mem_db?mode=memory&cache=shared"); verify_copy_all(src, dst, None, FlatWithHash).await } #[actix_rt::test] async fn copy_flat_with_hash_from_flat_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from( "file:copy_flat_with_hash_from_flat_tables_mem_db?mode=memory&cache=shared", ); @@ -643,7 +643,7 @@ mod tests { #[actix_rt::test] async fn copy_flat_with_hash_from_normalized_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/geography-class-png.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/geography-class-png.mbtiles"); let dst = PathBuf::from( "file:copy_flat_with_hash_from_normalized_tables_mem_db?mode=memory&cache=shared", ); @@ -652,14 +652,14 @@ mod tests { #[actix_rt::test] async fn copy_normalized_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/geography-class-png.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/geography-class-png.mbtiles"); let dst = PathBuf::from("file:copy_normalized_tables_mem_db?mode=memory&cache=shared"); verify_copy_all(src, dst, None, Normalized).await } #[actix_rt::test] async fn copy_normalized_from_flat_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from("file:copy_normalized_from_flat_tables_mem_db?mode=memory&cache=shared"); verify_copy_all(src, dst, Some(Normalized), Normalized).await @@ -667,7 +667,7 @@ mod tests { #[actix_rt::test] async fn copy_normalized_from_flat_with_hash_tables() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/zoomed_world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/zoomed_world_cities.mbtiles"); let dst = PathBuf::from( "file:copy_normalized_from_flat_with_hash_tables_mem_db?mode=memory&cache=shared", ); @@ -676,7 +676,7 @@ mod tests { #[actix_rt::test] async fn copy_with_min_max_zoom() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from("file:copy_with_min_max_zoom_mem_db?mode=memory&cache=shared"); let opt = TileCopierOptions::new(src, dst) .min_zoom(Some(2)) @@ -686,7 +686,7 @@ mod tests { #[actix_rt::test] async fn copy_with_zoom_levels() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from("file:copy_with_zoom_levels_mem_db?mode=memory&cache=shared"); let opt = TileCopierOptions::new(src, dst) .min_zoom(Some(2)) @@ -697,11 +697,11 @@ mod tests { #[actix_rt::test] async fn copy_with_diff_with_file() -> MbtResult<()> { - let src = PathBuf::from("../tests/fixtures/files/geography-class-jpg.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/geography-class-jpg.mbtiles"); let dst = PathBuf::from("file:copy_with_diff_with_file_mem_db?mode=memory&cache=shared"); let diff_file = - PathBuf::from("../tests/fixtures/files/geography-class-jpg-modified.mbtiles"); + PathBuf::from("../tests/fixtures/mbtiles/geography-class-jpg-modified.mbtiles"); let copy_opts = TileCopierOptions::new(src.clone(), dst.clone()).diff_with_file(diff_file.clone()); @@ -744,10 +744,10 @@ mod tests { #[actix_rt::test] async fn ignore_dst_type_when_copy_to_existing() -> MbtResult<()> { - let src_file = PathBuf::from("../tests/fixtures/files/world_cities_modified.mbtiles"); + let src_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities_modified.mbtiles"); // Copy the dst file to an in-memory DB - let dst_file = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let dst_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from( "file:ignore_dst_type_when_copy_to_existing_mem_db?mode=memory&cache=shared", ); @@ -761,8 +761,8 @@ mod tests { #[actix_rt::test] async fn copy_to_existing_abort_mode() { - let src = PathBuf::from("../tests/fixtures/files/world_cities_modified.mbtiles"); - let dst = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src = PathBuf::from("../tests/fixtures/mbtiles/world_cities_modified.mbtiles"); + let dst = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let copy_opts = TileCopierOptions::new(src.clone(), dst.clone()).on_duplicate(CopyDuplicateMode::Abort); @@ -775,10 +775,10 @@ mod tests { #[actix_rt::test] async fn copy_to_existing_override_mode() -> MbtResult<()> { - let src_file = PathBuf::from("../tests/fixtures/files/world_cities_modified.mbtiles"); + let src_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities_modified.mbtiles"); // Copy the dst file to an in-memory DB - let dst_file = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let dst_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from("file:copy_to_existing_override_mode_mem_db?mode=memory&cache=shared"); @@ -804,10 +804,10 @@ mod tests { #[actix_rt::test] async fn copy_to_existing_ignore_mode() -> MbtResult<()> { - let src_file = PathBuf::from("../tests/fixtures/files/world_cities_modified.mbtiles"); + let src_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities_modified.mbtiles"); // Copy the dst file to an in-memory DB - let dst_file = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let dst_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let dst = PathBuf::from("file:copy_to_existing_ignore_mode_mem_db?mode=memory&cache=shared"); @@ -858,7 +858,7 @@ mod tests { #[actix_rt::test] async fn apply_flat_diff_file() -> MbtResult<()> { // Copy the src file to an in-memory DB - let src_file = PathBuf::from("../tests/fixtures/files/world_cities.mbtiles"); + let src_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities.mbtiles"); let src = PathBuf::from("file:apply_flat_diff_file_mem_db?mode=memory&cache=shared"); let mut src_conn = TileCopierOptions::new(src_file.clone(), src.clone()) @@ -866,11 +866,11 @@ mod tests { .await?; // Apply diff to the src data in in-memory DB - let diff_file = PathBuf::from("../tests/fixtures/files/world_cities_diff.mbtiles"); + let diff_file = PathBuf::from("../tests/fixtures/mbtiles/world_cities_diff.mbtiles"); apply_mbtiles_diff(src, diff_file).await?; // Verify the data is the same as the file the diff was generated from - let path = "../tests/fixtures/files/world_cities_modified.mbtiles"; + let path = "../tests/fixtures/mbtiles/world_cities_modified.mbtiles"; attach_other_db(&mut src_conn, path).await?; assert!( @@ -886,7 +886,7 @@ mod tests { #[actix_rt::test] async fn apply_normalized_diff_file() -> MbtResult<()> { // Copy the src file to an in-memory DB - let src_file = PathBuf::from("../tests/fixtures/files/geography-class-jpg.mbtiles"); + let src_file = PathBuf::from("../tests/fixtures/mbtiles/geography-class-jpg.mbtiles"); let src = PathBuf::from("file:apply_normalized_diff_file_mem_db?mode=memory&cache=shared"); let mut src_conn = TileCopierOptions::new(src_file.clone(), src.clone()) @@ -894,11 +894,11 @@ mod tests { .await?; // Apply diff to the src data in in-memory DB - let diff_file = PathBuf::from("../tests/fixtures/files/geography-class-jpg-diff.mbtiles"); + let diff_file = PathBuf::from("../tests/fixtures/mbtiles/geography-class-jpg-diff.mbtiles"); apply_mbtiles_diff(src, diff_file).await?; // Verify the data is the same as the file the diff was generated from - let path = "../tests/fixtures/files/geography-class-jpg-modified.mbtiles"; + let path = "../tests/fixtures/mbtiles/geography-class-jpg-modified.mbtiles"; attach_other_db(&mut src_conn, path).await?; assert!( diff --git a/tests/config.yaml b/tests/config.yaml index 1f9dc1c66..471f31428 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -162,7 +162,7 @@ postgres: pmtiles: sources: - pmt: tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles + pmt: tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles sprites: paths: tests/fixtures/sprites/src1 diff --git a/tests/expected/auto/catalog_auto.json b/tests/expected/auto/catalog_auto.json index 54051c79d..1de39eb3b 100644 --- a/tests/expected/auto/catalog_auto.json +++ b/tests/expected/auto/catalog_auto.json @@ -8,12 +8,6 @@ "content_type": "application/x-protobuf", "description": "autodetect.auto_table.geom" }, - "bad_hash": { - "content_type": "application/x-protobuf", - "content_encoding": "gzip", - "name": "Major cities from Natural Earth data", - "description": "Major cities from Natural Earth data" - }, "bigint_table": { "content_type": "application/x-protobuf", "description": "autodetect.bigint_table.geom" diff --git a/tests/expected/generated_config.yaml b/tests/expected/generated_config.yaml index 930b6b036..e8229fd9a 100644 --- a/tests/expected/generated_config.yaml +++ b/tests/expected/generated_config.yaml @@ -133,24 +133,27 @@ postgres: schema: public function: function_zxy_row_key pmtiles: - paths: tests/fixtures/files + paths: + - tests/fixtures/mbtiles + - tests/fixtures/pmtiles sources: - png: tests/fixtures/files/png.pmtiles - stamen_toner__raster_CC-BY-ODbL_z3: tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles - webp2: tests/fixtures/files/webp2.pmtiles + png: tests/fixtures/pmtiles/png.pmtiles + stamen_toner__raster_CC-BY-ODbL_z3: tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles + webp2: tests/fixtures/pmtiles/webp2.pmtiles mbtiles: - paths: tests/fixtures/files + paths: + - tests/fixtures/mbtiles + - tests/fixtures/pmtiles sources: - bad_hash: tests/fixtures/files/bad_hash.mbtiles - geography-class-jpg: tests/fixtures/files/geography-class-jpg.mbtiles - geography-class-jpg-diff: tests/fixtures/files/geography-class-jpg-diff.mbtiles - geography-class-jpg-modified: tests/fixtures/files/geography-class-jpg-modified.mbtiles - geography-class-png: tests/fixtures/files/geography-class-png.mbtiles - geography-class-png-no-bounds: tests/fixtures/files/geography-class-png-no-bounds.mbtiles - json: tests/fixtures/files/json.mbtiles - uncompressed_mvt: tests/fixtures/files/uncompressed_mvt.mbtiles - webp: tests/fixtures/files/webp.mbtiles - world_cities: tests/fixtures/files/world_cities.mbtiles - world_cities_diff: tests/fixtures/files/world_cities_diff.mbtiles - world_cities_modified: tests/fixtures/files/world_cities_modified.mbtiles - zoomed_world_cities: tests/fixtures/files/zoomed_world_cities.mbtiles + geography-class-jpg: tests/fixtures/mbtiles/geography-class-jpg.mbtiles + geography-class-jpg-diff: tests/fixtures/mbtiles/geography-class-jpg-diff.mbtiles + geography-class-jpg-modified: tests/fixtures/mbtiles/geography-class-jpg-modified.mbtiles + geography-class-png: tests/fixtures/mbtiles/geography-class-png.mbtiles + geography-class-png-no-bounds: tests/fixtures/mbtiles/geography-class-png-no-bounds.mbtiles + json: tests/fixtures/mbtiles/json.mbtiles + uncompressed_mvt: tests/fixtures/mbtiles/uncompressed_mvt.mbtiles + webp: tests/fixtures/mbtiles/webp.mbtiles + world_cities: tests/fixtures/mbtiles/world_cities.mbtiles + world_cities_diff: tests/fixtures/mbtiles/world_cities_diff.mbtiles + world_cities_modified: tests/fixtures/mbtiles/world_cities_modified.mbtiles + zoomed_world_cities: tests/fixtures/mbtiles/zoomed_world_cities.mbtiles diff --git a/tests/expected/given_config.yaml b/tests/expected/given_config.yaml index 033c66283..6ba51282e 100644 --- a/tests/expected/given_config.yaml +++ b/tests/expected/given_config.yaml @@ -159,7 +159,7 @@ postgres: - 90.0 pmtiles: sources: - pmt: tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles + pmt: tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles sprites: paths: tests/fixtures/sprites/src1 sources: diff --git a/tests/expected/mbtiles/copy_diff2.txt b/tests/expected/mbtiles/copy_diff2.txt index e69de29bb..cddb2637d 100644 --- a/tests/expected/mbtiles/copy_diff2.txt +++ b/tests/expected/mbtiles/copy_diff2.txt @@ -0,0 +1 @@ +[INFO ] Creating new metadata value agg_tiles_hash = D41D8CD98F00B204E9800998ECF8427E in tests/temp/world_cities_diff_modified.mbtiles diff --git a/tests/expected/mbtiles/validate-ok.txt b/tests/expected/mbtiles/validate-ok.txt index 2220bb36d..87a15d314 100644 --- a/tests/expected/mbtiles/validate-ok.txt +++ b/tests/expected/mbtiles/validate-ok.txt @@ -1,3 +1,3 @@ -[INFO ] Quick integrity check passed for ./tests/fixtures/files/zoomed_world_cities.mbtiles -[INFO ] All tile hashes are valid for ./tests/fixtures/files/zoomed_world_cities.mbtiles -[INFO ] The agg_tiles_hashes=D4E1030D57751A0B45A28A71267E46B8 has been verified for ./tests/fixtures/files/zoomed_world_cities.mbtiles +[INFO ] Quick integrity check passed for ./tests/fixtures/mbtiles/zoomed_world_cities.mbtiles +[INFO ] All tile hashes are valid for ./tests/fixtures/mbtiles/zoomed_world_cities.mbtiles +[INFO ] The agg_tiles_hashes=D4E1030D57751A0B45A28A71267E46B8 has been verified for ./tests/fixtures/mbtiles/zoomed_world_cities.mbtiles diff --git a/tests/fixtures/files/invalid/invalid-tile-format.mbtiles b/tests/fixtures/files/invalid-tile-format.mbtiles similarity index 100% rename from tests/fixtures/files/invalid/invalid-tile-format.mbtiles rename to tests/fixtures/files/invalid-tile-format.mbtiles diff --git a/tests/fixtures/files/invalid/invalid.mbtiles b/tests/fixtures/files/invalid.mbtiles similarity index 100% rename from tests/fixtures/files/invalid/invalid.mbtiles rename to tests/fixtures/files/invalid.mbtiles diff --git a/tests/fixtures/files/invalid/invalid_zoomed_world_cities.mbtiles b/tests/fixtures/files/invalid_zoomed_world_cities.mbtiles similarity index 100% rename from tests/fixtures/files/invalid/invalid_zoomed_world_cities.mbtiles rename to tests/fixtures/files/invalid_zoomed_world_cities.mbtiles diff --git a/tests/fixtures/files/geography-class-jpg-diff.mbtiles b/tests/fixtures/mbtiles/geography-class-jpg-diff.mbtiles similarity index 100% rename from tests/fixtures/files/geography-class-jpg-diff.mbtiles rename to tests/fixtures/mbtiles/geography-class-jpg-diff.mbtiles diff --git a/tests/fixtures/files/geography-class-jpg-modified.mbtiles b/tests/fixtures/mbtiles/geography-class-jpg-modified.mbtiles similarity index 100% rename from tests/fixtures/files/geography-class-jpg-modified.mbtiles rename to tests/fixtures/mbtiles/geography-class-jpg-modified.mbtiles diff --git a/tests/fixtures/files/geography-class-jpg.mbtiles b/tests/fixtures/mbtiles/geography-class-jpg.mbtiles similarity index 100% rename from tests/fixtures/files/geography-class-jpg.mbtiles rename to tests/fixtures/mbtiles/geography-class-jpg.mbtiles diff --git a/tests/fixtures/files/geography-class-png-no-bounds.mbtiles b/tests/fixtures/mbtiles/geography-class-png-no-bounds.mbtiles similarity index 100% rename from tests/fixtures/files/geography-class-png-no-bounds.mbtiles rename to tests/fixtures/mbtiles/geography-class-png-no-bounds.mbtiles diff --git a/tests/fixtures/files/geography-class-png.mbtiles b/tests/fixtures/mbtiles/geography-class-png.mbtiles similarity index 100% rename from tests/fixtures/files/geography-class-png.mbtiles rename to tests/fixtures/mbtiles/geography-class-png.mbtiles diff --git a/tests/fixtures/files/json.mbtiles b/tests/fixtures/mbtiles/json.mbtiles similarity index 100% rename from tests/fixtures/files/json.mbtiles rename to tests/fixtures/mbtiles/json.mbtiles diff --git a/tests/fixtures/files/uncompressed_mvt.mbtiles b/tests/fixtures/mbtiles/uncompressed_mvt.mbtiles similarity index 100% rename from tests/fixtures/files/uncompressed_mvt.mbtiles rename to tests/fixtures/mbtiles/uncompressed_mvt.mbtiles diff --git a/tests/fixtures/files/webp.mbtiles b/tests/fixtures/mbtiles/webp.mbtiles similarity index 100% rename from tests/fixtures/files/webp.mbtiles rename to tests/fixtures/mbtiles/webp.mbtiles diff --git a/tests/fixtures/files/world_cities.mbtiles b/tests/fixtures/mbtiles/world_cities.mbtiles similarity index 100% rename from tests/fixtures/files/world_cities.mbtiles rename to tests/fixtures/mbtiles/world_cities.mbtiles diff --git a/tests/fixtures/files/world_cities_diff.mbtiles b/tests/fixtures/mbtiles/world_cities_diff.mbtiles similarity index 100% rename from tests/fixtures/files/world_cities_diff.mbtiles rename to tests/fixtures/mbtiles/world_cities_diff.mbtiles diff --git a/tests/fixtures/files/world_cities_modified.mbtiles b/tests/fixtures/mbtiles/world_cities_modified.mbtiles similarity index 100% rename from tests/fixtures/files/world_cities_modified.mbtiles rename to tests/fixtures/mbtiles/world_cities_modified.mbtiles diff --git a/tests/fixtures/files/zoomed_world_cities.mbtiles b/tests/fixtures/mbtiles/zoomed_world_cities.mbtiles similarity index 100% rename from tests/fixtures/files/zoomed_world_cities.mbtiles rename to tests/fixtures/mbtiles/zoomed_world_cities.mbtiles diff --git a/tests/fixtures/files/png.pmtiles b/tests/fixtures/pmtiles/png.pmtiles similarity index 100% rename from tests/fixtures/files/png.pmtiles rename to tests/fixtures/pmtiles/png.pmtiles diff --git a/tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles b/tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles similarity index 100% rename from tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles rename to tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles diff --git a/tests/fixtures/files/webp2.pmtiles b/tests/fixtures/pmtiles/webp2.pmtiles similarity index 100% rename from tests/fixtures/files/webp2.pmtiles rename to tests/fixtures/pmtiles/webp2.pmtiles diff --git a/tests/mb_server_test.rs b/tests/mb_server_test.rs index 912c92a0f..94e1d1dff 100644 --- a/tests/mb_server_test.rs +++ b/tests/mb_server_test.rs @@ -34,10 +34,10 @@ fn test_get(path: &str) -> TestRequest { const CONFIG: &str = indoc! {" mbtiles: sources: - m_json: tests/fixtures/files/json.mbtiles - m_mvt: tests/fixtures/files/world_cities.mbtiles - m_raw_mvt: tests/fixtures/files/uncompressed_mvt.mbtiles - m_webp: tests/fixtures/files/webp.mbtiles + m_json: tests/fixtures/mbtiles/json.mbtiles + m_mvt: tests/fixtures/mbtiles/world_cities.mbtiles + m_raw_mvt: tests/fixtures/mbtiles/uncompressed_mvt.mbtiles + m_webp: tests/fixtures/mbtiles/webp.mbtiles "}; #[actix_rt::test] diff --git a/tests/pmt_server_test.rs b/tests/pmt_server_test.rs index bcb81da41..916601a87 100644 --- a/tests/pmt_server_test.rs +++ b/tests/pmt_server_test.rs @@ -34,12 +34,12 @@ fn test_get(path: &str) -> TestRequest { const CONFIG: &str = indoc! {" pmtiles: sources: - p_png: tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles + p_png: tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles "}; #[actix_rt::test] async fn pmt_get_catalog() { - let path = "pmtiles: tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles"; + let path = "pmtiles: tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles"; let app = create_app! { path }; let req = test_get("/catalog").to_request(); diff --git a/tests/test.sh b/tests/test.sh index 6d9fdde17..ab47e712a 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -150,7 +150,7 @@ echo "Test auto configured Martin" TEST_OUT_DIR="$(dirname "$0")/output/auto" mkdir -p "$TEST_OUT_DIR" -ARG=(--default-srid 900913 --disable-bounds --save-config "$(dirname "$0")/output/generated_config.yaml" tests/fixtures/files) +ARG=(--default-srid 900913 --disable-bounds --save-config "$(dirname "$0")/output/generated_config.yaml" tests/fixtures/mbtiles tests/fixtures/pmtiles) set -x $MARTIN_BIN "${ARG[@]}" 2>&1 | tee test_log_1.txt & PROCESS_ID=`jobs -p` @@ -289,11 +289,11 @@ if [[ "$MBTILES_BIN" != "-" ]]; then $MBTILES_BIN --help 2>&1 | tee "$TEST_OUT_DIR/help.txt" $MBTILES_BIN meta-all --help 2>&1 | tee "$TEST_OUT_DIR/meta-all_help.txt" - $MBTILES_BIN meta-all ./tests/fixtures/files/world_cities.mbtiles 2>&1 | tee "$TEST_OUT_DIR/meta-all.txt" + $MBTILES_BIN meta-all ./tests/fixtures/mbtiles/world_cities.mbtiles 2>&1 | tee "$TEST_OUT_DIR/meta-all.txt" $MBTILES_BIN meta-get --help 2>&1 | tee "$TEST_OUT_DIR/meta-get_help.txt" - $MBTILES_BIN meta-get ./tests/fixtures/files/world_cities.mbtiles name 2>&1 | tee "$TEST_OUT_DIR/meta-get_name.txt" - $MBTILES_BIN meta-get ./tests/fixtures/files/world_cities.mbtiles missing_value 2>&1 | tee "$TEST_OUT_DIR/meta-get_missing_value.txt" - $MBTILES_BIN validate ./tests/fixtures/files/zoomed_world_cities.mbtiles 2>&1 | tee "$TEST_OUT_DIR/validate-ok.txt" + $MBTILES_BIN meta-get ./tests/fixtures/mbtiles/world_cities.mbtiles name 2>&1 | tee "$TEST_OUT_DIR/meta-get_name.txt" + $MBTILES_BIN meta-get ./tests/fixtures/mbtiles/world_cities.mbtiles missing_value 2>&1 | tee "$TEST_OUT_DIR/meta-get_missing_value.txt" + $MBTILES_BIN validate ./tests/fixtures/mbtiles/zoomed_world_cities.mbtiles 2>&1 | tee "$TEST_OUT_DIR/validate-ok.txt" set +e $MBTILES_BIN validate ./tests/fixtures/files/bad_hash.mbtiles 2>&1 | tee "$TEST_OUT_DIR/validate-bad.txt" @@ -309,14 +309,14 @@ if [[ "$MBTILES_BIN" != "-" ]]; then # Create diff file $MBTILES_BIN copy \ - ./tests/fixtures/files/world_cities.mbtiles \ + ./tests/fixtures/mbtiles/world_cities.mbtiles \ "$TEST_TEMP_DIR/world_cities_diff.mbtiles" \ - --diff-with-file ./tests/fixtures/files/world_cities_modified.mbtiles \ + --diff-with-file ./tests/fixtures/mbtiles/world_cities_modified.mbtiles \ 2>&1 | tee "$TEST_OUT_DIR/copy_diff.txt" if command -v sqlite3 > /dev/null; then # Apply this diff to the original version of the file - cp ./tests/fixtures/files/world_cities.mbtiles "$TEST_TEMP_DIR/world_cities_copy.mbtiles" + cp ./tests/fixtures/mbtiles/world_cities.mbtiles "$TEST_TEMP_DIR/world_cities_copy.mbtiles" sqlite3 "$TEST_TEMP_DIR/world_cities_copy.mbtiles" \ -bail \ @@ -328,7 +328,7 @@ if [[ "$MBTILES_BIN" != "-" ]]; then # Ensure that applying the diff resulted in the modified version of the file $MBTILES_BIN copy \ --diff-with-file "$TEST_TEMP_DIR/world_cities_copy.mbtiles" \ - ./tests/fixtures/files/world_cities_modified.mbtiles \ + ./tests/fixtures/mbtiles/world_cities_modified.mbtiles \ "$TEST_TEMP_DIR/world_cities_diff_modified.mbtiles" \ 2>&1 | tee "$TEST_OUT_DIR/copy_diff2.txt"