on main help sign in
test: simplify integration tests, run for a single provider / model

It takes a lot of time to re-record these VCRs for so many models. Sometimes they fail intermittently, and you need to manually re-record again and again until it works. Let's keep a single provider and models which should work well enough for us.

commit4e66adae437b51ff522d22705ce6fc2fb2ce71f2 authorAndrey Nering <andreynering@users.noreply.github.com> dateThu 16 Apr 2026, 16:27 (6 months ago) parent53c9774
3 files changed+5−49
internal/agent/.env.sample+1 internal/agent/agent_test.go+1−4 internal/agent/common_test.go+3−45
internal/agent/.env.sample+1
@@ -1,4 +1,5 @@
11CRUSH_ANTHROPIC_API_KEY=
2+CRUSH_HYPER_API_KEY=
23CRUSH_OPENAI_API_KEY=
34CRUSH_OPENROUTER_API_KEY=
45CRUSH_ZAI_API_KEY=
internal/agent/agent_test.go+1−4
@@ -26,10 +26,7 @@ func TestMain(m *testing.M) {
2626}
2727
2828var modelPairs = []modelPair{
29− {"anthropic-sonnet", anthropicBuilder("claude-sonnet-4-6"), anthropicBuilder("claude-haiku-4-5-20251001")},
30− {"openai-gpt-5", openaiBuilder("gpt-5"), openaiBuilder("gpt-4o")},
31− {"openrouter-kimi-k2", openRouterBuilder("moonshotai/kimi-k2-0905"), openRouterBuilder("qwen/qwen3-next-80b-a3b-instruct")},
32− {"zai-glm4.6", zAIBuilder("glm-4.6"), zAIBuilder("glm-4.5-air")},
29+ {"glm-5.1", hyperBuilder("glm-5.1"), hyperBuilder("gpt-oss-120b")},
3330}
3431
3532func getModels(t *testing.T, r *vcr.Recorder, pair modelPair) (fantasy.LanguageModel, fantasy.LanguageModel) {
internal/agent/common_test.go+3−45
@@ -10,10 +10,7 @@ import (
1010
1111 "charm.land/catwalk/pkg/catwalk"
1212 "charm.land/fantasy"
13− "charm.land/fantasy/providers/anthropic"
14− "charm.land/fantasy/providers/openai"
1513 "charm.land/fantasy/providers/openaicompat"
16− "charm.land/fantasy/providers/openrouter"
1714 "charm.land/x/vcr"
1815 "github.com/charmbracelet/crush/internal/agent/prompt"
1916 "github.com/charmbracelet/crush/internal/agent/tools"
@@ -50,50 +47,11 @@ type modelPair struct {
5047 smallModel builderFunc
5148}
5249
53−func anthropicBuilder(model string) builderFunc {
54− return func(t *testing.T, r *vcr.Recorder) (fantasy.LanguageModel, error) {
55− provider, err := anthropic.New(
56− anthropic.WithAPIKey(os.Getenv("CRUSH_ANTHROPIC_API_KEY")),
57− anthropic.WithHTTPClient(&http.Client{Transport: r}),
58− )
59− if err != nil {
60− return nil, err
61− }
62− return provider.LanguageModel(t.Context(), model)
63− }
64−}
65−
66−func openaiBuilder(model string) builderFunc {
67− return func(t *testing.T, r *vcr.Recorder) (fantasy.LanguageModel, error) {
68− provider, err := openai.New(
69− openai.WithAPIKey(os.Getenv("CRUSH_OPENAI_API_KEY")),
70− openai.WithHTTPClient(&http.Client{Transport: r}),
71− )
72− if err != nil {
73− return nil, err
74− }
75− return provider.LanguageModel(t.Context(), model)
76− }
77−}
78−
79−func openRouterBuilder(model string) builderFunc {
80− return func(t *testing.T, r *vcr.Recorder) (fantasy.LanguageModel, error) {
81− provider, err := openrouter.New(
82− openrouter.WithAPIKey(os.Getenv("CRUSH_OPENROUTER_API_KEY")),
83− openrouter.WithHTTPClient(&http.Client{Transport: r}),
84− )
85− if err != nil {
86− return nil, err
87− }
88− return provider.LanguageModel(t.Context(), model)
89− }
90−}
91−
92−func zAIBuilder(model string) builderFunc {
50+func hyperBuilder(model string) builderFunc {
9351 return func(t *testing.T, r *vcr.Recorder) (fantasy.LanguageModel, error) {
9452 provider, err := openaicompat.New(
95− openaicompat.WithBaseURL("https://api.z.ai/api/coding/paas/v4"),
96− openaicompat.WithAPIKey(os.Getenv("CRUSH_ZAI_API_KEY")),
53+ openaicompat.WithBaseURL("https://hyper.charm.land/v1"),
54+ openaicompat.WithAPIKey(os.Getenv("CRUSH_HYPER_API_KEY")),
9755 openaicompat.WithHTTPClient(&http.Client{Transport: r}),
9856 )
9957 if err != nil {