go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/logdog/client/butlerlib/streamclient/protocol_netpipe_test.go (about)

     1  // Copyright 2019 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  //go:build windows
    16  // +build windows
    17  
    18  package streamclient
    19  
    20  import (
    21  	"fmt"
    22  	"net"
    23  	"os"
    24  	"testing"
    25  
    26  	"github.com/Microsoft/go-winio"
    27  
    28  	"go.chromium.org/luci/logdog/client/butlerlib/streamproto"
    29  
    30  	. "github.com/smartystreets/goconvey/convey"
    31  )
    32  
    33  func TestNamedPipe(t *testing.T) {
    34  	// TODO(crbug.com/998936): fix this test.
    35  	t.Skip()
    36  
    37  	t.Parallel()
    38  
    39  	counter := 0
    40  
    41  	Convey(`test windows NamedPipe`, t, func() {
    42  		defer timebomb()()
    43  
    44  		ctx, cancel := mkTestCtx()
    45  		defer cancel()
    46  
    47  		name := fmt.Sprintf(`streamclient.test.%d.%d`, os.Getpid(), counter)
    48  		counter++
    49  
    50  		dataChan := acceptOne(func() (net.Listener, error) {
    51  			return winio.ListenPipe(streamproto.LocalNamedPipePath(name), nil)
    52  		})
    53  		client, err := New("net.pipe:"+name, "")
    54  		So(err, ShouldBeNil)
    55  
    56  		runWireProtocolTest(ctx, dataChan, client, true)
    57  	})
    58  }