MCPcopy Index your code
hub / github.com/coder/coder / TestChatAdvisorConfig_CanBeDisabledAfterEnabled

Function TestChatAdvisorConfig_CanBeDisabledAfterEnabled

coderd/exp_chats_test.go:12980–13005  ·  view source on GitHub ↗

TestChatAdvisorConfig_CanBeDisabledAfterEnabled pins the feature gate's "off" path. The downstream runtime gates the advisor tool and prompt guidance on Enabled, so a regression that silently drops or ignores Enabled: false on PUT would leave the feature stuck on.

(t *testing.T)

Source from the content-addressed store, hash-verified

12978// prompt guidance on Enabled, so a regression that silently drops or
12979// ignores Enabled: false on PUT would leave the feature stuck on.
12980func TestChatAdvisorConfig_CanBeDisabledAfterEnabled(t *testing.T) {
12981 t.Parallel()
12982
12983 ctx := testutil.Context(t, testutil.WaitLong)
12984 adminClient := newChatClient(t)
12985 coderdtest.CreateFirstUser(t, adminClient.Client)
12986
12987 err := adminClient.UpdateChatAdvisorConfig(ctx, codersdk.AdvisorConfig{
12988 Enabled: true,
12989 MaxUsesPerRun: 2,
12990 })
12991 require.NoError(t, err)
12992
12993 enabledResp, err := adminClient.GetChatAdvisorConfig(ctx)
12994 require.NoError(t, err)
12995 require.True(t, enabledResp.Enabled)
12996
12997 err = adminClient.UpdateChatAdvisorConfig(ctx, codersdk.AdvisorConfig{
12998 Enabled: false,
12999 })
13000 require.NoError(t, err)
13001
13002 disabledResp, err := adminClient.GetChatAdvisorConfig(ctx)
13003 require.NoError(t, err)
13004 require.False(t, disabledResp.Enabled)
13005}
13006
13007func TestChatAdvisorConfig_ClampsNegativeStoredValues(t *testing.T) {
13008 t.Parallel()

Callers

nothing calls this directly

Calls 5

ContextFunction · 0.92
CreateFirstUserFunction · 0.92
newChatClientFunction · 0.70
GetChatAdvisorConfigMethod · 0.65

Tested by

no test coverage detected