Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tests/bigquery/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,49 @@ pub async fn job_service_poller_error() -> Result<()> {

Ok(())
}

pub async fn job_service_poller_heavy() -> Result<()> {
let project_id = project_id()?;
let client = JobService::builder().build().await?;
cleanup_stale_jobs(&client, &project_id).await?;

let job_id = random_job_id();
println!("CREATING JOB (HEAVY POLLER) ID: {job_id}");

let query = "SELECT count(*) FROM UNNEST(GENERATE_ARRAY(1, 1000000)), UNNEST(GENERATE_ARRAY(1, 100)) as foo";

let job = client
.insert_job()
.set_project_id(&project_id)
.set_job(
Job::new()
.set_job_reference(JobReference::new().set_job_id(&job_id))
.set_configuration(
JobConfiguration::new()
.set_labels([(INSTANCE_LABEL, "true")])
.set_query(
JobConfigurationQuery::new()
.set_query(query)
.set_use_legacy_sql(false),
),
),
)
.into_job_poller()
.until_done()
.await?;

assert!(job.job_reference.is_some(), "{job:?}");
let status = job.status.as_ref().expect("job should have status");
assert_eq!(status.state.as_str(), "DONE");
assert!(
status.error_result.is_none(),
"job completed with unexpected error_result: {:?}",
status.error_result
);

Ok(())
}

#[cfg(test)]
mod tests {
use anyhow::Result;
Expand Down
4 changes: 3 additions & 1 deletion tests/bigquery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use rand::{RngExt, distr::Alphanumeric};
const INSTANCE_LABEL: &str = "rust-sdk-integration-test";

pub use dataset::dataset_admin;
pub use job::{job_service, job_service_poller, job_service_poller_error};
pub use job::{
job_service, job_service_poller, job_service_poller_error, job_service_poller_heavy,
};
pub use query::{
query_client, query_client_datatypes, query_client_job, query_client_multi_page,
query_client_nested_types, query_client_numeric_limits,
Expand Down
8 changes: 8 additions & 0 deletions tests/bigquery/tests/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ mod bigquery {
.inspect_err(anydump)
}

#[tokio::test]
async fn run_job_service_poller_heavy() -> anyhow::Result<()> {
let _guard = enable_tracing();
integration_tests_bigquery::job_service_poller_heavy()
.await
.inspect_err(anydump)
}

#[tokio::test]
async fn run_job_service_poller() -> anyhow::Result<()> {
let _guard = enable_tracing();
Expand Down
Loading