Skip to content

Commit

Permalink
Randomize namespace to avoid false successes (#20775)
Browse files Browse the repository at this point in the history
* add randomization to namespace testing

* formatting
  • Loading branch information
jbfbell authored Jan 4, 2023
1 parent e39e189 commit 3a9dd2f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.airbyte.commons.json.Jsons;
import io.airbyte.commons.lang.Exceptions;
import io.airbyte.commons.resources.MoreResources;
import io.airbyte.commons.string.Strings;
import io.airbyte.commons.util.MoreIterators;
import io.airbyte.config.EnvConfigs;
import io.airbyte.config.JobGetSpecConfig;
Expand Down Expand Up @@ -986,7 +987,10 @@ void testSyncUsesAirbyteStreamNamespaceIfNotNull() throws Exception {
Jsons.deserialize(
MoreResources.readResource(DataArgumentsProvider.EXCHANGE_RATE_CONFIG.getCatalogFileVersion(getProtocolVersion())),
AirbyteCatalog.class);
final String namespace = "sourcenamespace";
// A randomized namespace is required otherwise you can generate a "false success" with data from a
// previous run.
final String namespace = Strings.addRandomSuffix("airbyte_source_namespace", "_", 8);

catalog.getStreams().forEach(stream -> stream.setNamespace(namespace));
final ConfiguredAirbyteCatalog configuredCatalog = CatalogHelpers.toDefaultConfiguredCatalog(
catalog);
Expand Down

0 comments on commit 3a9dd2f

Please sign in to comment.