Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit393f91c

Browse files
committed
fix: add test parallelism limit to make test
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent338e8b5 commit393f91c

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -454,30 +454,28 @@ jobs:
454454
# running in parallel, and dbtestutil.NewDB starts to take more than
455455
# 10s to complete sometimes causing test timeouts. With 16x8=128 tests
456456
# Postgres tends not to choke.
457-
NUM_PARALLEL_PACKAGES=8
458-
NUM_PARALLEL_TESTS=16
457+
export TEST_NUM_PARALLEL_PACKAGES=8
458+
export TEST_NUM_PARALLEL_TESTS=16
459459
# Only the CLI and Agent are officially supported on Windows and the rest are too flaky
460-
PACKAGES="./cli/... ./enterprise/cli/... ./agent/..."
460+
export TEST_PACKAGES="./cli/... ./enterprise/cli/... ./agent/..."
461461
elif [ "${{ runner.os }}" == "macOS" ]; then
462462
# Our macOS runners have 8 cores. We set NUM_PARALLEL_TESTS to 16
463463
# because the tests complete faster and Postgres doesn't choke. It seems
464464
# that macOS's tmpfs is faster than the one on Windows.
465-
NUM_PARALLEL_PACKAGES=8
466-
NUM_PARALLEL_TESTS=16
465+
export TEST_NUM_PARALLEL_PACKAGES=8
466+
export TEST_NUM_PARALLEL_TESTS=16
467467
# Only the CLI and Agent are officially supported on macOS and the rest are too flaky
468-
PACKAGES="./cli/... ./enterprise/cli/... ./agent/..."
468+
export TEST_PACKAGES="./cli/... ./enterprise/cli/... ./agent/..."
469469
elif [ "${{ runner.os }}" == "Linux" ]; then
470470
# Our Linux runners have 8 cores.
471-
NUM_PARALLEL_PACKAGES=8
472-
NUM_PARALLEL_TESTS=8
473-
PACKAGES="./..."
471+
export TEST_NUM_PARALLEL_PACKAGES=8
472+
export TEST_NUM_PARALLEL_TESTS=8
474473
fi
475474
476475
# by default, run tests with cache
477-
TESTCOUNT=""
478476
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
479477
# on main, run tests without cache
480-
TESTCOUNT="-count=1"
478+
export TEST_COUNT="1"
481479
fi
482480
483481
mkdir -p "$RUNNER_TEMP/sym"
@@ -487,8 +485,7 @@ jobs:
487485
# invalidated. See scripts/normalize_path.sh for more details.
488486
normalize_path_with_symlinks "$RUNNER_TEMP/sym" "$(dirname $(which terraform))"
489487
490-
gotestsum --format standard-quiet --packages "$PACKAGES" \
491-
-- -timeout=20m -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
488+
make test
492489
493490
-name:Upload failed test db dumps
494491
uses:actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02# v4.6.2

‎Makefile‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,12 +942,31 @@ else
942942
GOTESTSUM_RETRY_FLAGS :=
943943
endif
944944

945+
# default to 8x8 parallelism to avoid overwhelming our workspaces. Hopefully we can remove these defaults
946+
# when we get our test suite's resource utilization under control.
947+
GOTEST_FLAGS := -v -p$(or$(TEST_NUM_PARALLEL_PACKAGES),"8") -parallel=$(or$(TEST_NUM_PARALLEL_TESTS),"8")
948+
949+
# The most common use is to set TEST_COUNT=1 to avoid Go's test cache.
950+
ifdefTEST_COUNT
951+
GOTEST_FLAGS += -count=$(TEST_COUNT)
952+
endif
953+
954+
ifdefTEST_SHORT
955+
GOTEST_FLAGS += -short
956+
endif
957+
958+
ifdefRUN
959+
GOTEST_FLAGS += -run$(RUN)
960+
endif
961+
962+
TEST_PACKAGES ?= ./...
963+
945964
test:
946-
$(GIT_FLAGS) gotestsum --format standard-quiet$(GOTESTSUM_RETRY_FLAGS) --packages="./..." ---v -short -count=1$(if$(RUN),-run$(RUN))
965+
$(GIT_FLAGS) gotestsum --format standard-quiet$(GOTESTSUM_RETRY_FLAGS) --packages="$(TEST_PACKAGES)" --$(GOTEST_FLAGS)
947966
.PHONY: test
948967

949968
test-cli:
950-
$(GIT_FLAGS) gotestsum --format standard-quiet$(GOTESTSUM_RETRY_FLAGS) --packages="./cli/..." -- -v -short -count=1
969+
$(MAKE)test TEST_PACKAGES="./cli..."
951970
.PHONY: test-cli
952971

953972
# sqlc-cloud-is-setup will fail if no SQLc auth token is set. Use this as a

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp