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

feat: add dbfake for workspace builds and resources#10426

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
kylecarbs merged 10 commits intomainfromfakebuild
Nov 2, 2023
Merged

Conversation

kylecarbs
Copy link
Member

@kylecarbskylecarbs commentedOct 30, 2023
edited
Loading

This createscoderdtest.NewWithDatabase and adds a series of helper functions todbfake that insert structured fake data for resources into the database.

It allows us to remove provisionerd from many tests, which should speed them up and reduce flakes.

Ideally, we merge this then I convert all tests to use this new structure. It's intentionally abstract right now because I assume more patterns will emerge as I work through cases.

@kylecarbskylecarbs self-assigned thisOct 30, 2023
@kylecarbskylecarbsforce-pushed thefakebuild branch 3 times, most recently from0913ae1 toa6fe665CompareOctober 30, 2023 17:16
This creates `coderdtest.NewWithDatabase` and adds a series ofhelper functions to `dbfake` that insert structured fake datafor resources into the database.It allows us to remove provisionerd from a significant amount oftests which should speed them up and reduce flakes.
@kylecarbskylecarbs changed the titlefeat: add dbfakedata for workspace builds and resourcesfeat: add dbfake for workspace builds and resourcesOct 30, 2023
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.

I like the helper functions. It would be great if we could make anotherAquireProvisionerJob function to mark jobs as complete. Just mutate the job fields with some "test only" query we have.

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.

Last comment, can merge without. Maybe we should not name thisCreateWorkspace, because we use that exact wording in our API related helpers which actually goes through theCreate flow and has all the deps correct.

Maybe name itInsertWorkspace?PutWorkspace? Some other word?

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Nice work, I think this is a huge improvement for writing tests!

I did notice CI is still quite unhappy:

                      - pq: insert or update on table "workspace_builds" violates foreign key constraint "workspace_builds_job_id_fkey"

Perhaps just a case of missing ID in a call to dbgen (in dbfake).

@kylecarbskylecarbs merged commit839a16e intomainNov 2, 2023
@kylecarbskylecarbs deleted the fakebuild branchNovember 2, 2023 17:15
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsNov 2, 2023
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

Assignees

@kylecarbskylecarbs

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@kylecarbs@mafredri@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp