mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 14:12:33 +00:00
Run Ginkgo on the target and drive a separate Open-iSCSI initiator over SSH. Keep host locks, bounded command logs and failure latches on both sides. Load checkout modules, own the foreground target daemon, and remove sessions and node records before tearing down target resources. Add discovery, login/logout, repeated login, portal filtering and CHAP scenarios. Offer each CHAP algorithm separately and verify recovery after an authentication rejection. Use dummy LUNs and per-run initiator IQNs without changing the initiator's global configuration. Register the iSCSI group with the shared runner and validate every selected host before starting the first suite. Finish local teardown before starting iSCSI tests and stop after any suite failure. Extend the configuration examples and guide with initiator setup and cleanup limits.
44 lines
872 B
Go
44 lines
872 B
Go
// SPDX-License-Identifier: GPL-2.0-only
|
|
package testhost
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestForegroundProcess(t *testing.T) {
|
|
p, err := StartProcess(io.Discard, "sleep", "30")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer p.cmd.Process.Kill()
|
|
if err := p.Running(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
|
defer cancel()
|
|
if err := p.Stop(ctx); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if p.Running() == nil {
|
|
t.Fatal("stopped daemon appears running")
|
|
}
|
|
}
|
|
|
|
func TestEarlyDaemonExit(t *testing.T) {
|
|
p, err := StartProcess(io.Discard, "false")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
select {
|
|
case <-p.done:
|
|
case <-time.After(time.Second):
|
|
t.Fatal("child did not exit")
|
|
}
|
|
if p.Running() == nil || p.Stop(context.Background()) == nil {
|
|
t.Fatal("early exit accepted as normal teardown")
|
|
}
|
|
}
|