File: integration_linux_lt_1.12_test.go

package info (click to toggle)
golang-github-mdlayher-vsock 0.0~git20210303.10d5918-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 204 kB
  • sloc: makefile: 3
file content (42 lines) | stat: -rw-r--r-- 749 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//+build !go1.12,linux

package vsock_test

import (
	"testing"
	"time"

	"github.com/mdlayher/vsock"
	"github.com/mdlayher/vsock/internal/vsutil"
)

func TestIntegrationListenerSetDeadlineError(t *testing.T) {
	l, done := newListener(t)
	defer done()

	err := l.SetDeadline(time.Time{})
	if err == nil {
		t.Fatal("expected an error, but none occurred")
	}

	t.Logf("OK error: %v", err)
}

func TestIntegrationConnSyscallConnError(t *testing.T) {
	vsutil.SkipHostIntegration(t)

	mp := makeVSockPipe()

	c, _, stop, err := mp()
	if err != nil {
		t.Fatalf("failed to make pipe: %v", err)
	}
	defer stop()

	_, err = c.(*vsock.Conn).SyscallConn()
	if err == nil {
		t.Fatal("expected an error, but none occurred")
	}

	t.Logf("OK error: %v", err)
}