Skip to content

Commit

Permalink
Adding Spark 3.3 Connector tests (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrabinowitz authored Jan 13, 2023
1 parent 86e3c67 commit 7e57e65
Show file tree
Hide file tree
Showing 27 changed files with 825 additions and 7 deletions.
19 changes: 15 additions & 4 deletions cloudbuild/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ steps:
- 'TEMPORARY_GCS_BUCKET=${_TEMPORARY_GCS_BUCKET}'
- 'BIGLAKE_CONNECTION_ID=${_BIGLAKE_CONNECTION_ID}'

# 4c. Run integration tests concurrently with unit tests (DSv2, Spark 3.2)
# 4e. Run integration tests concurrently with unit tests (DSv2, Spark 3.2)
- name: 'gcr.io/$PROJECT_ID/dataproc-spark-bigquery-connector-presubmit'
id: 'integration-tests-3.2'
waitFor: ['integration-tests-2.4']
Expand All @@ -77,18 +77,29 @@ steps:
- 'TEMPORARY_GCS_BUCKET=${_TEMPORARY_GCS_BUCKET}'
- 'BIGLAKE_CONNECTION_ID=${_BIGLAKE_CONNECTION_ID}'

# 5. Upload coverage to CodeCov
# 4f. Run integration tests concurrently with unit tests (DSv2, Spark 3.3)
- name: 'gcr.io/$PROJECT_ID/dataproc-spark-bigquery-connector-presubmit'
id: 'integration-tests-3.3'
waitFor: ['integration-tests-3.1']
entrypoint: 'bash'
args: ['/workspace/cloudbuild/presubmit.sh', 'integrationtest-3.3']
env:
- 'GOOGLE_CLOUD_PROJECT=${_GOOGLE_CLOUD_PROJECT}'
- 'TEMPORARY_GCS_BUCKET=${_TEMPORARY_GCS_BUCKET}'
- 'BIGLAKE_CONNECTION_ID=${_BIGLAKE_CONNECTION_ID}'

# 5. Upload coverage to CodeCov
- name: 'gcr.io/$PROJECT_ID/dataproc-spark-bigquery-connector-presubmit'
id: 'upload-it-to-codecov'
waitFor: ['integration-tests-2.12','integration-tests-2.13','integration-tests-2.4','integration-tests-3.1','integration-tests-3.2']
waitFor: ['integration-tests-2.12','integration-tests-2.13','integration-tests-2.4','integration-tests-3.1','integration-tests-3.2','integration-tests-3.3']
entrypoint: 'bash'
args: ['/workspace/cloudbuild/presubmit.sh', 'upload-it-to-codecov']
env:
- 'CODECOV_TOKEN=${_CODECOV_TOKEN}'


# Tests take around 30 mins in general.
timeout: 2700s
timeout: 3600s

options:
machineType: 'N1_HIGHCPU_32'
9 changes: 7 additions & 2 deletions cloudbuild/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ case $STEP in
# Download maven and all the dependencies
init)
checkenv
$MVN install -DskipTests -Pdsv1_2.12,dsv1_2.13,dsv2_2.4,dsv2_3.1,dsv2_3.2
$MVN install -DskipTests -Pdsv1_2.12,dsv1_2.13,dsv2_2.4,dsv2_3.1,dsv2_3.2,dsv2_3.3
exit
;;

# Run unit tests
unittest)
$MVN test jacoco:report jacoco:report-aggregate -Pcoverage,dsv1_2.12,dsv1_2.13,dsv2_2.4,dsv2_3.1,dsv2_3.2
$MVN test jacoco:report jacoco:report-aggregate -Pcoverage,dsv1_2.12,dsv1_2.13,dsv2_2.4,dsv2_3.1,dsv2_3.2,dsv2_3.3
# Upload test coverage report to Codecov
bash <(curl -s https://codecov.io/bash) -K -F "${STEP}"
;;
Expand Down Expand Up @@ -69,6 +69,11 @@ case $STEP in
$MVN failsafe:integration-test failsafe:verify jacoco:report jacoco:report-aggregate -Pcoverage,integration,dsv2_3.2
;;

# Run integration tests
integrationtest-3.3)
$MVN failsafe:integration-test failsafe:verify jacoco:report jacoco:report-aggregate -Pcoverage,integration,dsv2_3.3
;;

upload-it-to-codecov)
checkenv
# Upload test coverage report to Codecov
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<module>spark-bigquery-pushdown/spark-3.1-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.2-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.2-bigquery-pushdown_2.13</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.13</module>
</modules>
</profile>
Expand Down Expand Up @@ -123,6 +124,7 @@
<module>spark-bigquery-pushdown/spark-2.4-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.1-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.2-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.12</module>
</modules>
</profile>
<profile>
Expand Down Expand Up @@ -159,6 +161,7 @@
<module>spark-bigquery-pushdown/spark-3.1-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.2-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.2-bigquery-pushdown_2.13</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.13</module>
</modules>
</profile>
Expand Down Expand Up @@ -222,7 +225,9 @@
<module>spark-bigquery-dsv2/spark-3.3-bigquery-lib</module>
<module>spark-bigquery-dsv2/spark-3.3-bigquery</module>
<module>spark-bigquery-pushdown/spark-bigquery-pushdown-parent</module>
<module>spark-bigquery-pushdown/spark-bigquery-pushdown-common_2.12</module>
<module>spark-bigquery-pushdown/spark-bigquery-pushdown-common_2.13</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.12</module>
<module>spark-bigquery-pushdown/spark-3.3-bigquery-pushdown_2.13</module>
</modules>
</profile>
Expand Down
9 changes: 8 additions & 1 deletion spark-bigquery-dsv2/spark-3.3-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<name>BigQuery DataSource v2 for Spark 3.3</name>
<properties>
<spark.version>3.3.0</spark.version>
<shade.skip>false</shade.skip>
</properties>
<licenses>
<license>
Expand All @@ -30,10 +31,16 @@
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-avro_2.13</artifactId>
<artifactId>spark-avro_2.12</artifactId>
<version>${spark.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>spark-3.3-bigquery-pushdown_2.12
</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>spark-3.3-bigquery-pushdown_2.13
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2023 Google LLC
*
* 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
*
* https://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 com.google.cloud.spark.bigquery.acceptance;

public class Spark33BigNumericDataprocServerlessAcceptanceTest
extends BigNumericDataprocServerlessAcceptanceTestBase {

public Spark33BigNumericDataprocServerlessAcceptanceTest() {
super("spark-3.3-bigquery", "2.0");
}

// tests from superclass

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2023 Google LLC
*
* 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
*
* https://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 com.google.cloud.spark.bigquery.acceptance;

import java.util.Collections;
import org.junit.AfterClass;
import org.junit.BeforeClass;

public class Spark33DataprocImage21AcceptanceTest extends DataprocAcceptanceTestBase {

private static AcceptanceTestContext context;

public Spark33DataprocImage21AcceptanceTest() {
super(context, false);
}

@BeforeClass
public static void setup() throws Exception {
context =
DataprocAcceptanceTestBase.setup(
"2.1-debian11", "spark-3.3-bigquery", Collections.emptyList());
}

@AfterClass
public static void tearDown() throws Exception {
DataprocAcceptanceTestBase.tearDown(context);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2023 Google LLC
*
* 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
*
* https://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 com.google.cloud.spark.bigquery.acceptance;

import org.junit.AfterClass;
import org.junit.BeforeClass;

public class Spark33DataprocImage21DisableConscryptAcceptanceTest
extends DataprocAcceptanceTestBase {

private static AcceptanceTestContext context;

public Spark33DataprocImage21DisableConscryptAcceptanceTest() {
super(context, false);
}

@BeforeClass
public static void setup() throws Exception {
context =
DataprocAcceptanceTestBase.setup(
"2.1-debian11", "spark-3.3-bigquery", DISABLE_CONSCRYPT_LIST);
}

@AfterClass
public static void tearDown() throws Exception {
DataprocAcceptanceTestBase.tearDown(context);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2023 Google LLC
*
* 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
*
* https://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 com.google.cloud.spark.bigquery.acceptance;

public class Spark33ReadSheakspeareDataprocServerlessAcceptanceTest
extends ReadSheakspeareDataprocServerlessAcceptanceTestBase {

public Spark33ReadSheakspeareDataprocServerlessAcceptanceTest() {
super("spark-3.3-bigquery", "2.0");
}

// tests from superclass

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2023 Google LLC
*
* 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
*
* https://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 com.google.cloud.spark.bigquery.acceptance;

import org.junit.Ignore;

@Ignore // spark-3.3-bigquery does not support streaming yet
public class Spark33WriteStreamDataprocServerlessAcceptanceTest
extends WriteStreamDataprocServerlessAcceptanceTestBase {

public Spark33WriteStreamDataprocServerlessAcceptanceTest() {
super("spark-3.3-bigquery", "2.0");
}

// tests from superclass

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2018 Google Inc. All Rights Reserved.
*
* 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 com.google.cloud.spark.bigquery.integration;

import com.google.cloud.spark.bigquery.SparkBigQueryConfig;

public class Spark33DirectWriteIntegrationTest extends WriteIntegrationTestBase {

public Spark33DirectWriteIntegrationTest() {
super(SparkBigQueryConfig.WriteMethod.DIRECT);
}

// tests from superclass
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2018 Google Inc. All Rights Reserved.
*
* 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 com.google.cloud.spark.bigquery.integration;

import com.google.cloud.spark.bigquery.SparkBigQueryConfig;
import org.junit.Before;

public class Spark33IndirectWriteIntegrationTest extends WriteIntegrationTestBase {

public Spark33IndirectWriteIntegrationTest() {
super(SparkBigQueryConfig.WriteMethod.INDIRECT);
}

@Before
public void setParquetLoadBehaviour() {
// TODO: make this the default value
spark.conf().set("enableListInference", "true");
}

// tests from superclass

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2023 Google LLC
*
* 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
*
* https://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 com.google.cloud.spark.bigquery.integration;

import com.google.cloud.spark.bigquery.BigQueryConnectorUtils;
import org.junit.Before;

public class Spark33QueryPushdownIntegrationTest extends QueryPushdownIntegrationTestBase {

@Before
public void before() {
BigQueryConnectorUtils.enablePushdownSession(spark);
}
}
Loading

0 comments on commit 7e57e65

Please sign in to comment.