Skip to content

Commit

Permalink
Fix TestSessionController_AcquireSessionContext
Browse files Browse the repository at this point in the history
  • Loading branch information
codingllama authored and github-actions committed Sep 27, 2024
1 parent a1ff032 commit 8406ac5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/srv/session_control_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ func TestSessionController_AcquireSessionContext(t *testing.T) {
}
return idCtx
}
assertTrustedDeviceRequired := func(t *testing.T, _ context.Context, err error, _ *eventstest.MockRecorderEmitter) {
assert.ErrorContains(t, err, "device", "AcquireSessionContext returned an unexpected error")
assert.True(t, trace.IsAccessDenied(err), "AcquireSessionContext returned an error other than trace.AccessDeniedError: %T", err)
}

cases := []struct {
name string
Expand Down Expand Up @@ -451,22 +455,17 @@ func TestSessionController_AcquireSessionContext(t *testing.T) {
},
},
{
name: "device extensions not enforced for OSS",
cfg: cfgWithDeviceMode(constants.DeviceTrustModeRequired),
identity: minimalIdentity,
assertion: func(t *testing.T, _ context.Context, err error, _ *eventstest.MockRecorderEmitter) {
assert.NoError(t, err, "AcquireSessionContext returned an unexpected error")
},
name: "device extensions enforced for OSS",
cfg: cfgWithDeviceMode(constants.DeviceTrustModeRequired),
identity: minimalIdentity,
assertion: assertTrustedDeviceRequired,
},
{
name: "device extensions enforced for Enterprise",
buildType: modules.BuildEnterprise,
cfg: cfgWithDeviceMode(constants.DeviceTrustModeRequired),
identity: minimalIdentity,
assertion: func(t *testing.T, _ context.Context, err error, _ *eventstest.MockRecorderEmitter) {
assert.ErrorContains(t, err, "device", "AcquireSessionContext returned an unexpected error")
assert.True(t, trace.IsAccessDenied(err), "AcquireSessionContext returned an error other than trace.AccessDeniedError: %T", err)
},
assertion: assertTrustedDeviceRequired,
},
{
name: "device extensions valid for Enterprise",
Expand Down

0 comments on commit 8406ac5

Please sign in to comment.