Skip to content

Commit

Permalink
Merge pull request #4819 from Patryk-Stefanski/DiagnosticsUserManaged…
Browse files Browse the repository at this point in the history
…NilCheck

Check UserManaged is not nil in azure/converters/diagnostics
  • Loading branch information
k8s-ci-robot committed May 9, 2024
2 parents bccef17 + d8f1e9d commit 43e72a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 7 additions & 5 deletions azure/converters/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ func GetDiagnosticsProfile(diagnostics *infrav1.Diagnostics) *armcompute.Diagnos
},
}
case infrav1.UserManagedDiagnosticsStorage:
return &armcompute.DiagnosticsProfile{
BootDiagnostics: &armcompute.BootDiagnostics{
Enabled: ptr.To(true),
StorageURI: &diagnostics.Boot.UserManaged.StorageAccountURI,
},
if diagnostics.Boot.UserManaged != nil {
return &armcompute.DiagnosticsProfile{
BootDiagnostics: &armcompute.BootDiagnostics{
Enabled: ptr.To(true),
StorageURI: &diagnostics.Boot.UserManaged.StorageAccountURI,
},
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions azure/converters/diagnostics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ func TestGetDiagnosticsProfile(t *testing.T) {
},
want: nil,
},
{
name: "nil diagnostics boot user managed",
diagnostics: &infrav1.Diagnostics{
Boot: &infrav1.BootDiagnostics{
StorageAccountType: infrav1.UserManagedDiagnosticsStorage,
UserManaged: nil,
},
},
want: nil,
},
}
for _, tt := range tests {
tt := tt
Expand Down

0 comments on commit 43e72a9

Please sign in to comment.