[PR #189] [MERGED] test: add unit tests for DeepSeek, GLM, Kimi, and Qwen providers #222

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

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/189
Author: @mason5052
Created: 3/10/2026
Status: Merged
Merged: 3/11/2026
Merged by: @asdek

Base: feature/next_releaseHead: test/cn-provider-config-tests


📝 Commits (1)

  • afef83f test: add unit tests for DeepSeek, GLM, Kimi, and Qwen providers

📊 Changes

4 files changed (+808 additions, -0 deletions)

View changed files

backend/pkg/providers/deepseek/deepseek_test.go (+202 -0)
backend/pkg/providers/glm/glm_test.go (+202 -0)
backend/pkg/providers/kimi/kimi_test.go (+202 -0)
backend/pkg/providers/qwen/qwen_test.go (+202 -0)

📄 Description

Description of the Change

Problem

The four Chinese LLM providers (DeepSeek, GLM/Zhipu AI, Kimi/Moonshot AI, Qwen/Tongyi Qianwen) expanded in PR #185 had zero test coverage. Other providers like Anthropic, Bedrock, Gemini, and OpenAI all have comprehensive test suites.

Solution

Add unit tests for all four providers following the established test patterns (consistent with anthropic_test.go, openai_test.go, etc.):

  • TestConfigLoading: Validates config creation, raw config, provider config, model assignment, and price information for all agent types
  • TestProviderType: Verifies correct provider type constant
  • TestModelsLoading: Validates embedded models.yml parsing, model names, and pricing
  • TestModelWithPrefix: Tests LiteLLM proxy prefix behavior (prefix/model-name)
  • TestModelWithoutPrefix: Verifies no-op when prefix is empty
  • TestMissingAPIKey: Validates error on missing API key
  • TestGetUsage: Tests token usage extraction

GLM tests use < 0 (non-negative) price assertions instead of <= 0 (positive) to accommodate free-tier models (glm-4.7-flash, glm-4.5-flash) with zero pricing.

Type of Change

  • New feature (non-breaking change which adds functionality)

Areas Affected

  • Core Services (Backend API)

Testing and Verification

Test Configuration

  • PentAGI Version: master (post-PR #185)
  • Go Version: 1.24

Test Results

All 28 tests pass (7 per provider x 4 providers):

ok    pentagi/pkg/providers/deepseek  0.675s
ok    pentagi/pkg/providers/glm       2.576s
ok    pentagi/pkg/providers/kimi      0.677s
ok    pentagi/pkg/providers/qwen      0.711s

Checklist

  • My code follows the project's coding standards
  • All new and existing tests pass
  • I have run go fmt and go vet
  • Security implications considered
  • 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/189 **Author:** [@mason5052](https://github.com/mason5052) **Created:** 3/10/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@asdek](https://github.com/asdek) **Base:** `feature/next_release` ← **Head:** `test/cn-provider-config-tests` --- ### 📝 Commits (1) - [`afef83f`](https://github.com/vxcontrol/pentagi/commit/afef83f076bbf51f29ed0aec88cae951694290bd) test: add unit tests for DeepSeek, GLM, Kimi, and Qwen providers ### 📊 Changes **4 files changed** (+808 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `backend/pkg/providers/deepseek/deepseek_test.go` (+202 -0) ➕ `backend/pkg/providers/glm/glm_test.go` (+202 -0) ➕ `backend/pkg/providers/kimi/kimi_test.go` (+202 -0) ➕ `backend/pkg/providers/qwen/qwen_test.go` (+202 -0) </details> ### 📄 Description ### Description of the Change #### Problem The four Chinese LLM providers (DeepSeek, GLM/Zhipu AI, Kimi/Moonshot AI, Qwen/Tongyi Qianwen) expanded in PR #185 had zero test coverage. Other providers like Anthropic, Bedrock, Gemini, and OpenAI all have comprehensive test suites. #### Solution Add unit tests for all four providers following the established test patterns (consistent with `anthropic_test.go`, `openai_test.go`, etc.): - **TestConfigLoading**: Validates config creation, raw config, provider config, model assignment, and price information for all agent types - **TestProviderType**: Verifies correct provider type constant - **TestModelsLoading**: Validates embedded models.yml parsing, model names, and pricing - **TestModelWithPrefix**: Tests LiteLLM proxy prefix behavior (`prefix/model-name`) - **TestModelWithoutPrefix**: Verifies no-op when prefix is empty - **TestMissingAPIKey**: Validates error on missing API key - **TestGetUsage**: Tests token usage extraction GLM tests use `< 0` (non-negative) price assertions instead of `<= 0` (positive) to accommodate free-tier models (`glm-4.7-flash`, `glm-4.5-flash`) with zero pricing. ### Type of Change - [x] New feature (non-breaking change which adds functionality) ### Areas Affected - [x] Core Services (Backend API) ### Testing and Verification #### Test Configuration - PentAGI Version: master (post-PR #185) - Go Version: 1.24 #### Test Results All 28 tests pass (7 per provider x 4 providers): ``` ok pentagi/pkg/providers/deepseek 0.675s ok pentagi/pkg/providers/glm 2.576s ok pentagi/pkg/providers/kimi 0.677s ok pentagi/pkg/providers/qwen 0.711s ``` ### Checklist - [x] My code follows the project's coding standards - [x] All new and existing tests pass - [x] I have run `go fmt` and `go vet` - [x] Security implications considered - [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:45 -04:00
yindo closed this issue 2026-06-06 22:09:46 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#222