[PR #202] [MERGED] test: add unit tests for pkg/providers/embeddings package #232

Closed
opened 2026-06-06 22:09:48 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/202
Author: @mason5052
Created: 3/12/2026
Status: Merged
Merged: 3/20/2026
Merged by: @asdek

Base: feature/next_releaseHead: test/embeddings-provider-coverage


📝 Commits (1)

  • c4d4a30 test: add unit tests for pkg/providers/embeddings package

📊 Changes

1 file changed (+168 additions, -0 deletions)

View changed files

backend/pkg/providers/embeddings/embedder_test.go (+168 -0)

📄 Description

Description of Change

Problem: The pkg/providers/embeddings package has no unit test coverage. This package provides the embedding provider factory supporting 7 providers (OpenAI, Ollama, Mistral, Jina, Huggingface, GoogleAI, VoyageAI) used for vector store operations.

Solution: Add unit tests for the New() factory function covering all 7 supported providers, the "none" provider, unsupported provider error handling, custom URL/key/model configuration, and IsAvailable() behavior for both valid and nil embedders.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Security update
  • Test update
  • Documentation update
  • Configuration change

Areas Affected

  • Core Services (Frontend UI / Backend API)
  • AI Agents (Researcher / Developer / Executor)
  • Security Tools Integration
  • Memory System (Vector Store / Knowledge Base)
  • Monitoring Stack (Grafana / OpenTelemetry)
  • Analytics & Reporting
  • External Integrations (LLM Providers / Search Engines / Security APIs)
  • Documentation
  • Infrastructure / DevOps

Testing and Verification

Test Configuration

  • PentAGI Version: v1.2.0 (master)
  • Go Version: 1.24.1
  • Host OS: Windows 11

Test Steps

  1. Run go test ./pkg/providers/embeddings/... -v

Test Results

=== RUN   TestNew_OpenAI
--- PASS: TestNew_OpenAI (0.00s)
=== RUN   TestNew_OpenAI_WithCustomURL
--- PASS: TestNew_OpenAI_WithCustomURL (0.00s)
=== RUN   TestNew_Ollama
--- PASS: TestNew_Ollama (0.00s)
=== RUN   TestNew_Mistral
--- PASS: TestNew_Mistral (0.00s)
=== RUN   TestNew_Jina
--- PASS: TestNew_Jina (0.00s)
=== RUN   TestNew_Huggingface
--- PASS: TestNew_Huggingface (0.00s)
=== RUN   TestNew_GoogleAI
--- PASS: TestNew_GoogleAI (0.00s)
=== RUN   TestNew_VoyageAI
--- PASS: TestNew_VoyageAI (0.00s)
=== RUN   TestNew_None
--- PASS: TestNew_None (0.00s)
=== RUN   TestNew_UnsupportedProvider
--- PASS: TestNew_UnsupportedProvider (0.00s)
=== RUN   TestNew_AllProviders_TableDriven
--- PASS: TestNew_AllProviders_TableDriven (0.00s)
=== RUN   TestIsAvailable_NilEmbedder
--- PASS: TestIsAvailable_NilEmbedder (0.00s)
PASS
ok  	pentagi/pkg/providers/embeddings	4.256s

Checklist

  • Code follows project coding standards
  • Tests added for changes
  • All tests pass
  • go fmt and go vet run
  • Changes are backward compatible

🔄 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/vxcontrol/pentagi/pull/202 **Author:** [@mason5052](https://github.com/mason5052) **Created:** 3/12/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@asdek](https://github.com/asdek) **Base:** `feature/next_release` ← **Head:** `test/embeddings-provider-coverage` --- ### 📝 Commits (1) - [`c4d4a30`](https://github.com/vxcontrol/pentagi/commit/c4d4a30eec600c13bb7fd2b15be1e7501573fc5b) test: add unit tests for pkg/providers/embeddings package ### 📊 Changes **1 file changed** (+168 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `backend/pkg/providers/embeddings/embedder_test.go` (+168 -0) </details> ### 📄 Description ## Description of Change **Problem:** The `pkg/providers/embeddings` package has no unit test coverage. This package provides the embedding provider factory supporting 7 providers (OpenAI, Ollama, Mistral, Jina, Huggingface, GoogleAI, VoyageAI) used for vector store operations. **Solution:** Add unit tests for the New() factory function covering all 7 supported providers, the "none" provider, unsupported provider error handling, custom URL/key/model configuration, and IsAvailable() behavior for both valid and nil embedders. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Security update - [x] Test update - [ ] Documentation update - [ ] Configuration change ## Areas Affected - [ ] Core Services (Frontend UI / Backend API) - [ ] AI Agents (Researcher / Developer / Executor) - [ ] Security Tools Integration - [x] Memory System (Vector Store / Knowledge Base) - [ ] Monitoring Stack (Grafana / OpenTelemetry) - [ ] Analytics & Reporting - [x] External Integrations (LLM Providers / Search Engines / Security APIs) - [ ] Documentation - [ ] Infrastructure / DevOps ## Testing and Verification ### Test Configuration - PentAGI Version: v1.2.0 (master) - Go Version: 1.24.1 - Host OS: Windows 11 ### Test Steps 1. Run `go test ./pkg/providers/embeddings/... -v` ### Test Results ``` === RUN TestNew_OpenAI --- PASS: TestNew_OpenAI (0.00s) === RUN TestNew_OpenAI_WithCustomURL --- PASS: TestNew_OpenAI_WithCustomURL (0.00s) === RUN TestNew_Ollama --- PASS: TestNew_Ollama (0.00s) === RUN TestNew_Mistral --- PASS: TestNew_Mistral (0.00s) === RUN TestNew_Jina --- PASS: TestNew_Jina (0.00s) === RUN TestNew_Huggingface --- PASS: TestNew_Huggingface (0.00s) === RUN TestNew_GoogleAI --- PASS: TestNew_GoogleAI (0.00s) === RUN TestNew_VoyageAI --- PASS: TestNew_VoyageAI (0.00s) === RUN TestNew_None --- PASS: TestNew_None (0.00s) === RUN TestNew_UnsupportedProvider --- PASS: TestNew_UnsupportedProvider (0.00s) === RUN TestNew_AllProviders_TableDriven --- PASS: TestNew_AllProviders_TableDriven (0.00s) === RUN TestIsAvailable_NilEmbedder --- PASS: TestIsAvailable_NilEmbedder (0.00s) PASS ok pentagi/pkg/providers/embeddings 4.256s ``` ## Checklist - [x] Code follows project coding standards - [x] Tests added for changes - [x] All tests pass - [x] `go fmt` and `go vet` run - [x] Changes are backward compatible --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-06 22:09:48 -04:00
yindo closed this issue 2026-06-06 22:09:48 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#232