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

Added e2e tests with snapshot and cdc- Draft PR #103

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Added e2e tests with snapshot and cdc- Draft PR #103

wants to merge 14 commits into from

Conversation

yjhawar
Copy link
Contributor

@yjhawar yjhawar commented Apr 4, 2023

No description provided.

@yjhawar yjhawar requested a review from sumitjnn April 4, 2023 18:48
@yjhawar yjhawar added the build label Apr 4, 2023
Comment on lines 19 to 44
# Scenario: Sanity test from Oracle to Big Query
# Given Open DataFusion Project with replication to configure pipeline
# When Enter input plugin property: "name" with value: "pipelineName"
# And Click on the Next button
# And Select Oracle as Source
# Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
# Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
# Then Click plugin property: "region"
# Then Click plugin property: "regionOption"
# Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
# Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
# Then Replace input plugin property: "sid" with value: "database" for Credentials and Authorization related fields
# Then Click on the Next button
# Then Replace input plugin property: "loadInterval" with value: "loadInterval"
# Then Click on the Next button
# Then Validate Table is available and can be selected "ABC.E2E-sanity"
# And Click on the Next button
# And Click on the Next button
# And Click on the Next button
# Then Deploy the replication pipeline
# And Run the replication Pipeline
# Then Open the logs
# And Wait till pipeline is in running state and check if no errors occurred
# Then Verify expected Oracle records in target BigQuery table
# And Capture raw logs
# Then Close the pipeline logs and stop the pipeline
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 comment block be removed?

# And Capture raw logs
# Then Close the pipeline logs and stop the pipeline

# @ORACLE_SOURCE
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the significance of this annotation? Why is it commented out?

# Then Close the pipeline logs and stop the pipeline

# @ORACLE_SOURCE
Scenario: To verify snapshot and cdc from Oracle to Big Query successfully
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Scenario: To verify snapshot and cdc from Oracle to Big Query successfully
Scenario: To verify replication of snapshot and cdc data from Oracle to Big Query successfully

Comment on lines 33 to 42
datatypeColumnsForSanityTesting=('USER1', 'M','ABCDEF','ABC','ABC','�','� 好�?�?','� 好�?�?','AAAAaoAATAAABrXAAA',1234,1234.56789,\
1234.56789,1234.56789,1234.56789,1234.56789,1234.56789,1234.56789,1234.5679,\
1234.56789,1234.5679,1234.5679,1234.56789,TIMESTAMP'2023-01-01 2:00:00',TIMESTAMP'2023-01-01 2:00:00',\
TIMESTAMP '2023-01-01 00:00:00.000000')

datatypeValuesForSanityTesting=('USER1', 'M','ABCDEF','ABC','ABC','�','� 好�?�?','� 好�?�?',\
'AAAAaoAATAAABrXAAA',1234,1234.56789,\
1234.56789,1234.56789,1234.56789,1234.56789,1234.56789,1234.56789,1234.5679,\
1234.56789,1234.5679,1234.5679,1234.56789,TIMESTAMP'2023-01-01 2:00:00',TIMESTAMP'2023-01-01 2:00:00',\
TIMESTAMP '2023-01-01 00:00:00.000000')
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason for storing these in property file? Are we storing rows and types like this for existing e2e tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.For connectors, it is done this way.


public static void waitTillPipelineIsRunningAndCheckForErrors() throws InterruptedException {
//wait for datastream to startup
int defaultTimeout = Integer.parseInt(PluginPropertyUtils.pluginProp("datastream.timeout"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename it to more general term like pipeline initialization time instead of datastream.timeout

bqRow.remove("_is_deleted");
bqRow.remove("_sequence_num");

ValidationHelper.compareBothResponses( bqRow, oracleRecord);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ValidationHelper.compareBothResponses( bqRow, oracleRecord);
compareRecords( bqRow, oracleRecord);

if (port!= null && !port.isEmpty()) {
PluginPropertyUtils.addPluginProp("port", port);
}
String sapHost = System.getenv("ORACLE_HOST");
Copy link
Contributor

Choose a reason for hiding this comment

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

oracleHost

@Before(order = 1, value = "@ORACLE_SOURCE")
public static void overridePropertiesFromEnvVarsIfProvided() {
String username = System.getenv("ORACLE_USERNAME");
if (username != null && !username.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens if property is null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test will not run like username is used for creating tables, that will fail thereby ending tests


@Before(order = 4, value = "@ORACLE_SOURCE")
public static void getOracleRecordsAsMap() throws SQLException, ClassNotFoundException {
sourceOracleRecords = OracleClient.getOracleRecordsAsMap(tableName, schemaName);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is for logging expected records before test starts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes


@After(order = 1, value = "@ORACLE_SOURCE_TEMP")
public static void dropTables() throws SQLException, ClassNotFoundException {
OracleClient.deleteTables(schemaName, tableName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we drop BQ table as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we can. But having target table is good for validation after e2e tests are done

@@ -0,0 +1,50 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to rename the file to SanityTests.feature to reflect the intent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants