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

gitserver: Framework to support integration testing against gitserver #62801

Conversation

eseliger
Copy link
Member

This PR tinkers a bit with building a test helper to run integration tests that are still ~lightweight against a real gitserver.
The caller can either clone a real repo to disk / embed it in the git repo, or can create a small repo on the fly, and then get a running gitserver gRPC server that returns all the data required.

These tests should only exist outside of cmd/ and internal/, as there is a big potential to do cross-cmd imports from here, which can cause bad coupling. But for just these tests, that should be fine.

The most trivial rockskip indexing job that I put in here to POC this runs in 6.3s, including all setup and teardown. That seems very reasonable to me.

Test plan:

The POC test passes.

// universal-ctags installed with brew is called ctags, this probably needs work
// in CI.
ctagsConfig.UniversalCommand = "ctags"
svc, err := rockskip.NewService(
Copy link
Member Author

Choose a reason for hiding this comment

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

I used the internal code for this, but it would be nice if the integration test could also spawn a symbols server like we do for gitserver here, and solely test via the external facing APIs.

@eseliger eseliger force-pushed the es/05-20-gitserverexperimentwithintegrationtestingagainstgitserver branch from 69bb081 to 99dfa7d Compare May 20, 2024 22:23
@eseliger eseliger force-pushed the es/05-17-gitserverdeprecateexecandremovelocalgit branch from 7f51c08 to 858cb3d Compare May 21, 2024 15:15
@eseliger eseliger force-pushed the es/05-20-gitserverexperimentwithintegrationtestingagainstgitserver branch from 99dfa7d to c58423b Compare May 21, 2024 15:15
@eseliger eseliger force-pushed the es/05-17-gitserverdeprecateexecandremovelocalgit branch from 858cb3d to 44b9087 Compare May 21, 2024 16:06
Base automatically changed from es/05-17-gitserverdeprecateexecandremovelocalgit to main May 21, 2024 16:19
@eseliger eseliger force-pushed the es/05-20-gitserverexperimentwithintegrationtestingagainstgitserver branch from c58423b to ce3329a Compare May 21, 2024 17:36
@eseliger eseliger force-pushed the es/05-20-gitserverexperimentwithintegrationtestingagainstgitserver branch from ce3329a to fe0553d Compare June 4, 2024 08:35
This PR tinkers a bit with building a test helper to run integration tests that are still ~lightweight against a real gitserver.
The caller can either clone a real repo to disk / embed it in the git repo, or can create a small repo on the fly, and then get a running gitserver gRPC server that returns all the data required.

These tests should only exist outside of cmd/ and internal/, as there is a big potential to do cross-cmd imports from here, which can cause bad coupling. But for just these tests, that should be fine.

The most trivial rockskip indexing job that I put in here to POC this runs in 6.3s, including all setup and teardown. That seems very reasonable to me.

Test plan:

The POC test passes.
@eseliger eseliger force-pushed the es/05-20-gitserverexperimentwithintegrationtestingagainstgitserver branch from fe0553d to 6b84f32 Compare June 4, 2024 10:13
@eseliger eseliger changed the title gitserver: Experiment with integration testing against gitserver gitserver: Framework to support integration testing against gitserver Jun 4, 2024
@eseliger eseliger marked this pull request as ready for review June 7, 2024 08:39
@eseliger eseliger requested review from a team and Strum355 June 7, 2024 08:40
Copy link
Member

@keegancsmith keegancsmith left a comment

Choose a reason for hiding this comment

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

Rad!

❯ go test -count=1 ./dev/rockskipintegration/ 
ok  	github.com/sourcegraph/sourcegraph/dev/rockskipintegration	0.865s

My desktop linux machine likely has a much better FS without our soc2 monitoring :P

@Strum355
Copy link
Member

Strum355 commented Jun 7, 2024

Rad!

❯ go test -count=1 ./dev/rockskipintegration/ 
ok  	github.com/sourcegraph/sourcegraph/dev/rockskipintegration	0.865s

My desktop linux machine likely has a much better FS without our soc2 monitoring :P

0.8s vs 6s....thanks jamf...

@eseliger
Copy link
Member Author

eseliger commented Jun 7, 2024

ok      github.com/sourcegraph/sourcegraph/dev/rockskipintegration      5.029s

still quite good for an integration test, but man 😢

@eseliger eseliger merged commit 1287243 into main Jun 7, 2024
20 checks passed
@eseliger eseliger deleted the es/05-20-gitserverexperimentwithintegrationtestingagainstgitserver branch June 7, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants