mirror of
https://github.com/containers/gvisor-tap-vsock.git
synced 2025-10-07 09:40:56 +08:00
win-sshproxy.tid created before thread id is available
this commit fixes a potential race condition that prevented the tests to succeed when running in a github workflow. Basically the thread id was not actually available before writing it on the file, resulting in a thread id equals to 0 written in it. So, when the tests were trying to retrieve the thread id to use it to send the WM_QUIT signal, they failed. This patch adds a check on the thread id before writing it on the file. Now, if the thread id is 0, it keeps calling winquit to retrieve it. If, after 10 secs, there is no success it returns an error. Signed-off-by: lstocchi <lstocchi@redhat.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package e2e
|
||||
@@ -25,15 +26,16 @@ var _ = Describe("connectivity", func() {
|
||||
err := startProxy()
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
|
||||
var pid uint32
|
||||
var pid, tid uint32
|
||||
for i := 0; i < 20; i++ {
|
||||
pid, _, err = readTid()
|
||||
if err == nil {
|
||||
pid, tid, err = readTid()
|
||||
if err == nil && tid != 0 {
|
||||
break
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
Expect(tid).ShouldNot(Equal(0))
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
proc, err := os.FindProcess(int(pid))
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
|
Reference in New Issue
Block a user