apache / apache/beam

BigQueryIO test using FakeBigQueryServices

Open
#19,263 0 comments 0 reactions 0 assignees View on GitHub
bug gcp io java P3
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

The BigQueryIO can be tested using various FakeServices like
* [FakeBigQueryServices.java](https://github.com/apache/beam/blob/master/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/FakeBigQueryServices.java)
* [FakeJobService.java](https://github.com/apache/beam/blob/release-2.4.0/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/FakeJobService.java)
* etc

when we can create FakeBigQueryServices object using FakeDatasetService and FakeJobService. The FakeBigQueryServices should be used with BigQueryIO using withTestServices in order to test in a fake/mock way.

The BigQueryIO has withTestServices annotated as  VisibleForTesting, that means if anybody would like to use FakeBigQueryServices they have to create test cases in test cases under  org.apache.beam.sdk.io.gcp.bigquery package only.

It makes sense to provide these FakeBigQueryServices and testing BigQueryIO, in a way that it can be used by application builder to test them from their application code with any package implementation. 

Imported from Jira [BEAM-6642](https://issues.apache.org/jira/browse/BEAM-6642). Original Jira may contain additional context.
Reported by: asethia.

Contributor guide

Open the contributing guide

Research direction

Read sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/FakeBigQueryServices.java and FakeJobService.java, then inspect BigQueryIO.withTestServices and its visibility. Determine how application code outside the BigQuery package can use the fake services; done means external-package tests can test BigQueryIO with FakeBigQueryServices.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, java
Domain
data, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.