MCPcopy Index your code
hub / github.com/ContainerSSH/ContainerSSH / StartSessionChannel

Method StartSessionChannel

e2e_framework_test.go:253–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251}
252
253func (c *testContext) StartSessionChannel() {
254 t := c.T
255 t.Helper()
256 c.lock.Lock()
257 defer c.lock.Unlock()
258 if c.sshConn == nil {
259 t.Fatalf("SSH connection is not running.")
260 }
261 if c.channel != nil {
262 t.Fatalf("A channel is already open.")
263 }
264
265 t.Logf("Starting a new session channel...")
266
267 channel, requests, err := c.sshConn.OpenChannel("session", nil)
268 if err != nil {
269 t.Fatalf("Failed to open channel (%v)", err)
270 }
271 c.channel = channel
272 c.requests = requests
273 // We use c.T here so the cleanup happens in the parent test.
274 c.T.Cleanup(func() {
275 _ = channel.Close()
276 c.channel = nil
277 })
278
279 t.Logf("Started a new session channel.")
280}
281
282func (c *testContext) RequestCommandExecution(cmd string) {
283 t := c.T

Callers

nothing calls this directly

Calls 4

FatalfMethod · 0.80
CleanupMethod · 0.80
LogfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected