github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/sdnotify/sdnotify_unix_test.go (about) 1 // Copyright 2016 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 // +build !windows 12 13 package sdnotify 14 15 import ( 16 "testing" 17 18 _ "github.com/cockroachdb/cockroach/pkg/util/log" // for flags 19 ) 20 21 func TestSDNotify(t *testing.T) { 22 l, err := listen() 23 if err != nil { 24 t.Fatal(err) 25 } 26 defer func() { _ = l.close() }() 27 28 ch := make(chan error) 29 go func() { 30 ch <- l.wait() 31 }() 32 33 if err := notify(l.Path, readyMsg); err != nil { 34 t.Fatal(err) 35 } 36 if err := <-ch; err != nil { 37 t.Fatal(err) 38 } 39 }