[PR #8945] [CLOSED] feat:Improved unit-test coverage of packages using keploy ai-agent #75118

Closed
opened 2026-05-05 07:32:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/8945
Author: @khareyash05
Created: 2/8/2025
Status: Closed

Base: mainHead: main


📝 Commits (5)

📊 Changes

52 files changed (+3283 additions, -637 deletions)

View changed files

📝 api/client_test.go (+116 -1)
📝 api/examples/chat/main.go (+51 -43)
api/examples/chat/main_test.go (+16 -0)
📝 api/examples/generate-streaming/main.go (+44 -32)
api/examples/generate-streaming/main_test.go (+60 -0)
📝 api/examples/generate/main.go (+37 -29)
api/examples/generate/main_test.go (+38 -0)
📝 api/examples/multimodal/main.go (+25 -12)
api/examples/multimodal/main_test.go (+106 -0)
📝 api/examples/pull-progress/main.go (+38 -23)
api/examples/pull-progress/main_test.go (+53 -0)
📝 api/types_test.go (+155 -8)
📝 app/assets/assets.go (+7 -5)
app/assets/assets_test.go (+64 -0)
app/lifecycle/getstarted_nonwindows_test.go (+22 -0)
📝 app/lifecycle/logging.go (+73 -65)
📝 app/lifecycle/logging_nonwindows.go (+3 -1)
app/lifecycle/logging_nonwindows_test.go (+19 -0)
📝 app/lifecycle/logging_test.go (+36 -6)
📝 app/lifecycle/paths.go (+79 -70)

...and 32 more files

📄 Description

What does this PR do?
Hey, I’ve added new unit tests to the Go codebase while testing the capabilities of my Keploy AI testing agent. The tests ensure reliable coverage by validating code builds, eliminating flaky tests, and improving overall test stability. Here’s what the AI checks for:

  1. Ensures new tests build without errors.
  2. Confirms no flaky tests are introduced.
  3. Enhances coverage for previously untested areas.

Motivation
I was testing the Keploy agent for Go repositories and decided to try it on Ollama since it's a tool we love! After seeing some coverage gaps, I planned to contribute to specific packages by filling them with AI-generated tests.

Coverage Breakdown

Package Coverage Before Coverage After Coverage Increase
app/lifecycle 5.3% 13.6% +8.3%
cmd 15.8% 22.7% +6.9%
discover 43.5% 54.1% +10.6%
progress 0% 85.6% +85.6%
readline 0% 36.9% +36.9%
server 51.1% 51.6% +0.5%

Possible Drawbacks / Trade-offs
Relying on AI-generated tests for critical code might need additional validation by the team.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/8945 **Author:** [@khareyash05](https://github.com/khareyash05) **Created:** 2/8/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (5) - [`f13ea85`](https://github.com/ollama/ollama/commit/f13ea857280836ccfb9f4420e2726a6bf6b5b965) feat: Unit Tests By Keploy(#6) - [`7b8bf9c`](https://github.com/ollama/ollama/commit/7b8bf9c4bacd022d52d6ccf0464bb450c495ff8b) Update changes with new configurations - [`926c4e2`](https://github.com/ollama/ollama/commit/926c4e26992da8fd6ce269e95bdd19ea246fac11) update configs - [`934e9ac`](https://github.com/ollama/ollama/commit/934e9ac6c3fa0e6d32702d77d7a586ffebb92a03) add extra test cases - [`3f222bc`](https://github.com/ollama/ollama/commit/3f222bc31929d0616e6c4d03046701b8ec369255) remove files ### 📊 Changes **52 files changed** (+3283 additions, -637 deletions) <details> <summary>View changed files</summary> 📝 `api/client_test.go` (+116 -1) 📝 `api/examples/chat/main.go` (+51 -43) ➕ `api/examples/chat/main_test.go` (+16 -0) 📝 `api/examples/generate-streaming/main.go` (+44 -32) ➕ `api/examples/generate-streaming/main_test.go` (+60 -0) 📝 `api/examples/generate/main.go` (+37 -29) ➕ `api/examples/generate/main_test.go` (+38 -0) 📝 `api/examples/multimodal/main.go` (+25 -12) ➕ `api/examples/multimodal/main_test.go` (+106 -0) 📝 `api/examples/pull-progress/main.go` (+38 -23) ➕ `api/examples/pull-progress/main_test.go` (+53 -0) 📝 `api/types_test.go` (+155 -8) 📝 `app/assets/assets.go` (+7 -5) ➕ `app/assets/assets_test.go` (+64 -0) ➕ `app/lifecycle/getstarted_nonwindows_test.go` (+22 -0) 📝 `app/lifecycle/logging.go` (+73 -65) 📝 `app/lifecycle/logging_nonwindows.go` (+3 -1) ➕ `app/lifecycle/logging_nonwindows_test.go` (+19 -0) 📝 `app/lifecycle/logging_test.go` (+36 -6) 📝 `app/lifecycle/paths.go` (+79 -70) _...and 32 more files_ </details> ### 📄 Description **What does this PR do?** Hey, I’ve added new unit tests to the Go codebase while testing the capabilities of my Keploy AI testing agent. The tests ensure reliable coverage by validating code builds, eliminating flaky tests, and improving overall test stability. Here’s what the AI checks for: 1. Ensures new tests build without errors. 2. Confirms no flaky tests are introduced. 3. Enhances coverage for previously untested areas. **Motivation** I was testing the Keploy agent for Go repositories and decided to try it on Ollama since it's a tool we love! After seeing some coverage gaps, I planned to contribute to specific packages by filling them with AI-generated tests. **Coverage Breakdown** | Package | Coverage Before | Coverage After | Coverage Increase | |-----------------|-----------------|----------------|-------------------| | app/lifecycle| 5.3% | 13.6% | +8.3% | | cmd | 15.8% | 22.7% | +6.9% | | discover | 43.5% | 54.1% | +10.6% | | progress | 0% | 85.6% | +85.6% | | readline | 0% | 36.9% | +36.9% | | server | 51.1% | 51.6% | +0.5% | **Possible Drawbacks / Trade-offs** Relying on AI-generated tests for critical code might need additional validation by the team. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 07:32:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#75118