Bug 2010168

Summary: Flaky test point to a nil pointer conditions list
Product: Red Hat Advanced Cluster Management for Kubernetes Reporter: Fred Rolland <frolland>
Component: Infrastructure OperatorAssignee: Michael Filanov <mfilanov>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact: Christopher Dawson <cdawson>
Priority: unspecified    
Version: rhacm-2.4CC: ccrum, trwest, yfirst
Target Milestone: ---Keywords: Triaged
Target Release: rhacm-2.5Flags: ming: rhacm-2.4+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: AI-Team-Core
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-10-03 20:18:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2010175    

Description Fred Rolland 2021-10-04 05:31:29 UTC
BMAC controller search for a condition but do not check if the result is nil.

This could cause a panic.
It happened on subsystem test, where a similar code is used.

https://github.com/openshift/assisted-service/blob/f2d1db6f3a410a995def24d45842e00110c5311d/subsystem/kubeapi_test.go#L383
https://github.com/openshift/assisted-service/blob/f2d1db6f3a410a995def24d45842e00[…]0c5311d/internal/controller/controllers/bmh_agent_controller.go

Comment 1 Michael Filanov 2021-10-04 06:05:25 UTC
Looking at the code again i saw that bnh check if conditions are nil https://github.com/openshift/assisted-service/blob/badfb5d77b0642688c06743cb5e304e6a29c62be/internal/controller/controllers/bmh_agent_controller.go#L365-L367 
Fixing the test

Comment 2 Michael Filanov 2021-10-04 06:30:36 UTC
in another look if we have a bug in the condition bmh controller will panic, fixed that.