Add agent_name to JetBrains module URLs
Add agent_name parameter to URLs for workspaces with multiple agents. Updated tests to ensure correct URL generation, with and without agent_name specified.
This commit is contained in:
parent
c251fbfa9c
commit
ef8ad092e1
@ -300,7 +300,27 @@ describe("jetbrains", async () => {
|
|||||||
expect(url).toContain("&token=$SESSION_TOKEN");
|
expect(url).toContain("&token=$SESSION_TOKEN");
|
||||||
expect(url).toContain("&ide_product_code=GO");
|
expect(url).toContain("&ide_product_code=GO");
|
||||||
expect(url).toContain("&ide_build_number=");
|
expect(url).toContain("&ide_build_number=");
|
||||||
expect(url).toContain("&agent_id=test-agent-123");
|
// No agent_name parameter should be included when agent_name is not specified
|
||||||
|
expect(url).not.toContain("&agent_name=");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should include agent_name parameter when agent_name is specified", async () => {
|
||||||
|
const state = await runTerraformApply(import.meta.dir, {
|
||||||
|
agent_id: "test-agent-123",
|
||||||
|
agent_name: "main-agent",
|
||||||
|
folder: "/custom/project/path",
|
||||||
|
default: '["GO"]',
|
||||||
|
});
|
||||||
|
|
||||||
|
const coder_app = state.resources.find(
|
||||||
|
(res) => res.type === "coder_app" && res.name === "jetbrains",
|
||||||
|
);
|
||||||
|
const url = coder_app?.instances[0].attributes.url;
|
||||||
|
|
||||||
|
expect(url).toContain("jetbrains://gateway/coder");
|
||||||
|
expect(url).toContain("&agent_name=main-agent");
|
||||||
|
expect(url).toContain("&ide_product_code=GO");
|
||||||
|
expect(url).toContain("&ide_build_number=");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should include build numbers from API in URLs", async () => {
|
it("should include build numbers from API in URLs", async () => {
|
||||||
|
|||||||
@ -15,7 +15,13 @@ terraform {
|
|||||||
|
|
||||||
variable "agent_id" {
|
variable "agent_id" {
|
||||||
type = string
|
type = string
|
||||||
description = "The ID of a Coder agent."
|
description = "The resource ID of a Coder agent."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "agent_name" {
|
||||||
|
type = string
|
||||||
|
description = "The name of a Coder agent. Needed for workspaces with multiple agents."
|
||||||
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "folder" {
|
variable "folder" {
|
||||||
@ -239,7 +245,6 @@ resource "coder_app" "jetbrains" {
|
|||||||
each.key,
|
each.key,
|
||||||
"&ide_build_number=",
|
"&ide_build_number=",
|
||||||
local.options_metadata[each.key].build,
|
local.options_metadata[each.key].build,
|
||||||
"&agent_id=",
|
var.agent_name != null ? "&agent_name=${var.agent_name}" : "",
|
||||||
var.agent_id,
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user