test(e2e): give the test connector transport to the first application only

An application a spec starts on its own, such as the isolated ones of
the router specs, took the shared test transport over and pointed its
file transfers at a table with no blob store. Which specs ran before
decided if the file specs of Telegram and Slack passed, and they failed
in CI with "addon owner unavailable". The transport now keeps the table
of the first application.

Assisted-by: Claude:claude-sonnet-5-5 go ginkgo
This commit is contained in:
Ettore Di Giacinto committed 2026-11-03 21:42:50 +00:00
1 parent c4f4ac8af8
commit bb23939477
1 file changed
+13 -4
+13 -4
View File
@@ -20,14 +20,19 @@ import (
// UseConnectorTransportForTests.
var connectorTransportForTests studio.ConnectorTransport
// connectorTransportWired is true once an application gave its transfer table
// to the test transport. A later application of the same process, such as an
// isolated one a spec starts, must not take the transport over.
var connectorTransportWired bool
// UseConnectorTransportForTests makes the connectors of applications built after
// the call talk through t instead of the add-on manager, and returns a function
// that restores the real one. It exists so an end-to-end test can serve a
// connector without an installed add-on.
func UseConnectorTransportForTests(t studio.ConnectorTransport) (restore func()) {
prev := connectorTransportForTests
connectorTransportForTests = t
return func() { connectorTransportForTests = prev }
connectorTransportForTests, connectorTransportWired = t, false
return func() { connectorTransportForTests, connectorTransportWired = prev, false }
}
// connectorTransport reaches the connector add-ons through the add-on manager.
@@ -109,10 +114,14 @@ func (a *Application) startStudioConnectors(svc *studio.Service) {
if connectorTransportForTests != nil {
tr = connectorTransportForTests
// A test transport that can move files by handle gets the table of
// this application, so its add-ons declare the files ability.
// the first application that uses it, so its add-ons declare the
// files ability. Taking it again would point the transport at a table
// with no blob store, and the files of the first application would
// stop moving.
if x, ok := tr.(interface {
EnableTransfers(*hostops.Transfers) func()
}); ok {
}); ok && !connectorTransportWired {
connectorTransportWired = true
// The servers it starts live as long as the test process.
_ = x.EnableTransfers(a.transfers())
}