Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resolve command #306

Merged
merged 6 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
PR feedback
  • Loading branch information
petersutter committed May 31, 2023
commit e4f900e444b3dfb93ba53a6ea0e1eb9f9e3f8564
9 changes: 7 additions & 2 deletions pkg/cmd/resolve/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,13 @@ func (o *options) Run(f util.Factory) error {

shoot, err := findShoot(ctx, o.GardenClient, o.CurrentTarget)
if err != nil {
if errors.Is(err, target.ErrNoShootTargeted) && o.Kind == KindProject {
return target.ErrNoProjectTargeted
if errors.Is(err, target.ErrNoShootTargeted) {
switch o.Kind {
case KindProject:
return target.ErrNoProjectTargeted
case KindSeed:
return target.ErrNoSeedTargeted
}
}

return err
Expand Down
7 changes: 7 additions & 0 deletions pkg/cmd/resolve/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ seed:
`))
})
})

It("should fail if no seed is targeted", func() {
t := target.NewTarget(gardenName, "", "", "")
o.CurrentTarget = t

Expect(o.Run(factory)).To(MatchError(target.ErrNoSeedTargeted))
})
})

Context("Resolve Project", func() {
Expand Down