diff options
author | Zeling Feng <zeling@google.com> | 2021-03-05 11:53:18 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-05 11:56:31 -0800 |
commit | 2f0b82a8028019d4c996cf64341f84bb1d1c65b7 (patch) | |
tree | d69937f5cbd2296803d140cf6ad6a1c57fdd269a /test/packetimpact/testbench/dut.go | |
parent | 3e8e2cad881978674737ee3f9ac58b780d172187 (diff) |
Gather uname information from DUT
Some OSs behave slightly differently, but still within the RFC. It can be useful
to have access to uname information from the testbench.
PiperOrigin-RevId: 361193766
Diffstat (limited to 'test/packetimpact/testbench/dut.go')
-rw-r--r-- | test/packetimpact/testbench/dut.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/packetimpact/testbench/dut.go b/test/packetimpact/testbench/dut.go index be5121d98..aeae5e5d3 100644 --- a/test/packetimpact/testbench/dut.go +++ b/test/packetimpact/testbench/dut.go @@ -35,24 +35,26 @@ type DUT struct { conn *grpc.ClientConn posixServer POSIXClient Net *DUTTestNet + Uname *DUTUname } // NewDUT creates a new connection with the DUT over gRPC. func NewDUT(t *testing.T) DUT { t.Helper() - n := GetDUTTestNet() - dut := n.ConnectToDUT(t) + info := getDUTInfo() + dut := info.ConnectToDUT(t) t.Cleanup(func() { dut.TearDownConnection() - dut.Net.Release() + info.release() }) return dut } // ConnectToDUT connects to DUT through gRPC. -func (n *DUTTestNet) ConnectToDUT(t *testing.T) DUT { +func (info *DUTInfo) ConnectToDUT(t *testing.T) DUT { t.Helper() + n := info.Net posixServerAddress := net.JoinHostPort(n.POSIXServerIP.String(), fmt.Sprintf("%d", n.POSIXServerPort)) conn, err := grpc.Dial(posixServerAddress, grpc.WithInsecure(), grpc.WithKeepaliveParams(keepalive.ClientParameters{Timeout: RPCKeepalive})) if err != nil { @@ -63,6 +65,7 @@ func (n *DUTTestNet) ConnectToDUT(t *testing.T) DUT { conn: conn, posixServer: posixServer, Net: n, + Uname: info.Uname, } } |