mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(scripts/rules.go): broaden scope of testingWithOwnerUser linter (#10548)
* Updated testingWithOwnerUser ruleguard rule to detect: a) Passing client from coderdenttest.New() to clitest.SetupConfig() similar to what already exists for AGPL code b) Usage of any method of the owner client from coderdenttest.New() - all usages of the owner client must be justified with a `//nolint:gocritic` comment. * Fixed resulting linter complaints. * Added new coderdtest helpers CreateGroup and UpdateTemplateMeta. * Modified check_enterprise_import.sh to ignore scripts/rules.go.
This commit is contained in:
@@ -53,7 +53,7 @@ func Test_ProxyCRUD(t *testing.T) {
|
||||
|
||||
pty := ptytest.New(t)
|
||||
inv.Stdout = pty.Output()
|
||||
clitest.SetupConfig(t, client, conf)
|
||||
clitest.SetupConfig(t, client, conf) //nolint:gocritic // create wsproxy requires owner
|
||||
|
||||
err := inv.WithContext(ctx).Run()
|
||||
require.NoError(t, err)
|
||||
@@ -72,14 +72,14 @@ func Test_ProxyCRUD(t *testing.T) {
|
||||
|
||||
pty = ptytest.New(t)
|
||||
inv.Stdout = pty.Output()
|
||||
clitest.SetupConfig(t, client, conf)
|
||||
clitest.SetupConfig(t, client, conf) //nolint:gocritic // requires owner
|
||||
|
||||
err = inv.WithContext(ctx).Run()
|
||||
require.NoError(t, err)
|
||||
pty.ExpectMatch(expectedName)
|
||||
|
||||
// Also check via the api
|
||||
proxies, err := client.WorkspaceProxies(ctx)
|
||||
proxies, err := client.WorkspaceProxies(ctx) //nolint:gocritic // requires owner
|
||||
require.NoError(t, err, "failed to get workspace proxies")
|
||||
// Include primary
|
||||
require.Len(t, proxies.Regions, 2, "expected 1 proxy")
|
||||
@@ -128,12 +128,12 @@ func Test_ProxyCRUD(t *testing.T) {
|
||||
|
||||
pty := ptytest.New(t)
|
||||
inv.Stdout = pty.Output()
|
||||
clitest.SetupConfig(t, client, conf)
|
||||
clitest.SetupConfig(t, client, conf) //nolint:gocritic // requires owner
|
||||
|
||||
err = inv.WithContext(ctx).Run()
|
||||
require.NoError(t, err)
|
||||
|
||||
proxies, err := client.WorkspaceProxies(ctx)
|
||||
proxies, err := client.WorkspaceProxies(ctx) //nolint:gocritic // requires owner
|
||||
require.NoError(t, err, "failed to get workspace proxies")
|
||||
require.Len(t, proxies.Regions, 1, "expected only primary proxy")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user