@@ -70,6 +70,11 @@ func InitializeOpenShiftTestsExtensionFramework() (*extension.Registry, *extensi
7070 extensionRegistry := extension .NewRegistry ()
7171 extensionRegistry .Register (originExtension .Extension )
7272
73+ err := clusterdiscovery .InitCSITests ()
74+ if err != nil {
75+ return nil , nil , err
76+ }
77+
7378 // Build our specs from ginkgo
7479 specs , err := g .BuildExtensionTestSpecsFromOpenShiftGinkgoSuite ()
7580 if err != nil {
@@ -190,7 +195,22 @@ func (b *TestBinary) Info(ctx context.Context) (*Extension, error) {
190195 logrus .Errorf ("Command output for %s: %s" , binName , string (infoJson ))
191196 return nil , fmt .Errorf ("failed running '%s info': %w\n Output: %s" , b .binaryPath , err , infoJson )
192197 }
193- jsonBegins := bytes .IndexByte (infoJson , '{' )
198+ // Some binaries may output logging that includes JSON-like data, so we need to find the first line that starts with '{'
199+ jsonBegins := - 1
200+ lines := bytes .Split (infoJson , []byte ("\n " ))
201+ for i , line := range lines {
202+ trimmed := bytes .TrimSpace (line )
203+ if bytes .HasPrefix (trimmed , []byte ("{" )) {
204+ // Calculate the byte offset of this line in the original output
205+ jsonBegins = 0
206+ for j := 0 ; j < i ; j ++ {
207+ jsonBegins += len (lines [j ]) + 1 // +1 for the newline character
208+ }
209+ jsonBegins += len (line ) - len (trimmed ) // Add any leading whitespace
210+ break
211+ }
212+ }
213+
194214 jsonEnds := bytes .LastIndexByte (infoJson , '}' )
195215 if jsonBegins == - 1 || jsonEnds == - 1 || jsonBegins > jsonEnds {
196216 logrus .Errorf ("No valid JSON found in output from %s info command" , binName )
0 commit comments