Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkitCLI committed Nov 27, 2024
1 parent e8cd347 commit 0126320
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@BigQueryMultiTable_Sink
Feature: BigQueryMultiTable sink -Verification of BigQuery to BigQueryMultiTable successful data transfer

@BQ_TWO_SOURCE_BQMT_TEST
@BQ_TWO_SOURCE_BQMT_TEST @BQ_TWO_SINK_BQMT_TEST
Scenario: Verify data successfully transferred from BigQuery To BigQueryMultiTable in two new tables
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Source"
Expand Down Expand Up @@ -57,34 +57,162 @@ Feature: BigQueryMultiTable sink -Verification of BigQuery to BigQueryMultiTable
Then Verify the pipeline status is "Succeeded"
Then Validate data transferred from BigQuery To BigQueryMultiTable is equal

# @BQ_SINGLE_SOURCE_BQMT_TEST @BQ_SINK_BQMT_TEST
# Scenario: Verify data successfully transferred from BigQuery To BigQueryMultiTable in one table
# Given Open Datafusion Project to configure pipeline
# When Expand Plugin group in the LHS plugins list: "Source"
# When Select plugin: "BigQuery" from the plugins list as: "Source"
# Then Navigate to the properties page of plugin: "BigQuery"
# Then Replace input plugin property: "project" with value: "projectId"
# Then Replace input plugin property: "dataset" with value: "dataset"
# Then Replace input plugin property: "table" with value: "bqSourceTable"
# Then Click on the Get Schema button
# Then Validate "BigQuery" plugin properties
# Then Close the Plugin Properties page
# When Expand Plugin group in the LHS plugins list: "Sink"
# When Select plugin: "BigQuery Multi Table" from the plugins list as: "Sink"
# Then Connect plugins: "BigQuery" and "BigQuery Multi Table" to establish connection
# Then Navigate to the properties page of plugin: "BigQuery Multi Table"
# And Enter input plugin property: "referenceName" with value: "Reference"
# And Replace input plugin property: "project" with value: "projectId"
# And Enter input plugin property: "datasetProject" with value: "datasetprojectId"
# And Enter input plugin property: "dataset" with value: "dataset"
# Then Override Service account details if set in environment variables
# Then Click plugin property: "flexibleSchema"
# Then Validate "BigQuery Multi Table" plugin properties
# And Close the Plugin Properties page
# Then Save the pipeline
# Then Deploy the pipeline
# Then Run the Pipeline in Runtime
# Then Wait till pipeline is in running state
# Then Open and capture logs
# Then Verify the pipeline status is "Succeeded"
# Then Validate data transferred from BigQuery To BigQueryMultiTable in one table is equal
@BQ_SINGLE_SOURCE_BQMT_TEST @BQ_SINK_BQMT_TEST
Scenario: Verify data successfully transferred from BigQuery To BigQueryMultiTable in one table
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable"
Then Click on the Get Schema button
Then Validate "BigQuery" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery Multi Table" from the plugins list as: "Sink"
Then Connect plugins: "BigQuery" and "BigQuery Multi Table" to establish connection
Then Navigate to the properties page of plugin: "BigQuery Multi Table"
And Enter input plugin property: "referenceName" with value: "Reference"
And Replace input plugin property: "project" with value: "projectId"
And Enter input plugin property: "datasetProject" with value: "datasetprojectId"
And Enter input plugin property: "dataset" with value: "dataset"
Then Override Service account details if set in environment variables
Then Click plugin property: "flexibleSchema"
Then Validate "BigQuery Multi Table" plugin properties
And Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Succeeded"
Then Validate data transferred from BigQuery To BigQueryMultiTable in one table is equal

@BQ_TWO_SOURCE_BQMT_TEST @BQ_EXISTING_TARGET_TEST @BQ_TWO_SINK_BQMT_TEST
Scenario: Verify data successfully transferred from BigQuery To BigQueryMultiTable in two existing tables
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable"
Then Click on the Get Schema button
Then Validate "BigQuery" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery2"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable2"
Then Click on the Get Schema button
Then Validate "BigQuery2" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery Multi Table" from the plugins list as: "Sink"
Then Connect plugins: "BigQuery" and "BigQuery Multi Table" to establish connection
Then Connect plugins: "BigQuery2" and "BigQuery Multi Table" to establish connection
Then Navigate to the properties page of plugin: "BigQuery Multi Table"
And Enter input plugin property: "referenceName" with value: "Reference"
And Replace input plugin property: "project" with value: "projectId"
And Enter input plugin property: "datasetProject" with value: "datasetprojectId"
And Enter input plugin property: "dataset" with value: "dataset"
Then Override Service account details if set in environment variables
Then Click plugin property: "flexibleSchema"
Then Validate "BigQuery Multi Table" plugin properties
And Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Succeeded"
Then Validate data transferred from BigQuery To BigQueryMultiTable is equal

@BQ_TWO_SOURCE_BQMT_TEST @BQ_EXISTING_TARGET_TEST @BQ_TWO_SINK_BQMT_TEST
Scenario: Verify data successfully transferred from BigQuery To BigQueryMultiTable in two existing tables using truncate
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable"
Then Click on the Get Schema button
Then Validate "BigQuery" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery2"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable2"
Then Click on the Get Schema button
Then Validate "BigQuery2" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery Multi Table" from the plugins list as: "Sink"
Then Connect plugins: "BigQuery" and "BigQuery Multi Table" to establish connection
Then Connect plugins: "BigQuery2" and "BigQuery Multi Table" to establish connection
Then Navigate to the properties page of plugin: "BigQuery Multi Table"
And Enter input plugin property: "referenceName" with value: "Reference"
And Replace input plugin property: "project" with value: "projectId"
And Enter input plugin property: "datasetProject" with value: "datasetprojectId"
And Enter input plugin property: "dataset" with value: "dataset"
Then Override Service account details if set in environment variables
Then Click plugin property: "flexibleSchema"
Then Toggle BigQuery sink property truncateTable to true
Then Validate "BigQuery Multi Table" plugin properties
And Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Succeeded"
Then Validate data transferred from BigQuery To BigQueryMultiTable is equal

