Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to generate fake data for Dev env's #275

Merged
merged 21 commits into from
Jun 3, 2024

Conversation

adhil0
Copy link
Collaborator

@adhil0 adhil0 commented Mar 21, 2024

  • Use faker to generate fake data
  • Inject fake data into cache if corresponding entry is empty of if overwrite_cache is true
  • fake_data, overwrite_cache, and number_of_cases can be defined as env var's or via cli (flask init-cache --fake-data --overwrite-cache --number-of-cases=123)

One shortcoming is that multiple cases aren't created for accounts, ie every account only has one case. So we'll need to generate the accounts first, then generate multiple cases for each fake account. In any case, I figured I'd make a PR as a starting point.

TODO:

  • resolvedat and reliefat should be after createdate
  • Accounts should have multiple cases
  • Engineers should have multiple cases
  • fix linting issues

@adhil0 adhil0 requested a review from dcritch March 21, 2024 01:02
@adhil0 adhil0 marked this pull request as draft March 21, 2024 02:59
adhil0 added 9 commits March 21, 2024 08:36
In order to make the fake data more realistic:
- resolved_at and relief_at must be after the creation date of the case
- Each fake account should have multiple fake cases
- Each fake engineer should have multiple fake cases
@adhil0 adhil0 marked this pull request as ready for review March 22, 2024 01:17
@adhil0 adhil0 marked this pull request as draft March 26, 2024 16:47
@adhil0 adhil0 marked this pull request as ready for review April 15, 2024 22:05
@adhil0
Copy link
Collaborator Author

adhil0 commented Apr 15, 2024

@dcritch now we need to install the Faker package to run our tests. It's kind of big (2MB), let me know if you can see a way for us to avoid installing it.

@dcritch
Copy link
Contributor

dcritch commented Apr 18, 2024

Are you concerned about the linter.yml or the install when firing up a dev env via docker-compose? For the workflow, I don't think we have much choice. For dev environments: is there a risk to having the package installed in prod?

@adhil0
Copy link
Collaborator Author

adhil0 commented Apr 18, 2024

Are you concerned about the linter.yml or the install when firing up a dev env via docker-compose? For the workflow, I don't think we have much choice. For dev environments: is there a risk to having the package installed in prod?

Talking more about linter.yml. For dev environments it's not necessarily a risk, I'm thinking that the package might be unnecessary bloat

@dcritch
Copy link
Contributor

dcritch commented Apr 18, 2024

Yeah. How about using the package once to generate some data, then add them to the repo in a json file or something as a fixture?

@adhil0
Copy link
Collaborator Author

adhil0 commented Apr 18, 2024

I think this is the best solution. Then we could add the code in the bin directory as a standalone cli.

@adhil0 adhil0 marked this pull request as draft April 19, 2024 14:26
@adhil0 adhil0 marked this pull request as ready for review May 31, 2024 18:48
@adhil0
Copy link
Collaborator Author

adhil0 commented May 31, 2024

@dcritch Now dev env's will pull fake data from a JSON rather than generating it dynamically. I've also add the data generation code as a standalone CLI, so new fake data can be generated if desired. Faker has also been removed from our dependencies.

@dcritch
Copy link
Contributor

dcritch commented Jun 3, 2024

nice, looks great! faker seems pretty neat! thanks for pulling this together. I'll merge, but we might want to include an doc update on using it as well

Copy link
Contributor

@dcritch dcritch left a comment

Choose a reason for hiding this comment

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

👍

@dcritch dcritch merged commit 9064b8c into RHsyseng:main Jun 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants