| Index: logdog/client/butler/streamserver/namedPipe_windows_test.go
|
| diff --git a/logdog/client/butler/streamserver/namedPipe_windows_test.go b/logdog/client/butler/streamserver/namedPipe_windows_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f056ffba1504b6f230334f0384f0bce70ef2ceea
|
| --- /dev/null
|
| +++ b/logdog/client/butler/streamserver/namedPipe_windows_test.go
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2017 The LUCI Authors. All rights reserved.
|
| +// Use of this source code is governed under the Apache License, Version 2.0
|
| +// that can be found in the LICENSE file.
|
| +
|
| +package streamserver
|
| +
|
| +import (
|
| + "fmt"
|
| + "os"
|
| + "strings"
|
| + "testing"
|
| +
|
| + "github.com/luci/luci-go/logdog/client/butlerlib/streamclient"
|
| +
|
| + "golang.org/x/net/context"
|
| +
|
| + . "github.com/luci/luci-go/common/testing/assertions"
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestWindowsNamedPipeServer(t *testing.T) {
|
| + t.Parallel()
|
| +
|
| + pid := os.Getpid()
|
| +
|
| + Convey(`A named pipe server`, t, func() {
|
| + ctx := context.Background()
|
| +
|
| + Convey(`Will refuse to create if there is an empty path.`, func() {
|
| + _, err := NewNamedPipeServer(ctx, "")
|
| + So(err, ShouldErrLike, "cannot have empty name")
|
| + })
|
| +
|
| + Convey(`Will refuse to create if longer than maximum length.`, func() {
|
| + _, err := NewNamedPipeServer(ctx, strings.Repeat("A", maxWindowsNamedPipeLength+1))
|
| + So(err, ShouldErrLike, "name exceeds maximum length")
|
| + })
|
| +
|
| + Convey(`When created and listening.`, func() {
|
| + svr, err := NewNamedPipeServer(ctx, fmt.Sprintf("ButlerNamedPipeTest_%d", pid))
|
| + So(err, ShouldBeNil)
|
| +
|
| + So(svr.Listen(), ShouldBeNil)
|
| + defer svr.Close()
|
| +
|
| + client, err := streamclient.New(svr.Address())
|
| + So(err, ShouldBeNil)
|
| +
|
| + testClientServer(t, svr, client)
|
| + })
|
| + })
|
| +}
|
|
|