Skip to content

Commit

Permalink
Adds an integration test for the new schema --arrow functionality
Browse files Browse the repository at this point in the history
- This follows the pattern of the other schema --json test. It could
  definitely do more (like parse the json output), but it's consistent
  with what's currently there.
- Fixed a different json test that was failing as the sorting order in
  the json has changed in the arrow libs.
  • Loading branch information
wynnw committed Jun 13, 2024
1 parent b207144 commit f0e4854
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ static CAT_OUTPUT: &str = r#"{continent: "Europe", country: {name: "France", cit
{continent: "Europe", country: {name: "Greece", city: ["Athens", "Piraeus", "Hania", "Heraklion", "Rethymnon", "Fira"]}}
{continent: "North America", country: {name: "Canada", city: ["Toronto", "Vancouver", "St. John's", "Saint John", "Montreal", "Halifax", "Winnipeg", "Calgary", "Saskatoon", "Ottawa", "Yellowknife"]}}
"#;
static CAT_JSON_OUTPUT: &str = r#"{"continent":"Europe","country":{"city":["Paris","Nice","Marseilles","Cannes"],"name":"France"}}
{"continent":"Europe","country":{"city":["Athens","Piraeus","Hania","Heraklion","Rethymnon","Fira"],"name":"Greece"}}
{"continent":"North America","country":{"city":["Toronto","Vancouver","St. John's","Saint John","Montreal","Halifax","Winnipeg","Calgary","Saskatoon","Ottawa","Yellowknife"],"name":"Canada"}}
static CAT_JSON_OUTPUT: &str = r#"{"continent":"Europe","country":{"name":"France","city":["Paris","Nice","Marseilles","Cannes"]}}
{"continent":"Europe","country":{"name":"Greece","city":["Athens","Piraeus","Hania","Heraklion","Rethymnon","Fira"]}}
{"continent":"North America","country":{"name":"Canada","city":["Toronto","Vancouver","St. John's","Saint John","Montreal","Halifax","Winnipeg","Calgary","Saskatoon","Ottawa","Yellowknife"]}}
"#;
static CAT_CSV_OUTPUT: &str = r#"foo,bar
1,2
Expand Down Expand Up @@ -195,6 +195,21 @@ mod integration {
Ok(())
}

#[test]
fn validate_schema_arrow() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("pqrs")?;
cmd.arg("schema").arg("--arrow").arg(CITIES_PARQUET_PATH);
cmd.assert().success().stdout(
predicate::str::contains("\"fields\": [")
.and(predicate::str::contains("\"name\": \"continent\","))
.and(predicate::str::contains("\"name\": \"country\","))
);

// TODO: validate that the stdout is parseable json and can be read by the arrow libs

Ok(())
}

#[test]
fn validate_uncompressed_size() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("pqrs")?;
Expand Down

0 comments on commit f0e4854

Please sign in to comment.