MCPcopy Index your code
hub / github.com/coder/coder / replicaIDForClientURL

Function replicaIDForClientURL

enterprise/coderd/exp_chats_test.go:911–938  ·  view source on GitHub ↗
(
	t *testing.T,
	clientURL *url.URL,
	replicas []codersdk.Replica,
)

Source from the content-addressed store, hash-verified

909}
910
911func replicaIDForClientURL(
912 t *testing.T,
913 clientURL *url.URL,
914 replicas []codersdk.Replica,
915) uuid.UUID {
916 t.Helper()
917
918 for _, replica := range replicas {
919 relayURL, err := url.Parse(replica.RelayAddress)
920 require.NoErrorf(
921 t,
922 err,
923 "parse replica relay address %q",
924 replica.RelayAddress,
925 )
926 if relayURL.Host == clientURL.Host {
927 return replica.ID
928 }
929 }
930
931 require.FailNowf(
932 t,
933 "missing replica for client URL",
934 "client host %q not present in replica list",
935 clientURL.Host,
936 )
937 return uuid.Nil
938}
939
940func TestChatModelConfigDefault(t *testing.T) {
941 t.Parallel()

Callers 1

TestChatStreamRelayFunction · 0.85

Calls 2

HelperMethod · 0.65
ParseMethod · 0.65

Tested by

no test coverage detected