@BQ_SOURCE_UPDATE_TEST @BQ_EXISTING_TARGET_TEST @BQ_TWO_SINK_BQMT_TEST
Scenario: Verify data successfully transferred from BigQuery To BigQueryMultiTable in two existing tables after updating schema
Given Open Datafusion Project to configure pipeline
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable"
Then Click on the Get Schema button
Then Validate "BigQuery" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Source"
When Select plugin: "BigQuery" from the plugins list as: "Source"
Then Navigate to the properties page of plugin: "BigQuery2"
Then Replace input plugin property: "project" with value: "projectId"
Then Replace input plugin property: "dataset" with value: "dataset"
Then Replace input plugin property: "table" with value: "bqSourceTable2"
Then Click on the Get Schema button
Then Validate "BigQuery2" plugin properties
Then Close the Plugin Properties page
When Expand Plugin group in the LHS plugins list: "Sink"
When Select plugin: "BigQuery Multi Table" from the plugins list as: "Sink"
Then Connect plugins: "BigQuery" and "BigQuery Multi Table" to establish connection
Then Connect plugins: "BigQuery2" and "BigQuery Multi Table" to establish connection
Then Navigate to the properties page of plugin: "BigQuery Multi Table"
And Enter input plugin property: "referenceName" with value: "Reference"
And Replace input plugin property: "project" with value: "projectId"
And Enter input plugin property: "datasetProject" with value: "datasetprojectId"
And Enter input plugin property: "dataset" with value: "dataset"
Then Override Service account details if set in environment variables
Then Click plugin property: "flexibleSchema"
Then Select radio button plugin property: "updateSchema" with value: "true"
Then Validate "BigQuery Multi Table" plugin properties
And Close the Plugin Properties page
Then Save the pipeline
Then Deploy the pipeline
Then Run the Pipeline in Runtime
Then Wait till pipeline is in running state
Then Open and capture logs
Then Verify the pipeline status is "Succeeded"
Then Validate data transferred from BigQuery To BigQueryMultiTable is equal
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ public static void createTempSourceBQTable() throws IOException, InterruptedExce
"@BQ_INSERT_SOURCE_TEST or @BQ_UPDATE_SINK_TEST or @BQ_EXISTING_SOURCE_TEST or @BQ_EXISTING_SINK_TEST or " +
"@BQ_EXISTING_SOURCE_DATATYPE_TEST or @BQ_EXISTING_SINK_DATATYPE_TEST or @BQ_UPSERT_SOURCE_TEST or " +
"@BQ_NULL_MODE_SOURCE_TEST or @BQ_UPDATE_SOURCE_DEDUPE_TEST or @BQ_INSERT_INT_SOURCE_TEST or " +
"@BQ_TIME_SOURCE_TEST or @BQ_UPSERT_DEDUPE_SOURCE_TEST or @BQ_PRIMARY_RECORD_SOURCE_TEST")
"@BQ_TIME_SOURCE_TEST or @BQ_UPSERT_DEDUPE_SOURCE_TEST or @BQ_PRIMARY_RECORD_SOURCE_TEST or" +
" BQ_SINGLE_SOURCE_BQMT_TEST")
public static void deleteTempSourceBQTable() throws IOException, InterruptedException {
BigQueryClient.dropBqQuery(bqSourceTable);
PluginPropertyUtils.removePluginProp("bqSourceTable");
Expand Down Expand Up @@ -1554,7 +1555,7 @@ public static void emptyExistingBigTableInstanceAndTableName() {
bigtableExistingTargetTable = StringUtils.EMPTY;
}

@Before(order = 1, value = "@BQ_EXISTING_TARGET_TEST")
@Before(order = 2, value = "@BQ_EXISTING_TARGET_TEST")
public static void createSinkTables() throws IOException, InterruptedException {
bqTargetTable = PluginPropertyUtils.pluginProp("bqTargetTable");
bqTargetTable2 = PluginPropertyUtils.pluginProp("bqTargetTable2");
Expand Down Expand Up @@ -1604,35 +1605,32 @@ public static void createSourceTables() throws IOException, InterruptedException
PluginPropertyUtils.addPluginProp("bqSourceTable2", bqSourceTable2);
}

@After(order = 1, value = "@BQ_DELETE_TABLES_TEST")
public static void deleteAllBqTables() throws IOException, InterruptedException {
BigQueryClient.dropBqQuery(bqSourceTable);
BigQueryClient.dropBqQuery(bqSourceTable2);
bqTargetTable = PluginPropertyUtils.pluginProp("bqTargetTable");
bqTargetTable2 = PluginPropertyUtils.pluginProp("bqTargetTable2");
BigQueryClient.dropBqQuery(bqTargetTable);
BigQueryClient.dropBqQuery(bqTargetTable2);
PluginPropertyUtils.removePluginProp("bqSourceTable");
PluginPropertyUtils.removePluginProp("bqSourceTable2");
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " deleted successfully");
BeforeActions.scenario.write("BQ source Table2 " + bqSourceTable2 + " deleted successfully");
BeforeActions.scenario.write("BQ target Table " + bqTargetTable + " deleted successfully");
BeforeActions.scenario.write("BQ target Table2 " + bqTargetTable2 + " deleted successfully");
}

@After(order = 1, value = "@BQ_SINK_BQMT_TEST")
// @After(order = 1, value = "@BQ_DELETE_TABLES_TEST")
// public static void deleteAllBqTables() throws IOException, InterruptedException {
// BigQueryClient.dropBqQuery(bqSourceTable);
// BigQueryClient.dropBqQuery(bqSourceTable2);
// bqTargetTable = PluginPropertyUtils.pluginProp("bqTargetTable");
// bqTargetTable2 = PluginPropertyUtils.pluginProp("bqTargetTable2");
// BigQueryClient.dropBqQuery(bqTargetTable);
// BigQueryClient.dropBqQuery(bqTargetTable2);
// PluginPropertyUtils.removePluginProp("bqSourceTable");
// PluginPropertyUtils.removePluginProp("bqSourceTable2");
// BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " deleted successfully");
// BeforeActions.scenario.write("BQ source Table2 " + bqSourceTable2 + " deleted successfully");
// BeforeActions.scenario.write("BQ target Table " + bqTargetTable + " deleted successfully");
// BeforeActions.scenario.write("BQ target Table2 " + bqTargetTable2 + " deleted successfully");
// }

@After(order = 2, value = "@BQ_SINK_BQMT_TEST")
public static void deleteTargetBqmtTable() throws IOException, InterruptedException {
try {
bqTargetTable = PluginPropertyUtils.pluginProp("bqmtTargetTableTabB");
bqTargetTable = PluginPropertyUtils.pluginProp("bqTargetTable");
BigQueryClient.dropBqQuery(bqTargetTable);
BigQueryClient.dropBqQuery(bqSourceTable);
BeforeActions.scenario.write("BQ Target table - " + bqTargetTable + " deleted successfully");
BeforeActions.scenario.write("BQ Source table - " + bqSourceTable + " deleted successfully");
bqTargetTable = StringUtils.EMPTY;
} catch (BigQueryException e) {
if (e.getMessage().contains("Not found: Table")) {
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " does not exist");
BeforeActions.scenario.write("BQ Source Table " + bqSourceTable + " does not exist");
} else {
Assert.fail(e.getMessage());
}
Expand All @@ -1646,4 +1644,47 @@ public static void deleteTempSource2BQTable() throws IOException, InterruptedExc
PluginPropertyUtils.removePluginProp("bqSourceTable2");
BeforeActions.scenario.write("BQ source Table2 " + bqSourceTable2 + " deleted successfully");
}

@After(order = 2, value = "@BQ_TWO_SOURCE_BQMT_TEST or @BQ_SOURCE_UPDATE_TEST")
public static void deleteTwoSourceTables() throws IOException, InterruptedException {
try {
BigQueryClient.dropBqQuery(bqSourceTable);
BigQueryClient.dropBqQuery(bqSourceTable2);
BeforeActions.scenario.write("BQ Source table - " + bqSourceTable + " deleted successfully");
BeforeActions.scenario.write("BQ Source table2 - " + bqSourceTable2 + " deleted successfully");
PluginPropertyUtils.removePluginProp("bqSourceTable");
PluginPropertyUtils.removePluginProp("bqSourceTable2");

} catch (BigQueryException e) {
if (e.getMessage().contains("Not found: Table")) {
BeforeActions.scenario.write("BQ Source Table " + bqSourceTable + " does not exist");
BeforeActions.scenario.write("BQ Source Table2 " + bqSourceTable2 + " does not exist");
} else {
Assert.fail(e.getMessage());
}
}
}

@After(order = 2, value = "@BQ_TWO_SINK_BQMT_TEST")
public static void deleteTwoTargetTables() throws IOException, InterruptedException {
try {
bqTargetTable = PluginPropertyUtils.pluginProp("bqTargetTable");
bqTargetTable2 = PluginPropertyUtils.pluginProp("bqTargetTable2");
BigQueryClient.dropBqQuery(bqTargetTable);
BigQueryClient.dropBqQuery(bqTargetTable2);
BeforeActions.scenario.write("BQ Target table - " + bqTargetTable + " deleted successfully");
BeforeActions.scenario.write("BQ Target table2 - " + bqTargetTable2 + " deleted successfully");
bqTargetTable = StringUtils.EMPTY;
bqTargetTable2 = StringUtils.EMPTY;

} catch (BigQueryException e) {
if (e.getMessage().contains("Not found: Table")) {
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " does not exist");
BeforeActions.scenario.write("BQ Target Table2 " + bqTargetTable2 + " does not exist");
} else {
Assert.fail(e.getMessage());
}
}
}

}

0 comments on commit 0126320

Please sign in to comment.