Skip to content

Commit f9c86f0

Browse files
Gerrit91chbmucclaude
authored
Starting E2E tests (#24)
Co-authored-by: Christian Brunner <chb@muc.de> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0a18ece commit f9c86f0

28 files changed

Lines changed: 2561 additions & 344 deletions

cmd/api/v2/image.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ func newImageCmd(c *config.Config) *cobra.Command {
3333
DescribePrinter: func() printers.Printer { return c.DescribePrinter },
3434
ListPrinter: func() printers.Printer { return c.ListPrinter },
3535
OnlyCmds: genericcli.OnlyCmds(genericcli.DescribeCmd, genericcli.ListCmd),
36-
DescribeCmdMutateFn: func(cmd *cobra.Command) {
37-
cmd.RunE = func(cmd *cobra.Command, args []string) error {
38-
return gcli.DescribeAndPrint("", w.c.DescribePrinter)
39-
}
40-
},
4136
ListCmdMutateFn: func(cmd *cobra.Command) {
4237
cmd.Flags().StringP("id", "", "", "image id to filter for")
4338
cmd.Flags().StringP("os", "", "", "image os to filter for")

cmd/api/v2/ip.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/metal-stack/cli/pkg/helpers"
1010
"github.com/metal-stack/metal-lib/pkg/genericcli"
1111
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
12+
"github.com/metal-stack/metal-lib/pkg/pointer"
1213
"github.com/spf13/cobra"
1314
"github.com/spf13/viper"
1415
)
@@ -69,9 +70,9 @@ func newIPCmd(c *config.Config) *cobra.Command {
6970
CreateRequestFromCLI: func() (*apiv2.IPServiceCreateRequest, error) {
7071
return &apiv2.IPServiceCreateRequest{
7172
Project: c.GetProject(),
72-
Name: new(viper.GetString("name")),
73-
Description: new(viper.GetString("description")),
7473
Network: viper.GetString("network"),
74+
Name: pointer.PointerOrNil(viper.GetString("name")),
75+
Description: pointer.PointerOrNil(viper.GetString("description")),
7576
// Labels: viper.GetStringSlice("tags"), // FIXME implement
7677
Type: new(ipStaticToType(viper.GetBool("static"))),
7778
AddressFamily: addressFamilyToType(viper.GetString("addressfamily")),
@@ -125,6 +126,10 @@ func (c *ip) Create(rq *apiv2.IPServiceCreateRequest) (*apiv2.IP, error) {
125126

126127
resp, err := c.c.Client.Apiv2().IP().Create(ctx, rq)
127128
if err != nil {
129+
if helpers.IsAlreadyExists(err) {
130+
return nil, genericcli.AlreadyExistsError()
131+
}
132+
128133
return nil, err
129134
}
130135

@@ -199,12 +204,14 @@ func (c *ip) Update(rq *apiv2.IPServiceUpdateRequest) (*apiv2.IP, error) {
199204

200205
func (c *ip) Convert(r *apiv2.IP) (string, *apiv2.IPServiceCreateRequest, *apiv2.IPServiceUpdateRequest, error) {
201206
responseToUpdate, err := c.IpResponseToUpdate(r)
202-
return helpers.EncodeProject(r.Uuid, r.Project), IpResponseToCreate(r), responseToUpdate, err
207+
return helpers.EncodeProject(r.Ip, r.Project), IpResponseToCreate(r), responseToUpdate, err
203208
}
204209

205210
func IpResponseToCreate(r *apiv2.IP) *apiv2.IPServiceCreateRequest {
206211
return &apiv2.IPServiceCreateRequest{
212+
Ip: &r.Ip,
207213
Project: r.Project,
214+
Network: r.Network,
208215
Name: &r.Name,
209216
Description: &r.Description,
210217
Labels: r.Meta.Labels,
@@ -213,7 +220,6 @@ func IpResponseToCreate(r *apiv2.IP) *apiv2.IPServiceCreateRequest {
213220
}
214221

215222
func (c *ip) IpResponseToUpdate(desired *apiv2.IP) (*apiv2.IPServiceUpdateRequest, error) {
216-
217223
ctx, cancel := c.c.NewRequestContext()
218224
defer cancel()
219225

cmd/common_test.go

Lines changed: 0 additions & 312 deletions
This file was deleted.

0 commit comments

Comments
 (0)