-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows integration tests: plumbing work to be able to run on windows
Co-authored-by: Gabriel Samfira <[email protected]> This PR does most of the plumbing work requred for us to start running integration tests on Windows. We will need this to land before we can do the follow-up PRs to handle the specific tests. Signed-off-by: Anthony Nandaa <[email protected]>
- Loading branch information
1 parent
d5817ce
commit 95b60bf
Showing
17 changed files
with
390 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package integration | ||
|
||
import ( | ||
"net" | ||
"os/exec" | ||
"strings" | ||
"time" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
func waitSocket(address string, d time.Duration, cmd *exec.Cmd) error { | ||
address = strings.TrimPrefix(address, "unix://") | ||
addr, err := net.ResolveUnixAddr("unix", address) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed resolving unix addr: %s", address) | ||
} | ||
|
||
step := 50 * time.Millisecond | ||
i := 0 | ||
for { | ||
if cmd != nil && cmd.ProcessState != nil { | ||
return errors.Errorf("process exited: %s", cmd.String()) | ||
} | ||
|
||
if conn, err := net.DialUnix("unix", nil, addr); err == nil { | ||
conn.Close() | ||
break | ||
} | ||
i++ | ||
if time.Duration(i)*step > d { | ||
return errors.Errorf("failed dialing: %s", address) | ||
} | ||
time.Sleep(step) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package integration | ||
|
||
import ( | ||
"os/exec" | ||
"strings" | ||
"time" | ||
|
||
"github.com/Microsoft/go-winio" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func waitSocket(address string, d time.Duration, cmd *exec.Cmd) error { | ||
address = strings.TrimPrefix(address, "npipe://") | ||
step := 50 * time.Millisecond | ||
i := 0 | ||
|
||
for { | ||
if cmd != nil && cmd.ProcessState != nil { | ||
return errors.Errorf("process exited: %s", cmd.String()) | ||
} | ||
|
||
if conn, err := winio.DialPipe(address, nil); err == nil { | ||
conn.Close() | ||
break | ||
} | ||
i++ | ||
if time.Duration(i)*step > d { | ||
return errors.Errorf("failed dialing: %s", address) | ||
} | ||
time.Sleep(step) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.