Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/openab/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
{{- include "openab.labels" $d | nindent 4 }}
data:
config.toml: |
{{- if ($cfg.discord).enabled }}
{{- if and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken }}
[discord]
bot_token = "${DISCORD_BOT_TOKEN}"
{{- range $cfg.discord.allowedChannels }}
Expand Down
15 changes: 13 additions & 2 deletions charts/openab/tests/adapter-enablement_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ suite: adapter enablement gating
templates:
- templates/configmap.yaml
tests:
- it: renders [discord] with placeholder token when enabled=true without botToken
- it: renders [discord] when enabled=true and botToken is present
set:
agents.kiro.discord.enabled: true
agents.kiro.discord.botToken: ""
agents.kiro.discord.botToken: "xoxb-test-token"
asserts:
- matchRegex:
path: data["config.toml"]
Expand All @@ -14,9 +14,19 @@ tests:
path: data["config.toml"]
pattern: 'bot_token = "\$\{DISCORD_BOT_TOKEN\}"'

- it: omits [discord] when enabled=true but botToken is absent
set:
agents.kiro.discord.enabled: true
agents.kiro.discord.botToken: ""
asserts:
- notMatchRegex:
path: data["config.toml"]
pattern: "\\[discord\\]"

- it: omits [discord] when enabled=false
set:
agents.kiro.discord.enabled: false
agents.kiro.discord.botToken: "xoxb-test-token"
asserts:
- notMatchRegex:
path: data["config.toml"]
Expand Down Expand Up @@ -60,6 +70,7 @@ tests:
- it: renders both [discord] and [slack] when both enabled
set:
agents.kiro.discord.enabled: true
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.slack.enabled: true
asserts:
- matchRegex:
Expand Down
8 changes: 8 additions & 0 deletions charts/openab/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ templates:
tests:
- it: renders allow_bot_messages = "mentions"
set:
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.discord.allowBotMessages: mentions
asserts:
- matchRegex:
Expand All @@ -12,6 +13,7 @@ tests:

- it: renders allow_bot_messages = "all"
set:
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.discord.allowBotMessages: all
asserts:
- matchRegex:
Expand All @@ -20,6 +22,7 @@ tests:

- it: renders allow_bot_messages = "off"
set:
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.discord.allowBotMessages: "off"
asserts:
- matchRegex:
Expand All @@ -28,13 +31,15 @@ tests:

- it: rejects invalid allowBotMessages value
set:
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.discord.allowBotMessages: yolo
asserts:
- failedTemplate:
errorPattern: "must be one of: off, mentions, all"

- it: renders trustedBotIds as JSON array
set:
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.discord.allowBotMessages: mentions
agents.kiro.discord.trustedBotIds:
- "123456789012345678"
Expand All @@ -46,13 +51,16 @@ tests:

- it: rejects mangled snowflake ID
set:
agents.kiro.discord.botToken: "xoxb-test-token"
agents.kiro.discord.trustedBotIds:
- "1.234567890123457e+17"
asserts:
- failedTemplate:
errorPattern: mangled ID

- it: renders default allow_bot_messages = "off"
set:
agents.kiro.discord.botToken: "xoxb-test-token"
asserts:
- matchRegex:
path: data["config.toml"]
Expand Down
Loading