Skip to content

Commit e99fe03

Browse files
Claudeclaude
andcommitted
fix: fix appendAssign issues in test files
- Fix 'append result not assigned to the same slice' issues - Create new slices when appending in tests to avoid side effects 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3194273 commit e99fe03

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cli/server_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,8 @@ func TestServer(t *testing.T) {
17011701
// Next, we instruct the same server to display the YAML config
17021702
// and then save it.
17031703
inv = inv.WithContext(testutil.Context(t, testutil.WaitMedium))
1704-
inv.Args = append(args, "--write-config")
1704+
newArgs := append([]string{}, args...)
1705+
inv.Args = append(newArgs, "--write-config")
17051706
fi, err := os.OpenFile(testutil.TempFile(t, "", "coder-config-test-*"), os.O_WRONLY|os.O_CREATE, 0o600)
17061707
require.NoError(t, err)
17071708
defer fi.Close()

cli/templatepush_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ func TestTemplatePush(t *testing.T) {
723723
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, templateVersion.ID)
724724

725725
// Test the cli command.
726-
modifiedTemplateVariables := append(initialTemplateVariables,
726+
modifiedTemplateVariables := append(append([]*proto.TemplateVariable{}, initialTemplateVariables...),
727727
&proto.TemplateVariable{
728728
Name: "second_variable",
729729
Description: "This is the second variable.",
@@ -792,7 +792,7 @@ func TestTemplatePush(t *testing.T) {
792792
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, templateVersion.ID)
793793

794794
// Test the cli command.
795-
modifiedTemplateVariables := append(initialTemplateVariables,
795+
modifiedTemplateVariables := append(append([]*proto.TemplateVariable{}, initialTemplateVariables...),
796796
&proto.TemplateVariable{
797797
Name: "second_variable",
798798
Description: "This is the second variable.",
@@ -839,7 +839,7 @@ func TestTemplatePush(t *testing.T) {
839839
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, templateVersion.ID)
840840

841841
// Test the cli command.
842-
modifiedTemplateVariables := append(initialTemplateVariables,
842+
modifiedTemplateVariables := append(append([]*proto.TemplateVariable{}, initialTemplateVariables...),
843843
&proto.TemplateVariable{
844844
Name: "second_variable",
845845
Description: "This is the second variable",
@@ -905,7 +905,7 @@ func TestTemplatePush(t *testing.T) {
905905
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, templateVersion.ID)
906906

907907
// Test the cli command.
908-
modifiedTemplateVariables := append(initialTemplateVariables,
908+
modifiedTemplateVariables := append(append([]*proto.TemplateVariable{}, initialTemplateVariables...),
909909
&proto.TemplateVariable{
910910
Name: "second_variable",
911911
Description: "This is the second variable.",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy