github.com/Cloud-Foundations/Dominator@v0.3.4/lib/srpc/localTransport_test.go (about)

     1  package srpc
     2  
     3  import (
     4  	"runtime"
     5  	"testing"
     6  )
     7  
     8  func TestUnixUpgrade(t *testing.T) {
     9  	if runtime.GOOS != "linux" {
    10  		return
    11  	}
    12  	oldAttemptTransportUpgrade := attemptTransportUpgrade
    13  	attemptTransportUpgrade = true
    14  	client, err := makeListenerAndConnect(true, false)
    15  	if err != nil {
    16  		t.Fatal(err)
    17  	}
    18  	if network := client.conn.RemoteAddr().Network(); network != "unix" {
    19  		t.Fatalf("Expected unix connection, have: %s", network)
    20  	}
    21  	if err := testDoCallPlain(t, client, "Unix/plain"); err != nil {
    22  		t.Fatal(err)
    23  	}
    24  	if err := client.Close(); err != nil {
    25  		t.Fatal(err)
    26  	}
    27  	attemptTransportUpgrade = oldAttemptTransportUpgrade
    28  }