Skip to content

Commit

Permalink
lca: add unittest for seedgenerator
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Chuzhoy <[email protected]>
  • Loading branch information
achuzhoy committed May 30, 2024
1 parent ca98df4 commit acede82
Show file tree
Hide file tree
Showing 2 changed files with 385 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/lca/seedgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func PullSeedGenerator(apiClient *clients.Settings, name string) (*SeedGenerator
if name == "" {
glog.V(100).Infof("The name of the seedgenerator is empty")

builder.errorMsg = "seedgenerator 'name' cannot be empty"
return nil, fmt.Errorf("seedgenerator 'name' cannot be empty")
}

if !builder.Exists() {
Expand All @@ -153,7 +153,9 @@ func (builder *SeedGeneratorBuilder) Delete() (*SeedGeneratorBuilder, error) {
builder.Definition.Name)

if !builder.Exists() {
return builder, fmt.Errorf("seedgenerator cannot be deleted because it does not exist")
builder.Object = nil

return builder, nil
}

err := builder.apiClient.Delete(context.TODO(), builder.Definition)
Expand Down Expand Up @@ -230,6 +232,14 @@ func (builder *SeedGeneratorBuilder) WithRecertImage(
return builder
}

if recertImage == "" {
glog.V(100).Infof("The name of the recertImage is empty")

builder.errorMsg = "recertImage 'name' cannot be empty"

return builder
}

glog.V(100).Infof("Setting recert image %s in seedgenerator", recertImage)

builder.Definition.Spec.RecertImage = recertImage
Expand Down
Loading

0 comments on commit acede82

Please sign in to comment.