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

test(coderd/database): use seperate context for subtests to fix flake#19029

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
ethanndickson merged 1 commit intomainfromethan/fix-flake-db-querier
Jul 24, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletionscoderd/database/querier_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2037,7 +2037,6 @@ func TestAuthorizedAuditLogs(t *testing.T) {
}

// Now fetch all the logs
ctx := testutil.Context(t, testutil.WaitLong)
auditorRole, err := rbac.RoleByName(rbac.RoleAuditor())
require.NoError(t, err)

Expand All@@ -2054,6 +2053,7 @@ func TestAuthorizedAuditLogs(t *testing.T) {

t.Run("NoAccess", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Given: A user who is a member of 0 organizations
memberCtx := dbauthz.As(ctx, rbac.Subject{
Expand All@@ -2076,6 +2076,7 @@ func TestAuthorizedAuditLogs(t *testing.T) {

t.Run("SiteWideAuditor", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Given: A site wide auditor
siteAuditorCtx := dbauthz.As(ctx, rbac.Subject{
Expand All@@ -2098,6 +2099,7 @@ func TestAuthorizedAuditLogs(t *testing.T) {

t.Run("SingleOrgAuditor", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

orgID := orgIDs[0]
// Given: An organization scoped auditor
Expand All@@ -2121,6 +2123,7 @@ func TestAuthorizedAuditLogs(t *testing.T) {

t.Run("TwoOrgAuditors", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

first := orgIDs[0]
second := orgIDs[1]
Expand All@@ -2147,6 +2150,7 @@ func TestAuthorizedAuditLogs(t *testing.T) {

t.Run("ErroneousOrg", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Given: A user who is an auditor for an organization that has 0 logs
userCtx := dbauthz.As(ctx, rbac.Subject{
Expand DownExpand Up@@ -2232,7 +2236,6 @@ func TestGetAuthorizedConnectionLogsOffset(t *testing.T) {
}

// Now fetch all the logs
ctx := testutil.Context(t, testutil.WaitLong)
auditorRole, err := rbac.RoleByName(rbac.RoleAuditor())
require.NoError(t, err)

Expand All@@ -2249,6 +2252,7 @@ func TestGetAuthorizedConnectionLogsOffset(t *testing.T) {

t.Run("NoAccess", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Given: A user who is a member of 0 organizations
memberCtx := dbauthz.As(ctx, rbac.Subject{
Expand All@@ -2271,6 +2275,7 @@ func TestGetAuthorizedConnectionLogsOffset(t *testing.T) {

t.Run("SiteWideAuditor", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Given: A site wide auditor
siteAuditorCtx := dbauthz.As(ctx, rbac.Subject{
Expand All@@ -2293,6 +2298,7 @@ func TestGetAuthorizedConnectionLogsOffset(t *testing.T) {

t.Run("SingleOrgAuditor", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

orgID := orgIDs[0]
// Given: An organization scoped auditor
Expand All@@ -2316,6 +2322,7 @@ func TestGetAuthorizedConnectionLogsOffset(t *testing.T) {

t.Run("TwoOrgAuditors", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

first := orgIDs[0]
second := orgIDs[1]
Expand All@@ -2340,6 +2347,7 @@ func TestGetAuthorizedConnectionLogsOffset(t *testing.T) {

t.Run("ErroneousOrg", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Given: A user who is an auditor for an organization that has 0 logs
userCtx := dbauthz.As(ctx, rbac.Subject{
Expand DownExpand Up@@ -2421,7 +2429,6 @@ func TestCountConnectionLogs(t *testing.T) {

func TestConnectionLogsOffsetFilters(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitLong)

db, _ := dbtestutil.NewDB(t)

Expand DownExpand Up@@ -2652,9 +2659,9 @@ func TestConnectionLogsOffsetFilters(t *testing.T) {
}

for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitLong)
logs, err := db.GetConnectionLogsOffset(ctx, tc.params)
require.NoError(t, err)
count, err := db.CountConnectionLogs(ctx, database.CountConnectionLogsParams{
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp