@@ -240,6 +240,25 @@ func (h *harnessTest) syncUniverseState(target, syncer *tapdHarness,
240240 require .Equal (h .t , numExpectedAssets , numAssets )
241241}
242242
243+ // addFederationServer adds a new federation server to the given tapd harness.
244+ func (h * harnessTest ) addFederationServer (host string , target * tapdHarness ) {
245+ ctxt , cancel := context .WithTimeout (
246+ context .Background (), defaultWaitTimeout ,
247+ )
248+ defer cancel ()
249+
250+ _ , err := target .AddFederationServer (
251+ ctxt , & unirpc.AddFederationServerRequest {
252+ Servers : []* unirpc.UniverseFederationServer {
253+ {
254+ Host : host ,
255+ },
256+ },
257+ },
258+ )
259+ require .NoError (h .t , err )
260+ }
261+
243262// nextAvailablePort returns the first port that is available for listening by
244263// a new node. It panics if no port is found and the maximum available TCP port
245264// is reached.
@@ -346,6 +365,10 @@ type tapdHarnessParams struct {
346365 // startupSyncNumAssets is the number of assets that are expected to be
347366 // synced from the above node.
348367 startupSyncNumAssets int
368+
369+ // noDefaultUniverseSync indicates whether the default universe server
370+ // should be added as a federation server or not.
371+ noDefaultUniverseSync bool
349372}
350373
351374type Option func (* tapdHarnessParams )
@@ -391,6 +414,12 @@ func setupTapdHarness(t *testing.T, ht *harnessTest,
391414 err = tapdHarness .start (params .expectErrExit )
392415 require .NoError (t , err )
393416
417+ // Add the default universe server as a federation server, unless
418+ // specifically indicated by the caller.
419+ if ! params .noDefaultUniverseSync {
420+ ht .addFederationServer (universe .service .rpcHost (), tapdHarness )
421+ }
422+
394423 // Before we exit, we'll check to see if we need to sync the universe
395424 // state.
396425 if params .startupSyncNode != nil {
0 commit comments