Skip to content

add develop script to view and update test data #26594

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

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

a1012112796
Copy link
Member

@a1012112796 a1012112796 commented Aug 19, 2023

try add a dev script to start a dev service base on the test data (models/fixtures/, tests/gitea-repositories-meta and tests/gitea-lfs-meta). then the developer can check and update the test data by ui operation on the test server. I think it will be a more simple way than manually edit. example:

example.mp4

TODOs:

  • looks need rewrite a dumper to have a better format.

try add a dev script to start a dev service
base on the test data (`models/fixtures/`,
`tests/gitea-repositories-meta` and
`tests/gitea-lfs-meta`). then the developer
can check and update the test data by ui
operation on the test server. I think it will
be a more simple way than manually edit.

Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 19, 2023
Signed-off-by: a1012112796 <1012112796@qq.com>
@a1012112796 a1012112796 marked this pull request as draft August 21, 2023 01:56
@a1012112796 a1012112796 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Aug 21, 2023
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
@github-actions github-actions bot added type/docs This PR mainly updates/creates documentation topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile labels Sep 8, 2023
@lunny
Copy link
Member

lunny commented Sep 9, 2023

How about to implement MashalYML and UnMashalYML? Or other yml library supported interface?

@wxiaoguang
Copy link
Contributor

I do not think it is maintainable to introduce a new "contrib/dev/dev.go" with a lot of magic strings in it.

I have a feeling that many existing test-related code could/should be reused.

@wxiaoguang
Copy link
Contributor

And there is a security problem: if by default "git hook" is enabled , and the passwords are well-known ones, attackers could hack into a Gitea developer's computer.

@a1012112796
Copy link
Member Author

a1012112796 commented Sep 9, 2023

I have a feeling that many existing test-related code could/should be reused.

I think I hasn't change any test data now. just update a little test datas which has bug ...

And there is a security problem: if by default "git hook" is enabled , and the passwords are well-known ones, attackers could hack into a Gitea developer's computer.

I think it's not a problem, developer just use it to edit test data, which should not be running as a public web server. and user can only view/update the test data in develop server, can't view or change other data in developer's computer also.

I think it's necesary, because fully manually editing the test data may be hard in some operations like creating a new repository

Copy link
Member Author

@a1012112796 a1012112796 left a comment

Choose a reason for hiding this comment

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

TODO: will do these bug fixs in new pull requests

@@ -320,6 +320,10 @@ func (pr *PullRequest) LoadRequestedReviewers(ctx context.Context) error {
return err
}
for _, review := range reviews {
if review.Type != ReviewTypeRequest {
Copy link
Member Author

Choose a reason for hiding this comment

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

bug

@@ -159,6 +159,11 @@ func (r *Review) LoadReviewer(ctx context.Context) (err error) {
return err
}
r.Reviewer, err = user_model.GetPossibleUserByID(ctx, r.ReviewerID)
if user_model.IsErrUserNotExist(err) {
Copy link
Member Author

Choose a reason for hiding this comment

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

bug

@@ -33,6 +33,9 @@ func (reviews ReviewList) LoadReviewers(ctx context.Context) error {
}
for _, review := range reviews {
review.Reviewer = userMap[review.ReviewerID]
if review.Reviewer == nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

bug

@a1012112796
Copy link
Member Author

And there is a security problem: if by default "git hook" is enabled , and the passwords are well-known ones, attackers could hack into a Gitea developer's computer.

oh, sorry I fogot the git hook, I will make it be disabled always.

@a1012112796
Copy link
Member Author

a1012112796 commented Sep 9, 2023

And there is a security problem: if by default "git hook" is enabled , and the passwords are well-known ones, attackers could hack into a Gitea developer's computer.

luckly looks git hook has been disabled by default, So I think it's safe. and maybe I can add a logic to update all password to a random value before the dev server start and reset it to the test data when the server stop.

Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
This reverts commit 884bb85.
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: a1012112796 <1012112796@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/docs This PR mainly updates/creates documentation type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants