Commit Graph

4 Commits

Author SHA1 Message Date
Noah S-C
4e31a4e38d
feat/bazel: //cmd/{frontend,server} targets that don't include client bundle for backend integration tests (#62877)
Currently, all backend integration tests transitively depend on the client bundle. This results in rebuilds of the closure, and a (likely) cache miss on the test, when modifying any client-side files. 
Given that the client bundle isnt needed for these tests, we can create targets that don't include the client bundle in its transitive closure, which should in theory improve the cache hit for backend integration tests by not having client side changes invalidate it. This would also be beneficial in local env, to keep frontend rebuilds down

To do this, we still need to create a `web.manifest.json` file due to some unfortunate requirement on that file existing as part of initializing the sourcegraph instance. For this I just create an empty json file, `select` this instead of the client bundle target in client/web/dist/BUILD.bazel based on a `//:integration_testing_enabled` config setting, and creating a `go_binary`-wrapping bazel rule + macro that automatically applies a transition to set this to true `go_binary_nobundle`, and using that rule for the specific `//cmd/{server,frontend}:{server,frontend}_nobundle` binary rules (along with the relevant `oci_{image,tarball}` etc rules to consume it).



## Test plan

- Integration tests in CI still work
- `bazel cquery 'kind("js_library", deps(//cmd/frontend:image_nobundle))'`, `bazel cquery 'kind("js_library", deps(//cmd/server:image_nobundle))'`, ``bazel cquery 'kind("js_library", deps(//testing:backend_integration_test))'` etc  all return empty set
- Release test with marker in web bundle to ensure released images contain the web bundle via `sg release run test --version 5.4.2` (commenting out other tests for brevity)
2024-05-28 14:32:48 +01:00
Erik Seliger
9f9bf43927
Merge enterprise and non-enterprise server images (#56446)
There's only one version now, so we can merge these two. Another one on the road to getting rid of the enterprise/non-enterprise distinction entirely!
2023-09-11 14:39:27 +02:00
Jean-Hadrien Chabran
54005e461f
Allow to run e2e tests locally (#55998)
Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>
Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-08-29 11:08:47 -05:00
Jean-Hadrien Chabran
7fdf85a653
bzl+doc: improve and document how to write a server integration test (#53673)
We recently refactored how to run server integration tests with Bazel,
so they are standalone tasks requiring no prior setup to run them.

This PR takes this further, by providing a macro named
`server_integration_test` to be used in `testing/BUILD.bazel` to
centralize all test runners/wrapper to run those tests who are targeting
the server image.

It also adds a how-to describing how they work at high level as well as
step-by-step guide to help teammates to start writing or maintaining the
existing scripts.

@peterguy I'm tagging you here, as per this
[message](https://sourcegraph.slack.com/archives/C04MYFW01NV/p1686850329953539?thread_ts=1686661082.758009&cid=C04MYFW01NV)
where it looked you needed to do exactly this. This makes it sound
you're the perfect reviewer for this bit of documentation.

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

CI + local preview for the docs.

---------

Co-authored-by: Dave Try <davetry@gmail.com>
2023-06-19 17:44:01 +00:00