MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / testBasicConnect

Function testBasicConnect

cmd/test-conn/testutil.go:107–140  ·  view source on GitHub ↗
(connName string, timeout time.Duration)

Source from the content-addressed store, hash-verified

105}
106
107func testBasicConnect(connName string, timeout time.Duration) error {
108 opts, err := remote.ParseOpts(connName)
109 if err != nil {
110 return fmt.Errorf("failed to parse connection string: %w", err)
111 }
112
113 log.Printf("Connecting to %s...", opts.String())
114
115 conn := conncontroller.GetConn(opts)
116 ctx, cancel := context.WithTimeout(context.Background(), timeout)
117 defer cancel()
118
119 err = conn.Connect(ctx, &wconfig.ConnKeywords{})
120 if err != nil {
121 return fmt.Errorf("connection failed: %w", err)
122 }
123
124 status := conn.DeriveConnStatus()
125 log.Printf("✓ Connected!")
126 log.Printf(" Status: %s", status.Status)
127 log.Printf(" WshEnabled: %v", status.WshEnabled)
128 log.Printf(" Connection: %s", status.Connection)
129 if status.WshVersion != "" {
130 log.Printf(" WshVersion: %s", status.WshVersion)
131 }
132 if status.WshError != "" {
133 log.Printf(" WshError: %s", status.WshError)
134 }
135 if status.NoWshReason != "" {
136 log.Printf(" NoWshReason: %s", status.NoWshReason)
137 }
138
139 return nil
140}
141
142func testShellWithCommand(connName string, cmd string, timeout time.Duration) error {
143 opts, err := remote.ParseOpts(connName)

Callers 1

mainFunction · 0.85

Calls 5

ParseOptsFunction · 0.92
GetConnFunction · 0.92
StringMethod · 0.45
ConnectMethod · 0.45
DeriveConnStatusMethod · 0.45

Tested by

no test coverage detected