Skip to content

test: add unit tests for DeepSeek, GLM, Kimi, and Qwen providers#189

Merged
asdek merged 1 commit intovxcontrol:feature/next_releasefrom
mason5052:test/cn-provider-config-tests
Mar 11, 2026
Merged

test: add unit tests for DeepSeek, GLM, Kimi, and Qwen providers#189
asdek merged 1 commit intovxcontrol:feature/next_releasefrom
mason5052:test/cn-provider-config-tests

Conversation

@mason5052
Copy link
Contributor

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

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

Add config loading, provider type, models loading, model prefix,
missing API key, and usage tests for the four Chinese LLM providers
that were expanded in PR vxcontrol#185 but had no test coverage.

GLM tests use non-negative price assertions to accommodate free-tier
models (glm-4.7-flash, glm-4.5-flash).

Signed-off-by: mason5052 <ehehwnwjs5052@gmail.com>
Copilot AI review requested due to automatic review settings March 10, 2026 16:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing unit test coverage for the four China-based LLM providers introduced in #185 (DeepSeek, GLM/Zhipu, Kimi/Moonshot, Qwen/DashScope), aligning them with the existing provider test patterns used across the codebase.

Changes:

  • Introduce provider test suites validating config loading, model selection, and pricing for all agent types.
  • Add tests for provider type constants, embedded models.yml parsing, and LiteLLM-style model prefix handling.
  • Add negative-path and utility tests for missing API keys and token usage extraction.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
backend/pkg/providers/deepseek/deepseek_test.go Adds unit tests for DeepSeek provider config/model/price loading, prefix behavior, API key validation, and usage parsing.
backend/pkg/providers/glm/glm_test.go Adds unit tests for GLM provider with non-negative price assertions to support free-tier models, plus prefix/API key/usage coverage.
backend/pkg/providers/kimi/kimi_test.go Adds unit tests for Kimi provider config/model/price loading, prefix behavior, API key validation, and usage parsing.
backend/pkg/providers/qwen/qwen_test.go Adds unit tests for Qwen provider config/model/price loading, prefix behavior, API key validation, and usage parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@asdek asdek changed the base branch from master to feature/next_release March 11, 2026 13:43
@asdek asdek merged commit f663c7b into vxcontrol:feature/next_release Mar 11, 2026
3 of 4 checks passed
@asdek
Copy link
Contributor

asdek commented Mar 11, 2026

thank you for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants