OH-SHOWN / ohshown-backend

OH!SHOWN 野生動物出沒痕跡通報系統
http://ohshown.site
MIT License
2 stars 8 forks source link

Update the test data set #49

Closed tai271828 closed 2 years ago

tai271828 commented 2 years ago

By reducing the pool of the test data set, it will help us focus on the regression of refactoring[1].

Steps to Verify This Pull Request

NOTE!! This command will remove the data in your development database. Do not invoke the command until you know what you are going to do: docker-compose -f docker-compose.dev.yml down; sudo rm -rf /tmp/disfactory_d*; docker-compose -f docker-compose.dev.yml up -d --build --force-recreate

Expected Result

The dataset of testing is much smaller. (less than 10 entries)

Selection_029

Additional Context

If the pool is small enough, it is easy for us to catch the regression like this (frontend missing to show the entries in the database)

~~The entries are in 台南 and should show up. I think this is because the regression of https://github.com/tai271828/disfactory-backend/pull/46 and https://github.com/tai271828/disfactory-frontend/pull/63 Selection_030~~

tai271828 commented 2 years ago

Ooops, CI failed for checking the seed of test data set. I will update this pull request to fix the CI. @yanghaochang104 @EagleC0318 @Neilxx @joshuay1 @zztin before I fix the CI, I still appreciate if you can comment on this idea of reducing test data. Do you think it is reasonable?

tai271828 commented 2 years ago

Maybe not a regression because http://ohshown.site:8080/ still shows the entries.... hmmm let me see what's going on.

tai271828 commented 2 years ago

Ah, stupid me. I forgot to update my frontend codebase.

tai271828 commented 2 years ago

Fixed CI! This pull request is ready to review again. Please input your comments. Any of your comments will be appreciated.

EagleC0318 commented 2 years ago

@tai271828 A quick question just comes up in my mind. Would the user reported data be gone, if the BE server restart?

tai271828 commented 2 years ago

Interesting, so when we start the BE server, the backend/fixtures/full-info.csv will be loaded to DB?

Yes, via drango migration.

The fake factory data is not useful for us, so I think it's good to remove them. Looks good for me!

It's useful if we (well, I : ) ) want to refactor the original disfactory codebase. Besides, some unittest still use it so we should not remove the data unless we want to deprecate the corresponding test cases as well.

The mock-up data is also useful if we slightly modify it to be mock-up data for wild-animal reports.

tai271828 commented 2 years ago

@tai271828 A quick question just comes up in my mind. Would the user reported data be gone, if the BE server restart?

The data are stored in the docker volume by default. See https://github.com/tai271828/disfactory-backend/blob/main-tbbca/backend/docker-compose.dev.yml#L34

So any manipulation destorying/removing the volume will remove the data. For example:

  1. Purging the volume when removing the containers
  2. Removing the files of backup in the host path a.k.a. /tmp/db_dump/ in our case manually or restarting your laptop.
tai271828 commented 2 years ago

Land for main-tbbca to main migration.