Skip to content

Commit b1876bb

Browse files
committed
fix tests
1 parent d84d377 commit b1876bb

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

cli/deployment/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func newConfig() codersdk.DeploymentConfig {
168168
Usage: "Client secret for Login with GitHub.",
169169
Flag: "oauth2-github-client-secret",
170170
},
171-
AllowedOrganizations: codersdk.DeploymentConfigField[[]string]{
171+
AllowedOrgs: codersdk.DeploymentConfigField[[]string]{
172172
Name: "OAuth2 GitHub Allowed Orgs",
173173
Usage: "Organizations the user must be a member of to Login with GitHub.",
174174
Flag: "oauth2-github-allowed-orgs",

cli/deployment/config_test.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ func TestConfig(t *testing.T) {
4343
require.Equal(t, config.Address.Value, "0.0.0.0:8443")
4444
require.Equal(t, config.AccessURL.Value, "https://dev.coder.com")
4545
require.Equal(t, config.PostgresURL.Value, "some-url")
46-
require.Equal(t, config.PprofAddress.Value, "something")
47-
require.Equal(t, config.PprofEnable.Value, true)
48-
require.Equal(t, config.PrometheusAddress.Value, "hello-world")
49-
require.Equal(t, config.PrometheusEnable.Value, true)
46+
require.Equal(t, config.Pprof.Address.Value, "something")
47+
require.Equal(t, config.Pprof.Enable.Value, true)
48+
require.Equal(t, config.Prometheus.Address.Value, "hello-world")
49+
require.Equal(t, config.Prometheus.Enable.Value, true)
5050
require.Equal(t, config.ProvisionerDaemons.Value, 5)
5151
require.Equal(t, config.SecureAuthCookie.Value, true)
5252
require.Equal(t, config.SSHKeygenAlgorithm.Value, "potato")
53-
require.Equal(t, config.TelemetryEnable.Value, false)
54-
require.Equal(t, config.TelemetryTrace.Value, false)
53+
require.Equal(t, config.Telemetry.Enable.Value, false)
54+
require.Equal(t, config.Telemetry.Trace.Value, false)
5555
require.Equal(t, config.WildcardAccessURL.Value, "something-wildcard.com")
5656
},
5757
}, {
@@ -67,14 +67,14 @@ func TestConfig(t *testing.T) {
6767
"CODER_DERP_SERVER_STUN_ADDRESSES": "google.org",
6868
},
6969
Valid: func(config codersdk.DeploymentConfig) {
70-
require.Equal(t, config.DERPConfigPath.Value, "/example/path")
71-
require.Equal(t, config.DERPConfigURL.Value, "https://google.com")
72-
require.Equal(t, config.DERPServerEnable.Value, false)
73-
require.Equal(t, config.DERPServerRegionCode.Value, "something")
74-
require.Equal(t, config.DERPServerRegionID.Value, 123)
75-
require.Equal(t, config.DERPServerRegionName.Value, "Code-Land")
76-
require.Equal(t, config.DERPServerRelayURL.Value, "1.1.1.1")
77-
require.Equal(t, config.DERPServerSTUNAddresses.Value, []string{"google.org"})
70+
require.Equal(t, config.DERP.Config.Path.Value, "/example/path")
71+
require.Equal(t, config.DERP.Config.URL.Value, "https://google.com")
72+
require.Equal(t, config.DERP.Server.Enable.Value, false)
73+
require.Equal(t, config.DERP.Server.RegionCode.Value, "something")
74+
require.Equal(t, config.DERP.Server.RegionID.Value, 123)
75+
require.Equal(t, config.DERP.Server.RegionName.Value, "Code-Land")
76+
require.Equal(t, config.DERP.Server.RelayURL.Value, "1.1.1.1")
77+
require.Equal(t, config.DERP.Server.STUNAddresses.Value, []string{"google.org"})
7878
},
7979
}, {
8080
Name: "Enterprise",
@@ -101,18 +101,18 @@ func TestConfig(t *testing.T) {
101101
"CODER_TLS_MIN_VERSION": "tls10",
102102
},
103103
Valid: func(config codersdk.DeploymentConfig) {
104-
require.Len(t, config.TLSCertFiles.Value, 2)
105-
require.Equal(t, config.TLSCertFiles.Value[0], "/etc/acme-sh/dev.coder.com")
106-
require.Equal(t, config.TLSCertFiles.Value[1], "/etc/acme-sh/*.dev.coder.com")
104+
require.Len(t, config.TLS.CertFiles.Value, 2)
105+
require.Equal(t, config.TLS.CertFiles.Value[0], "/etc/acme-sh/dev.coder.com")
106+
require.Equal(t, config.TLS.CertFiles.Value[1], "/etc/acme-sh/*.dev.coder.com")
107107

108-
require.Len(t, config.TLSKeyFiles.Value, 2)
109-
require.Equal(t, config.TLSKeyFiles.Value[0], "/etc/acme-sh/dev.coder.com")
110-
require.Equal(t, config.TLSKeyFiles.Value[1], "/etc/acme-sh/*.dev.coder.com")
108+
require.Len(t, config.TLS.KeyFiles.Value, 2)
109+
require.Equal(t, config.TLS.KeyFiles.Value[0], "/etc/acme-sh/dev.coder.com")
110+
require.Equal(t, config.TLS.KeyFiles.Value[1], "/etc/acme-sh/*.dev.coder.com")
111111

112-
require.Equal(t, config.TLSClientAuth.Value, "/some/path")
113-
require.Equal(t, config.TLSClientCAFile.Value, "/some/path")
114-
require.Equal(t, config.TLSEnable.Value, true)
115-
require.Equal(t, config.TLSMinVersion.Value, "tls10")
112+
require.Equal(t, config.TLS.ClientAuth.Value, "/some/path")
113+
require.Equal(t, config.TLS.ClientCAFile.Value, "/some/path")
114+
require.Equal(t, config.TLS.Enable.Value, true)
115+
require.Equal(t, config.TLS.MinVersion.Value, "tls10")
116116
},
117117
}, {
118118
Name: "OIDC",
@@ -125,12 +125,12 @@ func TestConfig(t *testing.T) {
125125
"CODER_OIDC_SCOPES": "something,here",
126126
},
127127
Valid: func(config codersdk.DeploymentConfig) {
128-
require.Equal(t, config.OIDCIssuerURL.Value, "https://accounts.google.com")
129-
require.Equal(t, config.OIDCEmailDomain.Value, "coder.com")
130-
require.Equal(t, config.OIDCClientID.Value, "client")
131-
require.Equal(t, config.OIDCClientSecret.Value, "secret")
132-
require.Equal(t, config.OIDCAllowSignups.Value, false)
133-
require.Equal(t, config.OIDCScopes.Value, []string{"something", "here"})
128+
require.Equal(t, config.OIDC.IssuerURL.Value, "https://accounts.google.com")
129+
require.Equal(t, config.OIDC.EmailDomain.Value, "coder.com")
130+
require.Equal(t, config.OIDC.ClientID.Value, "client")
131+
require.Equal(t, config.OIDC.ClientSecret.Value, "secret")
132+
require.Equal(t, config.OIDC.AllowSignups.Value, false)
133+
require.Equal(t, config.OIDC.Scopes.Value, []string{"something", "here"})
134134
},
135135
}, {
136136
Name: "GitHub",
@@ -142,11 +142,11 @@ func TestConfig(t *testing.T) {
142142
"CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS": "true",
143143
},
144144
Valid: func(config codersdk.DeploymentConfig) {
145-
require.Equal(t, config.OAuth2GithubClientID.Value, "client")
146-
require.Equal(t, config.OAuth2GithubClientSecret.Value, "secret")
147-
require.Equal(t, []string{"coder"}, config.OAuth2GithubAllowedOrgs.Value)
148-
require.Equal(t, []string{"coder"}, config.OAuth2GithubAllowedTeams.Value)
149-
require.Equal(t, config.OAuth2GithubAllowSignups.Value, true)
145+
require.Equal(t, config.OAuth2.Github.ClientID.Value, "client")
146+
require.Equal(t, config.OAuth2.Github.ClientSecret.Value, "secret")
147+
require.Equal(t, []string{"coder"}, config.OAuth2.Github.AllowedOrgs.Value)
148+
require.Equal(t, []string{"coder"}, config.OAuth2.Github.AllowedTeams.Value)
149+
require.Equal(t, config.OAuth2.Github.AllowSignups.Value, true)
150150
},
151151
}} {
152152
tc := tc

codersdk/deploymentconfig.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ type OAuth2Config struct {
7575
}
7676

7777
type OAuth2GithubConfig struct {
78-
ClientID DeploymentConfigField[string] `json:"client_id"`
79-
ClientSecret DeploymentConfigField[string] `json:"client_secret"`
80-
AllowedOrganizations DeploymentConfigField[[]string] `json:"allowed_organizations"`
81-
AllowedTeams DeploymentConfigField[[]string] `json:"allowed_teams"`
82-
AllowSignups DeploymentConfigField[bool] `json:"allow_signups"`
83-
EnterpriseBaseURL DeploymentConfigField[string] `json:"enterprise_base_url"`
78+
ClientID DeploymentConfigField[string] `json:"client_id"`
79+
ClientSecret DeploymentConfigField[string] `json:"client_secret"`
80+
AllowedOrgs DeploymentConfigField[[]string] `json:"allowed_orgs"`
81+
AllowedTeams DeploymentConfigField[[]string] `json:"allowed_teams"`
82+
AllowSignups DeploymentConfigField[bool] `json:"allow_signups"`
83+
EnterpriseBaseURL DeploymentConfigField[string] `json:"enterprise_base_url"`
8484
}
8585

8686
type OIDCConfig struct {

0 commit comments

Comments
 (0)