Skip to content

Commit 06f6e42

Browse files
authored
Fix: Rand generator is not set in a test suite which result in accessing nil pointer during runtime if run the only test suite (#166)
* Add make flag to filter test case Signed-off-by: Qifan Deng <[email protected]> * Init random generator in Check random latencies test suite Signed-off-by: Qifan Deng <[email protected]> --------- Signed-off-by: Qifan Deng <[email protected]>
1 parent 703735d commit 06f6e42

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ format: ## Format Go source files
7777
.PHONY: test
7878
test: check-ginkgo download-tokenizer download-zmq ## Run tests
7979
@printf "\033[33;1m==== Running tests ====\033[0m\n"
80+
ifdef GINKGO_FOCUS
81+
CGO_ENABLED=1 ginkgo -ldflags="$(GO_LDFLAGS)" -v -r --focus="$(GINKGO_FOCUS)"
82+
else
8083
CGO_ENABLED=1 ginkgo -ldflags="$(GO_LDFLAGS)" -v -r
84+
endif
8185

8286
.PHONY: post-deploy-test
8387
post-deploy-test: ## Run post deployment tests

pkg/llm-d-inference-sim/simulator_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"net/http"
2626
"os"
2727
"strings"
28+
"time"
2829

2930
"github.com/llm-d/llm-d-inference-sim/pkg/common"
3031
. "github.com/onsi/ginkgo/v2"
@@ -754,6 +755,8 @@ var _ = Describe("Simulator", func() {
754755
KVCacheTransferLatency: 2048,
755756
KVCacheTransferLatencyStdDev: 2048,
756757
}
758+
759+
common.InitRandom(time.Now().UnixNano())
757760
})
758761

759762
DescribeTable("should calculate inter token latency correctly",

0 commit comments

Comments
 (0)