Skip to content

Commit 4082f69

Browse files
committed
fix test
Signed-off-by: Qifan Deng <[email protected]>
1 parent 711721e commit 4082f69

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package llmdinferencesim
1818

1919
import (
20-
"fmt"
20+
"encoding/json"
2121
"os"
2222

2323
"github.com/go-logr/logr"
@@ -86,17 +86,23 @@ var _ = Describe("Dataset", func() {
8686

8787
It("should successfully init dataset", func() {
8888
err := dataset.Init(validDBPath, "", "")
89-
// debug: get the realpath
90-
wd, _ := os.Getwd()
91-
realpath := fmt.Sprintf("%s/%s", wd, validDBPath)
92-
fmt.Println("Using realpath:", realpath)
9389
Expect(err).NotTo(HaveOccurred())
9490

9591
row := dataset.db.QueryRow("SELECT n_gen_tokens FROM llmd WHERE prompt_hash=X'b94d27b9934d041c52e5b721d7373f13a07ed5e79179d63c5d8a0c102a9d00b2';")
9692
var n_gen_tokens int
9793
err = row.Scan(&n_gen_tokens)
9894
Expect(err).NotTo(HaveOccurred())
9995
Expect(n_gen_tokens).To(Equal(3))
96+
97+
var jsonStr string
98+
row = dataset.db.QueryRow("SELECT gen_tokens FROM llmd WHERE prompt_hash=X'b94d27b9934d041c52e5b721d7373f13a07ed5e79179d63c5d8a0c102a9d00b2';")
99+
err = row.Scan(&jsonStr)
100+
Expect(err).NotTo(HaveOccurred())
101+
var tokens []string
102+
err = json.Unmarshal([]byte(jsonStr), &tokens)
103+
Expect(err).NotTo(HaveOccurred())
104+
Expect(tokens).To(Equal([]string{"Hello", "world", "!"}))
105+
100106
})
101107

102108
It("should return error for non-existing DB path", func() {

0 commit comments

Comments
 (0)