Skip to content

Commit 65d27c1

Browse files
committed
Fix: Rand generator is not set in a test suite which result in accessing nil pointer during runtime if run the only test suite (llm-d#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 d708398 commit 65d27c1

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
@@ -26,6 +26,7 @@ import (
2626
"net/http"
2727
"os"
2828
"strings"
29+
"time"
2930

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

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

0 commit comments

Comments
 (0)