Skip to content

Commit

Permalink
fix make test
Browse files Browse the repository at this point in the history
  • Loading branch information
tedteng committed Oct 20, 2022
1 parent b3c70da commit e70e6e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// NewCmdInfo returns a new info command.
func NewCmdInfo(f util.Factory, o *options) *cobra.Command {
func NewCmdInfo(f util.Factory, o *Options) *cobra.Command {
cmd := &cobra.Command{
Use: "info",
Short: "Get landscape informations and shows the number of shoots per seed, e.g. \"gardenctl info\"",
Expand Down
4 changes: 1 addition & 3 deletions pkg/cmd/info/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ SPDX-License-Identifier: Apache-2.0
package info_test

import (
"fmt"

internalfake "github.com/gardener/gardenctl-v2/internal/fake"
"github.com/gardener/gardenctl-v2/internal/util"
cmdinfo "github.com/gardener/gardenctl-v2/pkg/cmd/info"
Expand Down Expand Up @@ -110,7 +108,7 @@ var _ = Describe("Info Command", func() {
cmd := cmdinfo.NewCmdInfo(factory, o)

Expect(cmd.RunE(cmd, nil)).To(Succeed())
Expect(out.String()).To(Equal(fmt.Sprintf("Garden: mygarden\nSeed Total Active Hibernated Allocatable Capacity\n---- ----- ------ ---------- ----------- --------\n---- ----- ------ ---------- ----------- --------\nTOTAL 3 2 0 - -\nUnscheduled 1\nUnscheduled List brokenShoot\n\n")))
Expect(out.String()).To(Equal("Garden: mygarden\nSeed Total Active Hibernated Allocatable Capacity\n---- ----- ------ ---------- ----------- --------\n---- ----- ------ ---------- ----------- --------\nTOTAL 3 2 0 - -\nUnscheduled 1\nUnscheduled List brokenShoot\n\n"))
})
})
})
15 changes: 7 additions & 8 deletions pkg/cmd/info/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,25 @@ import (
)

// InfoOptions is a struct to support Info command
// nolint
type options struct {
type Options struct {
base.Options
// Allocatable is the seed allocatable
Allocatable int64
// Capacity is the seed capacity
Capacity int64
}

// NewInfoOptions returns initialized InfoOptions
func NewInfoOptions(ioStreams util.IOStreams) *options {
return &options{
// NewInfoOptions returns initialized Options
func NewInfoOptions(ioStreams util.IOStreams) *Options {
return &Options{
Options: base.Options{
IOStreams: ioStreams,
},
}
}

// Run does the actual work of the command
func (o *options) Run(f util.Factory) error {
func (o *Options) Run(f util.Factory) error {
manager, err := f.Manager()
if err != nil {
return err
Expand Down Expand Up @@ -69,7 +68,7 @@ func (o *options) Run(f util.Factory) error {
totalShootsCountPerSeed = make(map[string]int)
hibernatedShootsCountPerSeed = make(map[string]int)
unscheduledList = make([]string, 0)
infoOptions = make(map[string]options)
infoOptions = make(map[string]Options)
valAllocatable int64
valCapacity int64
)
Expand All @@ -90,7 +89,7 @@ func (o *options) Run(f util.Factory) error {
return fmt.Errorf("capacity conversion is not possible")
}

infoOptions[seed.Name] = options{Allocatable: valAllocatable, Capacity: valCapacity}
infoOptions[seed.Name] = Options{Allocatable: valAllocatable, Capacity: valCapacity}
}

for _, shoot := range shootList.Items {
Expand Down

0 comments on commit e70e6e8

Please sign in to comment.