refactor: Make `server` an implementation detail (#4122)

pull/24376/head
Andrew Lamb 2022-03-24 11:58:04 -04:00 committed by GitHub
parent 5c69a3f43b
commit 39d9f30f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 6 deletions

View File

@ -36,14 +36,18 @@ async fn smoke() {
// Write some data into the v2 HTTP API ==============
let lp = format!("{},tag1=A,tag2=B val=42i 123456", table_name);
let response = write_to_router(lp, org, bucket, all_in_one.server.router_http_base()).await;
let response = write_to_router(lp, org, bucket, all_in_one.server().router_http_base()).await;
assert_eq!(response.status(), StatusCode::NO_CONTENT);
// run query in a loop until the data becomes available
let sql = format!("select * from {}", table_name);
let batches =
query_until_results(sql, namespace, all_in_one.server.querier_grpc_connection()).await;
let batches = query_until_results(
sql,
namespace,
all_in_one.server().querier_grpc_connection(),
)
.await;
let expected = [
"+------+------+--------------------------------+-----+",

View File

@ -35,7 +35,7 @@ async fn router2_through_ingester() {
// Write some data into the v2 HTTP API ==============
let lp = format!("{},tag1=A,tag2=B val=42i 123456", table_name);
let response = write_to_router(lp, org, bucket, router2.server.router_http_base()).await;
let response = write_to_router(lp, org, bucket, router2.server().router_http_base()).await;
assert_eq!(response.status(), StatusCode::NO_CONTENT);
@ -56,7 +56,7 @@ async fn router2_through_ingester() {
let ingester = ServerFixture::create_single_use_with_config(test_config).await;
let mut querier_flight =
querier::flight::Client::new(ingester.server.ingester_grpc_connection());
querier::flight::Client::new(ingester.server().ingester_grpc_connection());
let query = IngesterQueryRequest::new(
namespace,

View File

@ -18,7 +18,7 @@ use super::{addrs::BindAddresses, ServerType, TestConfig};
/// Represents a server that has been started and is available for
/// testing.
pub struct ServerFixture {
pub server: Arc<TestServer>,
server: Arc<TestServer>,
}
impl ServerFixture {
@ -66,6 +66,12 @@ impl ServerFixture {
pub fn dir(&self) -> &Path {
self.server.dir.path()
}
/// Get a reference to the underlying server.
#[must_use]
pub fn server(&self) -> &TestServer {
self.server.as_ref()
}
}
#[derive(Debug)]