| 105 | } |
| 106 | |
| 107 | func 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 | |
| 142 | func testShellWithCommand(connName string, cmd string, timeout time.Duration) error { |
| 143 | opts, err := remote.ParseOpts(connName) |