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 de42f8c
Show file tree
Hide file tree
Showing 2 changed files with 388 additions and 3 deletions.
16 changes: 13 additions & 3 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 Expand Up @@ -270,7 +280,7 @@ func (builder *SeedGeneratorBuilder) WaitUntilComplete(timeout time.Duration) (*
}
}

return false, nil
return false, fmt.Errorf("seedgenerator did not complete")
})

if err == nil {
Expand Down
Loading

0 comments on commit de42f8c

Please sign in to comment.