| 304 | } |
| 305 | |
| 306 | func (c *testContext) RequestShell() { |
| 307 | t := c.T |
| 308 | t.Helper() |
| 309 | c.lock.Lock() |
| 310 | defer c.lock.Unlock() |
| 311 | if c.channel == nil { |
| 312 | t.Fatalf("No channel opened.") |
| 313 | } |
| 314 | t.Logf("Starting shell...") |
| 315 | |
| 316 | success, err := c.channel.SendRequest( |
| 317 | string(internalssh.RequestTypeShell), |
| 318 | true, |
| 319 | nil, |
| 320 | ) |
| 321 | if err != nil { |
| 322 | t.Fatalf("Failed to send exec request. (%v)", err) |
| 323 | } |
| 324 | if !success { |
| 325 | t.Fatalf("Server rejected exec request. (%v)", err) |
| 326 | } |
| 327 | t.Logf("Started shell.") |
| 328 | } |
| 329 | |
| 330 | func (c *testContext) AssertStdoutHas(output string) { |
| 331 | t := c.T |