Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd6766f7

Browse files
authored
fix: sort provisioner key tags in cli output (#14875)
I'm seeing flakes like``` provisionerkeys_test.go:68: 2024-09-30 05:58:44.686: cmd: matched newline = "CREATED AT NAME TAGS " provisionerkeys_test.go:72: 2024-09-30 05:58:44.686: cmd: matched newline = "2024-09-30T05:58:44Z dont-test-me my=way foo=bar " provisionerkeys_test.go:74: Error Trace:/Users/runner/work/coder/coder/enterprise/cli/provisionerkeys_test.go:74 Error: "2024-09-30T05:58:44Z dont-test-me my=way foo=bar " does not contain "foo=bar my=way" Test: TestProvisionerKeys/CRUD```e.g.https://github.com/coder/coder/actions/runs/11100237276/job/30835714478?pr=14855Since the tags are a map, we weren't outputting them in a consistentorder on the CLI, leading to flakes.This sorts the tags by key when converting to a string, for aconsistent, canonical output.
1 parentba90bb0 commitd6766f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎codersdk/provisionerdaemons.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
"github.com/google/uuid"
1414
"github.com/hashicorp/yamux"
15+
"golang.org/x/exp/maps"
16+
"golang.org/x/exp/slices"
1517
"golang.org/x/xerrors"
1618
"nhooyr.io/websocket"
1719

@@ -278,9 +280,11 @@ func (c *Client) ServeProvisionerDaemon(ctx context.Context, req ServeProvisione
278280
typeProvisionerKeyTagsmap[string]string
279281

280282
func (pProvisionerKeyTags)String()string {
283+
keys:=maps.Keys(p)
284+
slices.Sort(keys)
281285
tags:= []string{}
282-
forkey,value:=rangep {
283-
tags=append(tags,fmt.Sprintf("%s=%s",key,value))
286+
for_,key:=rangekeys {
287+
tags=append(tags,fmt.Sprintf("%s=%s",key,p[key]))
284288
}
285289
returnstrings.Join(tags," ")
286290
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp