-
Notifications
You must be signed in to change notification settings - Fork 86
Bigtable E2E coverage as per ITN class. #1385
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| # Copyright © 2024 Cask Data, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| # use this file except in compliance with the License. You may obtain a copy of | ||
| # the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations under | ||
| # the License. | ||
| @BigTable @BIGTABLE_SOURCE_TEST | ||
| Feature: BigTable source - Verification of BigTable to BigTable Successful Data Transfer | ||
|
|
||
| @BIGTABLE_SINK_TEST | ||
| Scenario: To verify data is getting transferred from BigTable source table to BigTable sink table | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this test different from 3rd test i.e. "To verify data is getting transferred from BigTable source table to NON existing BigTable sink" ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the difference between 1 and 3 is in first we are validating that source table is here by using validate plugin step line but in 3 we are not validating that and we are simply going as non existing tab. |
||
| Given Open Datafusion Project to configure pipeline | ||
| When Select plugin: "Bigtable" from the plugins list as: "Source" | ||
| When Expand Plugin group in the LHS plugins list: "Sink" | ||
| When Select plugin: "Bigtable" from the plugins list as: "Sink" | ||
| Then Connect plugins: "Bigtable" and "Bigtable2" to establish connection | ||
| Then Navigate to the properties page of plugin: "Bigtable" | ||
| Then Enter input plugin property: "referenceName" with value: "CBTSourceReferenceName" | ||
| Then Replace input plugin property: "project" with value: "projectId" | ||
| Then Enter input plugin property: "instance" with value: "bigtableInstance" | ||
| Then Enter input plugin property: "table" with value: "bigtableSourceTable" | ||
| Then Replace input plugin property: "keyAlias" with value: "id" | ||
| Then Enter key value pairs for plugin property: "columnMappings" with values from json: "cbtsourceMappings" | ||
| Then Select Macro action of output schema property: "outputSchemaMacroInput" and set the value to "macroKeyString" | ||
| Then Validate "Bigtable" plugin properties | ||
| Then Close the Plugin Properties page | ||
| Then Navigate to the properties page of plugin: "Bigtable2" | ||
| Then Enter input plugin property: "referenceName" with value: "CBTSinkReferenceName" | ||
| Then Replace input plugin property: "project" with value: "projectId" | ||
| Then Enter input plugin property: "instance" with value: "bigtableTargetInstance" | ||
| Then Enter input plugin property: "table" with value: "bigtableTargetTable" | ||
| Then Replace input plugin property: "keyAlias" with value: "id" | ||
| Then Enter key value pairs for plugin property: "columnMappings" with values from json: "cbtsinkMappings" | ||
| Then Validate "Bigtable" plugin properties | ||
| Then Close the Plugin Properties page | ||
| Then Save the pipeline | ||
| Then Deploy the pipeline | ||
| Then Run the Pipeline in Runtime | ||
| Then Enter runtime argument value "cbtSourceOutputSchema" for key "macroKeyString" | ||
| Then Run the Pipeline in Runtime with runtime arguments | ||
| Then Wait till pipeline is in running state | ||
| Then Open and capture logs | ||
| Then Verify the pipeline status is "Succeeded" | ||
| Then Validate OUT record count is equal to IN record count | ||
| Then Validate data transferred to target bigtable table with data of source bigtable table | ||
|
|
||
| @EXISTING_BIGTABLE_SINK | ||
| Scenario: To verify data is getting transferred from BigTable source table to existing BigTable sink | ||
| Given Open Datafusion Project to configure pipeline | ||
| When Select plugin: "Bigtable" from the plugins list as: "Source" | ||
| When Expand Plugin group in the LHS plugins list: "Sink" | ||
| When Select plugin: "Bigtable" from the plugins list as: "Sink" | ||
| Then Connect plugins: "Bigtable" and "Bigtable2" to establish connection | ||
| Then Navigate to the properties page of plugin: "Bigtable" | ||
| Then Enter input plugin property: "referenceName" with value: "CBTSourceReferenceName" | ||
| Then Replace input plugin property: "project" with value: "projectId" | ||
| Then Enter input plugin property: "instance" with value: "bigtableInstance" | ||
| Then Enter input plugin property: "table" with value: "bigtableSourceTable" | ||
| Then Replace input plugin property: "keyAlias" with value: "id" | ||
| Then Enter key value pairs for plugin property: "columnMappings" with values from json: "cbtsourceMappings" | ||
| Then Select Macro action of output schema property: "outputSchemaMacroInput" and set the value to "macroKeyString" | ||
| Then Validate "Bigtable" plugin properties | ||
| Then Close the Plugin Properties page | ||
| Then Navigate to the properties page of plugin: "Bigtable2" | ||
| Then Enter input plugin property: "referenceName" with value: "CBTSinkReferenceName" | ||
| Then Replace input plugin property: "project" with value: "projectId" | ||
| Then Enter input plugin property: "instance" with value: "bigtableTargetInstance" | ||
| Then Enter input plugin property: "table" with value: "bigtableTargetExistingTable" | ||
| Then Replace input plugin property: "keyAlias" with value: "id" | ||
| Then Enter key value pairs for plugin property: "columnMappings" with values from json: "cbtsinkMappings" | ||
| Then Validate "Bigtable" plugin properties | ||
| Then Close the Plugin Properties page | ||
| Then Save the pipeline | ||
| Then Deploy the pipeline | ||
| Then Run the Pipeline in Runtime | ||
| Then Enter runtime argument value "cbtSourceOutputSchema" for key "macroKeyString" | ||
| Then Run the Pipeline in Runtime with runtime arguments | ||
| Then Wait till pipeline is in running state | ||
| Then Open and capture logs | ||
| Then Verify the pipeline status is "Succeeded" | ||
| Then Validate OUT record count is equal to IN record count | ||
| Then Validate data transferred to existing target bigtable table with data of source bigtable table | ||
|
|
||
| @BIGTABLE_SINK_TEST | ||
| Scenario: To verify data is getting transferred from unvalidated BigTable source table to BigTable sink table | ||
| Given Open Datafusion Project to configure pipeline | ||
| When Select plugin: "Bigtable" from the plugins list as: "Source" | ||
| When Expand Plugin group in the LHS plugins list: "Sink" | ||
| When Select plugin: "Bigtable" from the plugins list as: "Sink" | ||
| Then Connect plugins: "Bigtable" and "Bigtable2" to establish connection | ||
| Then Navigate to the properties page of plugin: "Bigtable" | ||
| Then Enter input plugin property: "referenceName" with value: "CBTSourceReferenceName" | ||
| Then Replace input plugin property: "project" with value: "projectId" | ||
| Then Enter input plugin property: "instance" with value: "bigtableInstance" | ||
| Then Enter input plugin property: "table" with value: "bigtableSourceTable" | ||
| Then Replace input plugin property: "keyAlias" with value: "id" | ||
| Then Enter key value pairs for plugin property: "columnMappings" with values from json: "cbtsourceMappings" | ||
| Then Select Macro action of output schema property: "outputSchemaMacroInput" and set the value to "macroKeyString" | ||
| Then Close the Plugin Properties page | ||
| Then Navigate to the properties page of plugin: "Bigtable2" | ||
| Then Enter input plugin property: "referenceName" with value: "CBTSinkReferenceName" | ||
| Then Replace input plugin property: "project" with value: "projectId" | ||
| Then Enter input plugin property: "instance" with value: "bigtableTargetInstance" | ||
| Then Enter input plugin property: "table" with value: "bigtableTargetTable" | ||
| Then Replace input plugin property: "keyAlias" with value: "id" | ||
| Then Enter key value pairs for plugin property: "columnMappings" with values from json: "cbtsinkMappings" | ||
| Then Validate "Bigtable" plugin properties | ||
| Then Close the Plugin Properties page | ||
| Then Save the pipeline | ||
| Then Deploy the pipeline | ||
| Then Run the Pipeline in Runtime | ||
| Then Enter runtime argument value "cbtSourceOutputSchema" for key "macroKeyString" | ||
| Then Run the Pipeline in Runtime with runtime arguments | ||
| Then Wait till pipeline is in running state | ||
| Then Open and capture logs | ||
| Then Verify the pipeline status is "Succeeded" | ||
| Then Validate OUT record count is equal to IN record count | ||
| Then Validate data transferred to target bigtable table with data of source bigtable table | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright © 2024 Cask Data, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
|
|
||
| package io.cdap.plugin.bigtable.runners; | ||
|
|
||
| import io.cucumber.junit.Cucumber; | ||
| import io.cucumber.junit.CucumberOptions; | ||
| import org.junit.runner.RunWith; | ||
|
|
||
| /** | ||
| * Test Runner to execute Bigtable testcases. | ||
| */ | ||
| @RunWith(Cucumber.class) | ||
| @CucumberOptions( | ||
| features = {"src/e2e-test/features"}, | ||
| glue = {"io.cdap.plugin.bigtable.stepsdesign", "io.cdap.plugin.common.stepsdesign", "stepsdesign"}, | ||
| tags = {"@BigTable"}, | ||
| monochrome = true, | ||
| plugin = {"pretty", "html:target/cucumber-html-report/bigtable", | ||
| "json:target/cucumber-reports/cucumber-bigtable.json", | ||
| "junit:target/cucumber-reports/cucumber-bigtable.xml"} | ||
| ) | ||
| public class TestRunner { | ||
| } | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /** | ||
| * Package contains the test runner for the Cloud BigTable features. | ||
| */ | ||
|
|
||
| package io.cdap.plugin.bigtable.runners; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * Copyright © 2024 Cask Data, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
|
|
||
| package io.cdap.plugin.bigtable.stepsdesign; | ||
|
sahusanket marked this conversation as resolved.
|
||
|
|
||
| import io.cdap.e2e.utils.PluginPropertyUtils; | ||
| import io.cdap.plugin.common.stepsdesign.TestSetupHooks; | ||
| import io.cdap.plugin.utils.BigTableClient; | ||
| import io.cucumber.java.en.Then; | ||
| import org.apache.hadoop.hbase.client.Get; | ||
| import org.apache.hadoop.hbase.client.Result; | ||
| import org.apache.hadoop.hbase.client.Table; | ||
| import org.apache.hadoop.hbase.util.Bytes; | ||
| import org.junit.Assert; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * BigTable plugin related common test step definitions. | ||
| */ | ||
|
|
||
| public class BigtableBase { | ||
| @Then("Validate data transferred to target bigtable table with data of source bigtable table") | ||
| public void validateDataTransferToTargetBigtableTable() throws IOException { | ||
| Table sinkTable = BigTableClient.getTable(TestSetupHooks.bigTableConnection, | ||
| PluginPropertyUtils.pluginProp("bigtableTargetTable")); | ||
| validateData(sinkTable); | ||
| } | ||
| @Then("Validate data transferred to existing target bigtable table with data of source bigtable table") | ||
| public void validateDataTransferToTargetExistingBigtableTable() throws IOException { | ||
| Table existingSinkTable = BigTableClient.getTable(TestSetupHooks.bigTableExistingTargetTableConnection, | ||
| PluginPropertyUtils.pluginProp("bigtableTargetExistingTable")); | ||
| validateData(existingSinkTable); | ||
| } | ||
| public static void validateData(Table tableToBeValidated) throws IOException { | ||
| Result result = tableToBeValidated.get(new Get(Bytes.toBytes("r1"))); | ||
| Assert.assertTrue(Bytes.toBoolean(result.getValue(Bytes.toBytes("cf1"), Bytes.toBytes("boolean_column")))); | ||
| Assert.assertEquals("bytes", | ||
| Bytes.toString(result.getValue(Bytes.toBytes("cf2"), Bytes.toBytes("bytes_column")))); | ||
| Assert.assertEquals(10.5D, | ||
| Bytes.toDouble(result.getValue(Bytes.toBytes("cf1"), Bytes.toBytes("double_column"))), | ||
| 0.0000001); | ||
| Assert.assertEquals(10.5F, | ||
| Bytes.toFloat(result.getValue(Bytes.toBytes("cf2"), Bytes.toBytes("float_column"))), | ||
| 0.0000001); | ||
| Assert.assertEquals(1, | ||
| Bytes.toInt(result.getValue(Bytes.toBytes("cf1"), Bytes.toBytes("int_column")))); | ||
| Assert.assertEquals(10L, | ||
| Bytes.toLong(result.getValue(Bytes.toBytes("cf2"), Bytes.toBytes("long_column")))); | ||
| Assert.assertEquals("string", | ||
| Bytes.toString(result.getValue(Bytes.toBytes("cf1"), Bytes.toBytes("string_column")))); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| /** | ||
| * Package contains the base for the Cloud BigTable features. | ||
| */ | ||
| package io.cdap.plugin.bigtable.stepsdesign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the logic that before every test begins with deleting instance.
But CLEAN UP should happen after a test is completed.
Please change the logic to add clean up in the AFTER bock.
A test should not have any remaining from a previous run test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added source hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not get this.
What i mean is The
SOURCE TABLEand theSINK TABLEshould be deleted usingAFTERblock.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes they are get delete after the scenarios completes.