Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve DAT: Random namespace to avoid namespace collision. #29652

Merged
merged 3 commits into from
Aug 22, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1082,12 +1082,13 @@ public void testNamespaces(final String testCaseId,
DataArgumentsProvider.NAMESPACE_CONFIG.getMessageFileVersion(getProtocolVersion())).lines()
.map(record -> Jsons.deserialize(record, AirbyteMessage.class))
.collect(Collectors.toList());
final List<AirbyteMessage> messagesWithNewNamespace = getRecordMessagesWithNewNamespace(
messages, namespace);
final List<AirbyteMessage> messagesWithNewNamespace = getRecordMessagesWithNewNamespace(messages, namespace);

final JsonNode config = getConfig();
try {
runSyncAndVerifyStateOutput(config, messagesWithNewNamespace, configuredCatalog, false);
// Add to the list of schemas to clean up.
TEST_SCHEMAS.add(namespace);
} catch (final Exception e) {
throw new IOException(String.format(
"[Test Case %s] Destination failed to sync data to namespace %s, see \"namespace_test_cases.json for details\"",
Expand Down Expand Up @@ -1805,7 +1806,8 @@ public Stream<? extends Arguments> provideArguments(final ExtensionContext conte
.filter(testCase -> testCase.get("enabled").asBoolean())
.map(testCase -> Arguments.of(
testCase.get("id").asText(),
testCase.get("namespace").asText(),
// Randomise namespace to avoid collisions between tests.
Strings.addRandomSuffix(testCase.get("namespace").asText(), "", 5),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this leave any randomly names schemas or tables in the database at the end of the test? I don't think so...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question - I actually think we already do so today.. it doesn't look like the Redshift Acceptance Test cleans up after itself for this particular case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Snowflake and Redshift are set up to erase entries in the TEST_SCHEMA.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testCase.get("normalized").asText()));
}

Expand Down
Loading