Skip to content

Commit 1faf2aa

Browse files
committed
Introduce GetFullyQualifiedHomeserverName(...)
1 parent 6b63eff commit 1faf2aa

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

internal/docker/deployment.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ func (hsDep *HomeserverDeployment) SetEndpoints(baseURL string, fedBaseURL strin
5757
}
5858
}
5959

60+
func (d *Deployment) GetFullyQualifiedHomeserverName(hsName string) (string, error) {
61+
_, ok := d.HS[hsName]
62+
if !ok {
63+
return "", fmt.Errorf("Deployment.GetFullyQualifiedHomeserverName - HS name '%s' not found", hsName)
64+
}
65+
// We have network aliases for each Docker container that will resolve the `hsName` to
66+
// the container.
67+
return hsName, nil
68+
}
69+
6070
// DestroyAtCleanup destroys the entire deployment. It should be called at cleanup time for dirty
6171
// deployments only. Handles configuration options for things which should run at container destroy
6272
// time, like post-run scripts and printing logs.

test_package.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ import (
2020

2121
// Deployment provides a way for tests to interact with a set of homeservers.
2222
type Deployment interface {
23+
// Returns the resolvable host name of a homeserver given its short alias (e.g.,
24+
// "hs1", "hs2").
25+
//
26+
// In the case of the standard Docker deployment, this will be the same `hs1`, `hs2`
27+
// but may be different for other custom deployments.
28+
GetFullyQualifiedHomeserverName(hsName string) (string, error)
2329
// UnauthenticatedClient returns a blank CSAPI client.
2430
UnauthenticatedClient(t ct.TestLike, serverName string) *client.CSAPI
2531
// Register a new user on the given server.

0 commit comments

Comments
 (0)