Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/operator: add nil check for infra.Status.PlatformStatus before sw…
…itch stmt If infra.Status.PlatformStatus is empty it will throw a panic as it is a pointer. Some baremetal platforms have an empty Platform status which must be accounted for. Also add basic isCloudConfigRequired unit test Closes: BZ 1858026
- Loading branch information
1 parent
f341a7f
commit 804796a
Showing
2 changed files
with
26 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package operator | ||
|
||
import ( | ||
configv1 "github.com/openshift/api/config/v1" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestIsCloudConfigRequired(t *testing.T) { | ||
testInfra := configv1.Infrastructure{} | ||
testInfra.Status.Platform = "None" | ||
required := isCloudConfigRequired(&testInfra) | ||
assert.False(t, required) | ||
} |