Skip to content

Commit

Permalink
Split unit and integration tests (#1900)
Browse files Browse the repository at this point in the history
Split unit and integration tests.

At the moment external contributors can't run integration tests because they have no access to the GCP project used for tests. Split allows to run integration tests only on PR.
  • Loading branch information
Ceridan authored Jan 27, 2025
1 parent acea64d commit 724b92a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run tests
- name: Run unit tests
uses: gcr.io/cloud-builders/bazel:5.4.0
entrypoint: bash
with:
args: ./scripts/run_tests

- name: Run integration tests
uses: gcr.io/cloud-builders/bazel:5.4.0
entrypoint: bash
with:
args: ./scripts/run_integration_tests
12 changes: 12 additions & 0 deletions scripts/run_integration_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e

# Run tslint.
bazel run @nodejs//:yarn
bazel build @npm//tslint/bin:tslint && bazel-bin/external/npm/tslint/bin/tslint.sh --project .

# Run integration tests
bazel test ... \
--test_tag_filters=integration \
--build_tests_only \
--test_env=USE_CLOUD_BUILD_NETWORK=true
6 changes: 4 additions & 2 deletions scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ set -e
bazel run @nodejs//:yarn
bazel build @npm//tslint/bin:tslint && bazel-bin/external/npm/tslint/bin/tslint.sh --project .

# Run all the tests
bazel test ... --build_tests_only --test_env=USE_CLOUD_BUILD_NETWORK=true
# Run unit tests
bazel test ... \
--test_tag_filters=-integration \
--build_tests_only
4 changes: 4 additions & 0 deletions scripts/run_tests_on_cloudbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ set -e
bazel run @nodejs//:yarn config set registry https://us-npm.pkg.dev/artifact-foundry-prod/npm-3p-trusted/
bazel run @nodejs//:npm install

# Run unit tests
./scripts/run_tests

# Run integration tests
./scripts/run_integration_tests
1 change: 1 addition & 0 deletions tests/api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ts_test_suite(
"//tests/api/projects/never_finishes_compiling:files",
"//tests/api/projects/never_finishes_compiling:node_modules",
],
tags = ["integration"],
deps = [
"//cli/api",
"//cli/api/utils",
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/BUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package(default_visibility = ["//visibility:public"])

load("//testing:index.bzl", "ts_test_suite")

package(default_visibility = ["//visibility:public"])

ts_test_suite(
name = "tests",
srcs = [
"utils.ts",
"bigquery.spec.ts",
"utils.ts",
],
data = [
"//test_credentials:bigquery.json",
"//tests/integration/bigquery_project:files",
"//tests/integration/bigquery_project:node_modules",
],
tags = ["integration"],
deps = [
"//cli/api",
"//cli/api/utils",
Expand Down

0 comments on commit 724b92a

Please sign in to comment.