@@ -21,6 +21,8 @@ import (
2121 mcpclient "github.com/vllm-project/semantic-router/src/semantic-router/pkg/mcp"
2222)
2323
24+ const testModelsDir = "../../../../models"
25+
2426func TestClassifier (t * testing.T ) {
2527 RegisterFailHandler (Fail )
2628 RunSpecs (t , "Classifier Suite" )
@@ -2909,13 +2911,11 @@ func createMockModelFile(t *testing.T, dir, filename string) {
29092911
29102912func TestAutoDiscoverModels_RealModels (t * testing.T ) {
29112913 // Test with real models directory
2912- modelsDir := "../../../../../models"
2914+ modelsDir := testModelsDir
29132915
29142916 paths , err := AutoDiscoverModels (modelsDir )
29152917 if err != nil {
2916- // Skip this test in environments without the real models directory
2917- t .Logf ("AutoDiscoverModels() failed in real-models test: %v" , err )
2918- t .Skip ("Skipping real-models discovery test because models directory is unavailable" )
2918+ t .Fatalf ("AutoDiscoverModels() failed: %v (models directory should exist at %s)" , err , modelsDir )
29192919 }
29202920
29212921 t .Logf ("Discovered paths:" )
@@ -2964,10 +2964,9 @@ func TestAutoDiscoverModels_RealModels(t *testing.T) {
29642964// TestAutoInitializeUnifiedClassifier tests the full initialization process
29652965func TestAutoInitializeUnifiedClassifier (t * testing.T ) {
29662966 // Test with real models directory
2967- classifier , err := AutoInitializeUnifiedClassifier ("../../../../../models" )
2967+ classifier , err := AutoInitializeUnifiedClassifier (testModelsDir )
29682968 if err != nil {
2969- t .Logf ("AutoInitializeUnifiedClassifier() failed in real-models test: %v" , err )
2970- t .Skip ("Skipping unified classifier init test because real models are unavailable" )
2969+ t .Fatalf ("AutoInitializeUnifiedClassifier() failed: %v (models directory should exist at %s)" , err , testModelsDir )
29712970 }
29722971
29732972 if classifier == nil {
@@ -3305,7 +3304,7 @@ var (
33053304// getTestClassifier returns a shared classifier instance for all integration tests
33063305func getTestClassifier (t * testing.T ) * UnifiedClassifier {
33073306 globalTestClassifierOnce .Do (func () {
3308- classifier , err := AutoInitializeUnifiedClassifier ("../../../../../models" )
3307+ classifier , err := AutoInitializeUnifiedClassifier (testModelsDir )
33093308 if err != nil {
33103309 t .Logf ("Failed to initialize classifier: %v" , err )
33113310 return
@@ -3323,8 +3322,11 @@ func TestUnifiedClassifier_Integration(t *testing.T) {
33233322 // Get shared classifier instance
33243323 classifier := getTestClassifier (t )
33253324 if classifier == nil {
3326- t .Skip ("Skipping integration tests - classifier not available" )
3327- return
3325+ t .Fatal ("Classifier initialization failed" )
3326+ }
3327+
3328+ if ! classifier .useLoRA {
3329+ t .Fatal ("LoRA models not detected" )
33283330 }
33293331
33303332 t .Run ("RealBatchClassification" , func (t * testing.T ) {
@@ -3472,7 +3474,7 @@ func TestUnifiedClassifier_Integration(t *testing.T) {
34723474func getBenchmarkClassifier (b * testing.B ) * UnifiedClassifier {
34733475 // Reuse the global test classifier for benchmarks
34743476 globalTestClassifierOnce .Do (func () {
3475- classifier , err := AutoInitializeUnifiedClassifier ("../../../../../models" )
3477+ classifier , err := AutoInitializeUnifiedClassifier (testModelsDir )
34763478 if err != nil {
34773479 b .Logf ("Failed to initialize classifier: %v" , err )
34783480 return
0 commit comments