Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit ecb357b

Browse files
db schema update follow up
1 parent 0cfecec commit ecb357b

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

engine/database/models.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace cortex::db {
1010

1111
struct ModelEntry {
1212
std::string model;
13-
std::string model_format; // Ensure this is present
13+
std::string model_format;
1414
std::string model_source;
1515
std::string status;
1616
std::string engine;

engine/test/components/test_models_db.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace cortex::db {
66
namespace {
77
constexpr const auto kTestDb = "./test.db";
88
}
9+
910
class ModelsTestSuite : public ::testing::Test {
1011
public:
1112
ModelsTestSuite()
@@ -21,9 +22,9 @@ class ModelsTestSuite : public ::testing::Test {
2122
SQLite::Database db_;
2223
cortex::db::Models model_list_;
2324

24-
const cortex::db::ModelEntry kTestModel{"test_model_id", "test_author",
25-
"main", "/path/to/model.yaml",
26-
"test_alias"};
25+
const cortex::db::ModelEntry kTestModel{
26+
"test_model_id", "test_format", "test_source", "active", "test_engine",
27+
"test_author", "main", "/path/to/model.yaml", "test_alias"};
2728
};
2829

2930
TEST_F(ModelsTestSuite, TestAddModelEntry) {
@@ -33,8 +34,12 @@ TEST_F(ModelsTestSuite, TestAddModelEntry) {
3334
EXPECT_TRUE(retrieved_model);
3435
EXPECT_EQ(retrieved_model.value().model, kTestModel.model);
3536
EXPECT_EQ(retrieved_model.value().author_repo_id, kTestModel.author_repo_id);
37+
EXPECT_EQ(retrieved_model.value().model_format, kTestModel.model_format);
38+
EXPECT_EQ(retrieved_model.value().model_source, kTestModel.model_source);
39+
EXPECT_EQ(retrieved_model.value().status, kTestModel.status);
40+
EXPECT_EQ(retrieved_model.value().engine, kTestModel.engine);
3641

37-
// // Clean up
42+
// Clean up
3843
EXPECT_TRUE(model_list_.DeleteModelEntry(kTestModel.model).value());
3944
}
4045

@@ -59,14 +64,14 @@ TEST_F(ModelsTestSuite, TestUpdateModelEntry) {
5964
EXPECT_TRUE(model_list_.AddModelEntry(kTestModel).value());
6065

6166
cortex::db::ModelEntry updated_model = kTestModel;
67+
updated_model.status = "inactive";
6268

6369
EXPECT_TRUE(
6470
model_list_.UpdateModelEntry(kTestModel.model, updated_model).value());
6571

6672
auto retrieved_model = model_list_.GetModelInfo(kTestModel.model);
6773
EXPECT_TRUE(retrieved_model);
68-
EXPECT_TRUE(
69-
model_list_.UpdateModelEntry(kTestModel.model, updated_model).value());
74+
EXPECT_EQ(retrieved_model.value().status, "inactive");
7075

7176
// Clean up
7277
EXPECT_TRUE(model_list_.DeleteModelEntry(kTestModel.model).value());
@@ -162,4 +167,5 @@ TEST_F(ModelsTestSuite, TestHasModel) {
162167
// Clean up
163168
EXPECT_TRUE(model_list_.DeleteModelEntry(kTestModel.model).value());
164169
}
165-
} // namespace cortex::db
170+
171+
} // namespace cortex::db

0 commit comments

Comments
 (0)