From 196ad50f5a06f76daa50180a220a8329ff3800c0 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 25 Mar 2022 14:11:03 -0400 Subject: [PATCH] test: add e2e test for schema CLI (#4132) * test: add e2e test for schema CLI * fix: logical confict --- influxdb_iox/tests/end_to_end_ng_cases/ng.rs | 22 +++++++++++++++++-- .../src/server_fixture.rs | 5 +++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/influxdb_iox/tests/end_to_end_ng_cases/ng.rs b/influxdb_iox/tests/end_to_end_ng_cases/ng.rs index 42b7e436db..d95dfbb806 100644 --- a/influxdb_iox/tests/end_to_end_ng_cases/ng.rs +++ b/influxdb_iox/tests/end_to_end_ng_cases/ng.rs @@ -1,4 +1,6 @@ +use assert_cmd::Command; use http::StatusCode; +use predicates::prelude::*; use test_helpers_end_to_end_ng::{ maybe_skip_integration, rand_name, write_to_router, ServerFixture, TestConfig, }; @@ -37,11 +39,11 @@ async fn router2_through_ingester() { querier::QuerierFlightClient::new(ingester.server().ingester_grpc_connection()); let query = IngesterQueryRequest::new( - namespace, + namespace.clone(), sequencer_id, table_name.into(), vec![], - Some(predicate::EMPTY_PREDICATE), + Some(::predicate::EMPTY_PREDICATE), ); let mut performed_query = querier_flight.perform_query(query).await.unwrap(); @@ -58,4 +60,20 @@ async fn router2_through_ingester() { "+------+------+--------------------------------+-----+", ]; assert_batches_sorted_eq!(&expected, &query_results); + + // Validate the output of the schema CLI command + Command::cargo_bin("influxdb_iox") + .unwrap() + .arg("-h") + .arg(router2.server().router_grpc_base().as_ref()) + .arg("schema") + .arg("get") + .arg(namespace) + .assert() + .success() + .stdout( + predicate::str::contains("mytable") + .and(predicate::str::contains("tag1")) + .and(predicate::str::contains("val")), + ); } diff --git a/test_helpers_end_to_end_ng/src/server_fixture.rs b/test_helpers_end_to_end_ng/src/server_fixture.rs index f6597ae0d2..cf5b24aa3a 100644 --- a/test_helpers_end_to_end_ng/src/server_fixture.rs +++ b/test_helpers_end_to_end_ng/src/server_fixture.rs @@ -160,6 +160,11 @@ impl TestServer { self.addrs.router_http_api().client_base() } + /// Return the http base URL for the router gRPC API + pub fn router_grpc_base(&self) -> Arc { + self.addrs.router_grpc_api().client_base() + } + /// Create a connection channel to the specified gRPC endpoint async fn grpc_channel( &self,