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

Function TestConnDiagnostics

cli/cliui/agent_test.go:822–1013  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

820}
821
822func TestConnDiagnostics(t *testing.T) {
823 t.Parallel()
824 testCases := []struct {
825 name string
826 diags cliui.ConnDiags
827 want []string
828 }{
829 {
830 name: "DirectBlocked",
831 diags: cliui.ConnDiags{
832 ConnInfo: workspacesdk.AgentConnectionInfo{
833 DERPMap: &tailcfg.DERPMap{},
834 DisableDirectConnections: true,
835 },
836 },
837 want: []string{
838 `❗ Your Coder administrator has blocked direct connections`,
839 },
840 },
841 {
842 name: "NoStun",
843 diags: cliui.ConnDiags{
844 ConnInfo: workspacesdk.AgentConnectionInfo{
845 DERPMap: &tailcfg.DERPMap{},
846 },
847 LocalNetInfo: &tailcfg.NetInfo{},
848 },
849 want: []string{
850 `The DERP map is not configured to use STUN`,
851 },
852 },
853 {
854 name: "ClientHasStunNoUDP",
855 diags: cliui.ConnDiags{
856 ConnInfo: workspacesdk.AgentConnectionInfo{
857 DERPMap: &tailcfg.DERPMap{
858 Regions: map[int]*tailcfg.DERPRegion{
859 999: {
860 Nodes: []*tailcfg.DERPNode{
861 {
862 STUNPort: 1337,
863 },
864 },
865 },
866 },
867 },
868 },
869 LocalNetInfo: &tailcfg.NetInfo{
870 UDP: false,
871 },
872 },
873 want: []string{
874 `Client could not connect to STUN over UDP`,
875 },
876 },
877 {
878 name: "AgentHasStunNoUDP",
879 diags: cliui.ConnDiags{

Callers

nothing calls this directly

Calls 6

MessagefFunction · 0.92
RunMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
ReadAllMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected