Skip to content

Commit

Permalink
test: metadata cache query using JSON format (#25626)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltontj authored Dec 6, 2024
1 parent 154ff7d commit ef3599d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions influxdb3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ arrow-flight.workspace = true
assert_cmd.workspace = true
futures.workspace = true
hyper.workspace = true
insta.workspace = true
pretty_assertions.workspace = true
reqwest.workspace = true
serde_json.workspace = true
Expand Down
14 changes: 14 additions & 0 deletions influxdb3/tests/server/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,4 +1308,18 @@ async fn api_v3_query_sql_meta_cache() {
",
resp
);

// do the query using JSON format:
let resp = server
.api_v3_query_sql(&[
("db", "foo"),
("format", "json"),
("q", "SELECT * FROM meta_cache('cpu')"),
])
.await
.json::<Value>()
.await
.unwrap();

insta::assert_json_snapshot!(resp);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
source: influxdb3/tests/server/query.rs
expression: resp
---
[
{
"host": "c",
"region": "ca"
},
{
"host": "b",
"region": "eu"
},
{
"host": "a",
"region": "us"
}
]

0 comments on commit ef3599d

Please sign in to comment.