Skip to content

Commit c736229

Browse files
committed
fix references
1 parent 8e68922 commit c736229

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

coderd/apikey_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func TestTokenUserSetMaxLifetime(t *testing.T) {
125125
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
126126
defer cancel()
127127
dc := coderdtest.DeploymentValues(t)
128-
dc.MaxTokenLifetime = serpent.Duration(time.Hour * 24 * 7)
128+
dc.Sessions.MaxTokenLifetime = serpent.Duration(time.Hour * 24 * 7)
129129
client := coderdtest.New(t, &coderdtest.Options{
130130
DeploymentValues: dc,
131131
})
@@ -165,7 +165,7 @@ func TestSessionExpiry(t *testing.T) {
165165
//
166166
// We don't support updating the deployment config after startup, but for
167167
// this test it works because we don't copy the value (and we use pointers).
168-
dc.SessionDuration = serpent.Duration(time.Second)
168+
dc.Sessions.DefaultSessionDuration = serpent.Duration(time.Second)
169169

170170
userClient, _ := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
171171

@@ -174,8 +174,8 @@ func TestSessionExpiry(t *testing.T) {
174174
apiKey, err := db.GetAPIKeyByID(ctx, strings.Split(token, "-")[0])
175175
require.NoError(t, err)
176176

177-
require.EqualValues(t, dc.SessionDuration.Value().Seconds(), apiKey.LifetimeSeconds)
178-
require.WithinDuration(t, apiKey.CreatedAt.Add(dc.SessionDuration.Value()), apiKey.ExpiresAt, 2*time.Second)
177+
require.EqualValues(t, dc.Sessions.DefaultSessionDuration.Value().Seconds(), apiKey.LifetimeSeconds)
178+
require.WithinDuration(t, apiKey.CreatedAt.Add(dc.Sessions.DefaultSessionDuration.Value()), apiKey.ExpiresAt, 2*time.Second)
179179

180180
// Update the session token to be expired so we can test that it is
181181
// rejected for extra points.

coderd/provisionerdserver/provisionerdserver_test.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ func TestAcquireJob(t *testing.T) {
166166
// Set the max session token lifetime so we can assert we
167167
// create an API key with an expiration within the bounds of the
168168
// deployment config.
169-
dv := &codersdk.DeploymentValues{MaxTokenLifetime: serpent.Duration(time.Hour)}
169+
dv := &codersdk.DeploymentValues{
170+
Sessions: codersdk.SessionLifetime{
171+
MaxTokenLifetime: serpent.Duration(time.Hour),
172+
}}
170173
gitAuthProvider := &sdkproto.ExternalAuthProviderResource{
171174
Id: "github",
172175
}
@@ -310,8 +313,8 @@ func TestAcquireJob(t *testing.T) {
310313
require.Len(t, toks, 2, "invalid api key")
311314
key, err := db.GetAPIKeyByID(ctx, toks[0])
312315
require.NoError(t, err)
313-
require.Equal(t, int64(dv.MaxTokenLifetime.Value().Seconds()), key.LifetimeSeconds)
314-
require.WithinDuration(t, time.Now().Add(dv.MaxTokenLifetime.Value()), key.ExpiresAt, time.Minute)
316+
require.Equal(t, int64(dv.Sessions.MaxTokenLifetime.Value().Seconds()), key.LifetimeSeconds)
317+
require.WithinDuration(t, time.Now().Add(dv.Sessions.MaxTokenLifetime.Value()), key.ExpiresAt, time.Minute)
315318

316319
want, err := json.Marshal(&proto.AcquiredJob_WorkspaceBuild_{
317320
WorkspaceBuild: &proto.AcquiredJob_WorkspaceBuild{

enterprise/coderd/coderd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
148148
DB: options.Database,
149149
OAuth2Configs: oauthConfigs,
150150
RedirectToLogin: false,
151-
DisableSessionExpiryRefresh: options.DeploymentValues.DisableSessionExpiryRefresh.Value(),
151+
DisableSessionExpiryRefresh: options.DeploymentValues.Sessions.DisableSessionExpiryRefresh.Value(),
152152
Optional: false,
153153
SessionTokenFunc: nil, // Default behavior
154154
PostAuthAdditionalHeadersFunc: options.PostAuthAdditionalHeadersFunc,
@@ -157,7 +157,7 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
157157
DB: options.Database,
158158
OAuth2Configs: oauthConfigs,
159159
RedirectToLogin: false,
160-
DisableSessionExpiryRefresh: options.DeploymentValues.DisableSessionExpiryRefresh.Value(),
160+
DisableSessionExpiryRefresh: options.DeploymentValues.Sessions.DisableSessionExpiryRefresh.Value(),
161161
Optional: true,
162162
SessionTokenFunc: nil, // Default behavior
163163
PostAuthAdditionalHeadersFunc: options.PostAuthAdditionalHeadersFunc,

site/src/api/typesGenerated.ts

+8-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)