Skip to content

Commit e1701cf

Browse files
committed
Apply code formatting fixes
1 parent 79af7b9 commit e1701cf

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

coderd/database/db2sdk/db2sdk.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ func validateAppHostnameLength(subdomainName string) bool {
545545
if subdomainName == "" {
546546
return true
547547
}
548-
548+
549549
// Split the hostname into segments by '--' (the format is app--agent--workspace--user)
550550
segments := strings.Split(subdomainName, "--")
551551
for _, segment := range segments {
@@ -577,13 +577,13 @@ func Apps(dbApps []database.WorkspaceApp, statuses []database.WorkspaceAppStatus
577577
statuses := statusesByAppID[dbApp.ID]
578578
subdomainName := AppSubdomain(dbApp, agent.Name, workspace.Name, ownerName)
579579
appHealth := codersdk.WorkspaceAppHealth(dbApp.Health)
580-
580+
581581
// Check if this is a subdomain app with hostname length issues
582582
if dbApp.Subdomain && subdomainName != "" && !validateAppHostnameLength(subdomainName) {
583583
// Override health to unhealthy if hostname exceeds DNS limits
584584
appHealth = codersdk.WorkspaceAppHealthUnhealthy
585585
}
586-
586+
587587
apps = append(apps, codersdk.WorkspaceApp{
588588
ID: dbApp.ID,
589589
URL: dbApp.Url.String,

coderd/database/db2sdk/hostname_validation_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,44 @@ func TestValidateAppHostnameLength(t *testing.T) {
1414
t.Parallel()
1515

1616
tests := []struct {
17-
name string
17+
name string
1818
subdomainName string
19-
expected bool
19+
expected bool
2020
}{
2121
{
22-
name: "empty hostname",
22+
name: "empty hostname",
2323
subdomainName: "",
24-
expected: true,
24+
expected: true,
2525
},
2626
{
27-
name: "valid short hostname",
27+
name: "valid short hostname",
2828
subdomainName: "app--agent--workspace--user",
29-
expected: true,
29+
expected: true,
3030
},
3131
{
32-
name: "valid hostname with max length segment",
32+
name: "valid hostname with max length segment",
3333
subdomainName: "a12345678901234567890123456789012345678901234567890123456789012--agent--workspace--user", // 63 chars in first segment
34-
expected: true,
34+
expected: true,
3535
},
3636
{
37-
name: "invalid hostname with long app name",
37+
name: "invalid hostname with long app name",
3838
subdomainName: "toolongappnamethatexceedsthednslimitof63charactersforsureandshouldfail--agent--workspace--user", // 78 chars in first segment
39-
expected: false,
39+
expected: false,
4040
},
4141
{
42-
name: "invalid hostname with long agent name",
42+
name: "invalid hostname with long agent name",
4343
subdomainName: "app--toolongagentnamethatexceedsthednslimitof63charactersforsureandshouldfail--workspace--user", // 72 chars in agent segment
44-
expected: false,
44+
expected: false,
4545
},
4646
{
47-
name: "invalid hostname with long workspace name",
47+
name: "invalid hostname with long workspace name",
4848
subdomainName: "app--agent--toolongworkspacenamethatexceedsthednslimitof63charactersforsureandshouldfail--user", // 77 chars in workspace segment
49-
expected: false,
49+
expected: false,
5050
},
5151
{
52-
name: "invalid hostname with long username",
52+
name: "invalid hostname with long username",
5353
subdomainName: "app--agent--workspace--toolongusernamethatexceedsthednslimitof63charactersforsureandshouldfail", // 72 chars in username segment
54-
expected: false,
54+
expected: false,
5555
},
5656
}
5757

@@ -119,4 +119,4 @@ func TestAppsWithHostnameLengthValidation(t *testing.T) {
119119
require.Equal(t, tt.expectedHealth, apps[0].Health)
120120
})
121121
}
122-
}
122+
}

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