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

fix(cli): add check for DisableOwnerWorkspaceExec in scaletest#14417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 3 commits intomainfromcj/scaletest/no-owner-exec
Aug 26, 2024

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedAug 23, 2024
edited
Loading

  • Adds--use-host-login tocoder exp scaletest workspace-traffic
  • ModifiesgetScaletestWorkspaces to conditionally filter workspaces ifCODER_DISABLE_OWNER_WORKSPACE_ACCESS is set
  • Adds a warning ifCODER_DISABLE_OWNER_WORKSPACE_ACCESS is set and scaletest workspaces are filtered out due to ownership mismatch.
  • Modifiescoderdtest.New to detect cross-test bleed ofCODER_DISABLE_OWNER_WORKSPACE_ACCESS and fast-fail.

@johnstcnjohnstcn self-assigned thisAug 23, 2024
@johnstcnjohnstcn changed the titlefix(cli): scaletest: check for DisableOwnerWorkspaceExecfix(cli): scaletest: add check for DisableOwnerWorkspaceExec in scaletestAug 23, 2024
Comment on lines +22 to +33
func TestScaleTestWorkspaceTraffic_UseHostLogin(t *testing.T) {
ctx, cancelFunc := context.WithTimeout(context.Background(), testutil.WaitMedium)
defer cancelFunc()

log := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
client := coderdtest.New(t, &coderdtest.Options{
Logger: &log,
IncludeProvisionerDaemon: true,
DeploymentValues: coderdtest.DeploymentValues(t, func(dv *codersdk.DeploymentValues) {
dv.DisableOwnerWorkspaceExec = true
}),
})
Copy link
Member

@EmyrkEmyrkAug 23, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Does this test not run ingo tests?

I ask because these roles are global, and it is an unfortunate consequence atm. (maybe custom roles can solve this without being global in the future).

You can see how I reset the global state here when using this option:

rbac.ReloadBuiltinRoles(&rbac.RoleOptions{
NoOwnerWorkspaceExec:true,
})
t.Cleanup(func() {rbac.ReloadBuiltinRoles(nil) })

and of course, not.Parallel()

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As far as I can tell, each package is its own test binary. So the global variable would only affect tests run in the same package.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I added arequire.FailNow() and validated that the test does indeed get run.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

CI is passing, so the global-ness is not impacting the rest 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, Cian is right, you can think of each package as being built as its own test binary (basically that's what actually happens too), so global scope changes are constrained to that package. This is one of the test parallelism mechanisms in Go too (run different packages concurrently) and works irrespective oft.Parallel().

Comment on lines 278 to 282
if err := options.Authorizer.Authorize(context.Background(), ownerSubj, policy.ActionSSH, rbac.ResourceWorkspace); err != nil {
if rbac.IsUnauthorizedError(err) {
t.Fatal("DisableOwnerWorkspaceExec was set in some other test. Please move this test to its own package so that it does not impact other tests!")
}
require.NoError(t, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a great check 👍

Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Approving since thecoderdtest now asserts the global is correct and CI is passing.

@johnstcnjohnstcn changed the titlefix(cli): scaletest: add check for DisableOwnerWorkspaceExec in scaletestfix(cli): add check for DisableOwnerWorkspaceExec in scaletestAug 26, 2024
@johnstcnjohnstcn merged commit6914862 intomainAug 26, 2024
30 checks passed
@johnstcnjohnstcn deleted the cj/scaletest/no-owner-exec branchAugust 26, 2024 11:02
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 26, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@EmyrkEmyrkEmyrk approved these changes

@dannykoppingdannykoppingAwaiting requested review from dannykopping

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@mafredri@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp