Skip to content

Commit a2e8b96

Browse files
debug: minor changes in code
code Signed-off-by: Jyoti-Prakash-Muddanna <[email protected]>
1 parent 92bb138 commit a2e8b96

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/cloud-api-adaptor/test/e2e/common_suite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func DoTestCreatePeerPodWithAuthenticatedImageWithoutCredentials(t *testing.T, e
287287
if isTestOnCrio() {
288288
expectedErrorString = "access to the requested resource is not authorized"
289289
}
290-
NewTestCase(t, e, "InvalidAuthImagePeerPod", assert, "Peer pod with Authenticated Image without Credentials has been created").WithPod(pod).WithExpectedPodEventError(expectedErrorString).WithCustomPodState(v1.PodPending).WithExpectedPodvmConsoleLog("error").Run()
290+
NewTestCase(t, e, "InvalidAuthImagePeerPod", assert, "Peer pod with Authenticated Image without Credentials has been created").WithPod(pod).WithExpectedPodEventError(expectedErrorString).WithCustomPodState(v1.PodPending).Run()
291291
}
292292

293293
func DoTestPodVMwithNoAnnotations(t *testing.T, e env.Environment, assert CloudAssert, expectedType string) {

src/cloud-api-adaptor/test/e2e/libvirt_common.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,27 +122,38 @@ func (l LibvirtAssert) VerifyPodvmConsole(t *testing.T, podvmName, expectedStrin
122122
}
123123

124124
stream, err := l.conn.NewStream(0)
125-
if err != nil {
126-
t.Errorf("Failed to create stream : %v", err)
125+
for err != nil {
126+
t.Logf("Warning: Failed to create stream : %v", err)
127127
}
128128

129129
defer stream.Free()
130130

131131
err = dom.OpenConsole("", stream, libvirt.DOMAIN_CONSOLE_FORCE)
132+
start := time.Now()
133+
duration := 1 * time.Minute
134+
for err != nil && time.Since(start) < duration {
135+
t.Logf("Warning: Failed to open console : %v", err)
136+
err = dom.OpenConsole("", stream, libvirt.DOMAIN_CONSOLE_FORCE)
137+
time.Sleep(2 * time.Second)
138+
}
139+
132140
if err != nil {
133-
t.Errorf("Failed to open console : %v", err)
141+
t.Logf("Warning: Failed to open console after retries : %v", err)
142+
return
134143
}
135144

136145
buf := make([]byte, 4096)
137146
var output strings.Builder
138147
var LibvirtLog = ""
139148

140-
start := time.Now()
141-
duration := 3 * time.Minute
149+
start = time.Now()
150+
duration = 6 * time.Minute
151+
maxBytes := 0
142152

143153
for time.Since(start) < duration {
144154
n, err := stream.Recv(buf)
145-
if n > 0 {
155+
if maxBytes < n {
156+
maxBytes = n
146157
output.Write(buf[:n])
147158
if len(output.String()) > len(LibvirtLog) {
148159
LibvirtLog = output.String()
@@ -154,11 +165,10 @@ func (l LibvirtAssert) VerifyPodvmConsole(t *testing.T, podvmName, expectedStrin
154165
}
155166
if err != nil && LibvirtLog != "" {
156167
t.Logf("Warning: Did not find expected String :%s in \n console :%s", expectedString, LibvirtLog)
157-
return
158168
} else if err != nil {
159169
t.Logf("Warning: Did not receive any data from console yet, err: %v", err)
160170
}
161-
time.Sleep(6 * time.Second)
171+
time.Sleep(1 * time.Second)
162172
}
163173

164174
t.Logf("Warning: Timed out waiting for expected String :%s in \n console :%s", expectedString, LibvirtLog)

0 commit comments

Comments
 (0)