Skip to content

Commit 641f081

Browse files
authored
Add instrumentedIndex basic unit tests (#87)
* fix Lookup in index interface Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * fix GetPodScores Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * fix InMemoryIndex Lookup Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * fix instrumentedIndex Lookup Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * update RedisIndex.Lookup Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * Migrate common test to new interface Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * lint redis index Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> * Add instrumentedIndex basic unit tests Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]> --------- Signed-off-by: sagiahrac <[email protected]> Signed-off-by: Sage Ahrac <[email protected]>
1 parent 181666b commit 641f081

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Copyright 2025 The llm-d Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package kvblock_test
18+
19+
import (
20+
"testing"
21+
22+
"github.com/llm-d/llm-d-kv-cache-manager/pkg/kvcache/kvblock"
23+
"github.com/stretchr/testify/assert"
24+
)
25+
26+
func TestNewInstrumentedIndex(t *testing.T) {
27+
// Create base index
28+
baseIndex, err := kvblock.NewInMemoryIndex(nil)
29+
assert.NoError(t, err)
30+
31+
// Wrap with instrumentation
32+
instrumented := kvblock.NewInstrumentedIndex(baseIndex)
33+
assert.NotNil(t, instrumented)
34+
35+
// Verify it implements Index interface
36+
assert.Implements(t, (*kvblock.Index)(nil), instrumented)
37+
}
38+
39+
func TestInstrumentedIndexBasicFunctionality(t *testing.T) {
40+
// Create instrumented index
41+
baseIndex, err := kvblock.NewInMemoryIndex(nil)
42+
assert.NoError(t, err)
43+
instrumented := kvblock.NewInstrumentedIndex(baseIndex)
44+
45+
// Test that basic functionality still works through the wrapper
46+
testAddBasic(t, instrumented)
47+
}

0 commit comments

Comments
 (0)