mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore(coderd/database): enforce agent name unique within workspace build (#18052)
Adds a database trigger that runs on insert and update of the `workspace_agents` table. The trigger ensures that the agent name is unique within the context of the workspace build it is being inserted into.
This commit is contained in:
@ -609,8 +609,8 @@ func TestTemplateInsights_Golden(t *testing.T) {
|
||||
Name: "example",
|
||||
Type: "aws_instance",
|
||||
Agents: []*proto.Agent{{
|
||||
Id: uuid.NewString(), // Doesn't matter, not used in DB.
|
||||
Name: "dev",
|
||||
Id: uuid.NewString(), // Doesn't matter, not used in DB.
|
||||
Name: fmt.Sprintf("dev-%d", len(resources)), // Ensure unique name per agent
|
||||
Auth: &proto.Agent_Token{
|
||||
Token: authToken.String(),
|
||||
},
|
||||
@ -1525,8 +1525,8 @@ func TestUserActivityInsights_Golden(t *testing.T) {
|
||||
Name: "example",
|
||||
Type: "aws_instance",
|
||||
Agents: []*proto.Agent{{
|
||||
Id: uuid.NewString(), // Doesn't matter, not used in DB.
|
||||
Name: "dev",
|
||||
Id: uuid.NewString(), // Doesn't matter, not used in DB.
|
||||
Name: fmt.Sprintf("dev-%d", len(resources)), // Ensure unique name per agent
|
||||
Auth: &proto.Agent_Token{
|
||||
Token: authToken.String(),
|
||||
},
|
||||
|
Reference in New Issue
Block a user