Skip to content

Commit 099a5b3

Browse files
author
Liav Weiss
committed
Add validation step to verify /mnt storage and symlink configuration
Signed-off-by: Liav Weiss <[email protected]>
1 parent 68238e1 commit 099a5b3

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

.github/workflows/test-and-build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,49 @@ jobs:
145145
HF_HUB_DISABLE_TELEMETRY: 1
146146
run: make download-models
147147

148+
- name: Validate /mnt storage and symlink
149+
run: |
150+
set -e
151+
echo "=== Validating /mnt storage configuration ==="
152+
153+
# Verify symlink
154+
if [ ! -L "models" ] || [ "$(readlink models)" != "/mnt/models" ]; then
155+
echo "ERROR: Symlink 'models' -> '/mnt/models' is not configured correctly"
156+
exit 1
157+
fi
158+
echo "✓ Symlink configured: models -> /mnt/models"
159+
160+
# Verify models accessible - check both symlink and direct path
161+
echo "Checking models via symlink:"
162+
ls -la models/ | head -20 || echo "No models found via symlink"
163+
MODEL_COUNT=$(find models -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
164+
echo "✓ Models accessible via symlink: $MODEL_COUNT directories found"
165+
166+
echo "Checking models directly in /mnt/models:"
167+
ls -la /mnt/models/ | head -20 || echo "No models found in /mnt/models"
168+
DIRECT_COUNT=$(find /mnt/models -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
169+
echo "✓ Models in /mnt/models: $DIRECT_COUNT directories found"
170+
171+
# Verify test path resolution
172+
cd src/semantic-router/pkg/classification
173+
if [ ! -d "../../../../models" ]; then
174+
echo "ERROR: Test path '../../../../models' not accessible"
175+
exit 1
176+
fi
177+
RESOLVED=$(readlink -f ../../../../models 2>/dev/null || echo "N/A")
178+
echo "✓ Test path resolves: ../../../../models -> $RESOLVED"
179+
180+
# Verify models are accessible from test path
181+
echo "Checking models from test path:"
182+
ls -la ../../../../models/ | head -20 || echo "No models found from test path"
183+
TEST_PATH_COUNT=$(find ../../../../models -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
184+
echo "✓ Models accessible from test path: $TEST_PATH_COUNT directories found"
185+
cd - > /dev/null
186+
187+
# Disk usage
188+
echo "✓ Disk usage: /mnt $(df -h /mnt | tail -1 | awk '{print $4 " available"}')"
189+
echo "=== Validation complete ==="
190+
148191
- name: Start Milvus service
149192
run: |
150193
echo "Starting Milvus vector database..."

src/semantic-router/pkg/classification/classifier_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"os"
88
"path/filepath"
9+
"runtime"
910
"strings"
1011
"sync"
1112
"testing"
@@ -2091,10 +2092,21 @@ func TestAutoDiscoverModels_RealModels(t *testing.T) {
20912092

20922093
// TestAutoInitializeUnifiedClassifier tests the full initialization process
20932094
func TestAutoInitializeUnifiedClassifier(t *testing.T) {
2094-
// Test with real models directory
2095-
classifier, err := AutoInitializeUnifiedClassifier(testModelsDir)
2095+
// Resolve models directory relative to this test file's location
2096+
// The test runs from src/semantic-router, but the path is relative to the test file
2097+
_, filename, _, ok := runtime.Caller(0)
2098+
modelsDir := testModelsDir
2099+
if ok {
2100+
testDir := filepath.Dir(filename)
2101+
resolved, err := filepath.Abs(filepath.Join(testDir, "../../../../models"))
2102+
if err == nil {
2103+
modelsDir = resolved
2104+
}
2105+
}
2106+
2107+
classifier, err := AutoInitializeUnifiedClassifier(modelsDir)
20962108
if err != nil {
2097-
t.Fatalf("AutoInitializeUnifiedClassifier() failed: %v (models directory should exist at %s)", err, testModelsDir)
2109+
t.Fatalf("AutoInitializeUnifiedClassifier() failed: %v (models directory should exist at %s)", err, modelsDir)
20982110
}
20992111

21002112
if classifier == nil {

0 commit comments

Comments
 (0)