Skip to content

Commit acc1aa6

Browse files
authored
Add repair command test coverage in model_manager_test
1 parent 410a13e commit acc1aa6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/model_manager_test.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ int main() {
9797
ok = expect(result == 0, "list --installed should succeed for partial downloads") && ok;
9898
ok = expect(out.str().find("whisper-base") != std::string::npos, "installed list should include partial download") && ok;
9999

100+
{
101+
std::ofstream file(model_path, std::ios::binary);
102+
file << "not a real model, but enough to test file completeness";
103+
}
104+
const fs::path partial_path = model_path.string() + ".part";
105+
ok = expect(fs::exists(partial_path), "stale .part file should exist before repair") && ok;
106+
out.str("");
107+
out.clear();
108+
err.str("");
109+
err.clear();
110+
result = vox::app::model::run_model_command({"repair", "whisper-base"}, root, out, err);
111+
ok = expect(result == 0, "repair should succeed when model is already complete") && ok;
112+
ok = expect(!fs::exists(partial_path), "repair should remove stale .part file") && ok;
113+
ok = expect(fs::exists(model_path), "repair should keep the complete model file") && ok;
114+
ok = expect(out.str().find("Model already installed") != std::string::npos, "repair should report model already installed") && ok;
115+
100116
fs::remove_all(root, ec);
101117
return ok ? 0 : 1;
102118
}

0 commit comments

Comments
 (0)