-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 integration test for repository migration #1983
Add integration test for repository migration #1983
Conversation
integrations/repo_migrate_test.go
Outdated
func TestRepoMigrate(t *testing.B) { | ||
prepareTestEnv(t) | ||
session := loginUser(t, "user2", "password") | ||
testRepoMigrate(t, session, "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could maybe test with a smaller repo (like gitea ^^) and benchmark with biggest one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For benchmark you could use https://github.com/go-gitea/git/blob/master/tree_entry_test.go as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sapk I was trying to follow the example, but I can't figure out how to make the integration framework fit into a benchmark function. The APIs of integration_test requires a testing.T but a benchmark function provides only test.B.
f4129a2
to
ed0c698
Compare
As a heads up, if #1979 gets merged before this, be sure to rebase. |
#1979 is merged so this needs to be updated with changed methods (login/csrf/request) |
ed0c698
to
1d10f0a
Compare
@lafriks Done. The benchmark is not implemented for now as I have not idea how to apply the integration APIs in a benchmark function. |
integrations/repo_migrate_test.go
Outdated
repoName := repoDirname[0 : len(repoDirname)-len(path.Ext(repoDirname))] | ||
|
||
req = NewRequestWithValues(t, "POST", link, map[string]string{ | ||
"_csrf": htmlDoc.GetInputValueByName("_csrf"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed to htmlDoc.GetCsrf()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
1d10f0a
to
936d1fc
Compare
@typeless we should convert to the common interface https://golang.org/pkg/testing/#TB for allowing benchmark. I will try to setup something. |
936d1fc
to
0c512df
Compare
Benchmarks have been added thanks to #1993 . |
integrations/repo_migrate_test.go
Outdated
session := loginUser(b, "user2") | ||
|
||
for _, s := range samples { | ||
b.StopTimer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the first line or at least before prepareTestEnv(b)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For details : b.StopTimer() permit to ingore setup time. So in this case the only setup part is L58-59. Even b.StartTimer() don't need to be in the loop for this case since we only setup once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
A little change to make. The rest LGTM. |
0c512df
to
ef35974
Compare
Need to rebase as some functions were renamed |
ef35974
to
b0f2270
Compare
@lafriks Done. |
Can you add task for running benchmark to Makefile? |
b0f2270
to
83cceaa
Compare
@lafriks Done. |
Have not tested but LGTM |
A build flag 'extra' for guarding the test since it would take long time and consume too much bandwidth. It can be used as a building block for other tests.P.S. It's changed per the suggestions by the reviewers.