1313// limitations under the License.
1414
1515#include " google/cloud/bigquery_unified/client.h"
16+ #include " google/cloud/bigquery_unified/job_options.h"
1617#include " google/cloud/bigquery_unified/testing_util/status_matchers.h"
1718#include " google/cloud/bigquery_unified/version.h"
1819#include " google/cloud/internal/getenv.h"
@@ -22,6 +23,7 @@ namespace google::cloud::bigquery_unified {
2223GOOGLE_CLOUD_CPP_BIGQUERY_INLINE_NAMESPACE_BEGIN
2324namespace {
2425
26+ using ::google::cloud::bigquery_unified::testing_util::IsOk;
2527using ::testing::Eq;
2628
2729class JobIntegrationTest : public ::testing::Test {
@@ -34,6 +36,35 @@ class JobIntegrationTest : public ::testing::Test {
3436 std::string project_id_;
3537};
3638
39+ TEST_F (JobIntegrationTest, InsertJob) {
40+ namespace bigquery_proto = google::cloud::bigquery::v2;
41+
42+ bigquery_proto::JobConfigurationQuery query;
43+ query.mutable_use_legacy_sql ()->set_value (false );
44+ query.set_query (
45+ " SELECT name, state, year, sum(number) as total "
46+ " FROM `bigquery-public-data.usa_names.usa_1910_2013` "
47+ " WHERE year >= 2000 "
48+ " GROUP BY name, state, year "
49+ " LIMIT 100" );
50+
51+ bigquery_proto::JobConfiguration config;
52+ *config.mutable_query () = query;
53+ config.mutable_labels ()->insert ({" test_suite" , " job_integration_test" });
54+ config.mutable_labels ()->insert ({" test_case" , " insert_job" });
55+
56+ bigquery_proto::Job query_job_request;
57+ *query_job_request.mutable_configuration () = config;
58+ std::shared_ptr<Connection> connection =
59+ google::cloud::bigquery_unified::MakeConnection ();
60+ auto client = google::cloud::bigquery_unified::Client (connection);
61+
62+ auto options =
63+ google::cloud::Options{}.set <BillingProjectOption>(project_id_);
64+ auto query_job = client.InsertJob (query_job_request, options).get ();
65+ EXPECT_THAT (query_job, IsOk ());
66+ }
67+
3768TEST_F (JobIntegrationTest, GetJob) {
3869 namespace bigquery_proto = google::cloud::bigquery::v2;
3970 std::shared_ptr<Connection> connection =
0 commit comments