-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BIG_QUERY_DEFAULT_PROJECT config to sink (#1321)
- Loading branch information
Showing
3 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ingestion-sink/src/test/java/com/mozilla/telemetry/ingestion/sink/config/SinkConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.mozilla.telemetry.ingestion.sink.config; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import com.google.cloud.bigquery.BigQueryOptions; | ||
import com.google.common.collect.ImmutableSet; | ||
import com.mozilla.telemetry.ingestion.sink.util.Env; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.contrib.java.lang.system.EnvironmentVariables; | ||
|
||
public class SinkConfigTest { | ||
|
||
@Rule | ||
public final EnvironmentVariables environmentVariables = new EnvironmentVariables(); | ||
|
||
@Test | ||
public void canDetectBqProject() { | ||
environmentVariables.set("GOOGLE_CLOUD_PROJECT", "gcp-project"); | ||
environmentVariables.set("BIG_QUERY_DEFAULT_PROJECT", "bq-project"); | ||
Env env = new Env(ImmutableSet.of("BIG_QUERY_DEFAULT_PROJECT")); | ||
assertEquals("gcp-project", BigQueryOptions.getDefaultInstance().getProjectId()); | ||
assertEquals("bq-project", SinkConfig.getBigQueryService(env).getOptions().getProjectId()); | ||
} | ||
} |