Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.18.0
github.com/google/go-cmp v0.7.0
github.com/metal-stack/api v0.0.55
github.com/metal-stack/api v0.0.58
github.com/metal-stack/metal-lib v0.24.0
github.com/metal-stack/v v1.0.3
github.com/spf13/afero v1.15.0
Expand Down Expand Up @@ -68,8 +68,8 @@ require (
golang.org/x/net v0.50.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.35.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260316180232-0b37fe3546d5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260316180232-0b37fe3546d5 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.35.1 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.20 h1:WcT52H91ZUAwy8+HUkdM3THM6gXqXuLJi9O3rjcQQaQ=
github.com/mattn/go-runewidth v0.0.20/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/metal-stack/api v0.0.55 h1:n5Y91x+B5/rh6j9rai6CAgVWenLgEzAQwFD2nYbVDXA=
github.com/metal-stack/api v0.0.55/go.mod h1:OU8KDSOw5JEfeEs9q8FY5TcaklBAiGx+Q9Em0BMZrlY=
github.com/metal-stack/api v0.0.58 h1:7UxnZrM41BS0f4S9RvqDg0/YTvs3FveawuyBoKz9WhA=
github.com/metal-stack/api v0.0.58/go.mod h1:hEgtKVD7UnUwUExdA7pbFvVRxNRxSGUnU+bZce46//c=
github.com/metal-stack/metal-lib v0.24.0 h1:wvQQPWIXcA2tP+I6zAHUNdtVLLJfQnnV9yG2SoqUkz4=
github.com/metal-stack/metal-lib v0.24.0/go.mod h1:oITaqj/BtB9vDKM66jCXkeA+4D0eTZElgIKal5vtiNY=
github.com/metal-stack/v v1.0.3 h1:Sh2oBlnxrCUD+mVpzfC8HiqL045YWkxs0gpTvkjppqs=
Expand Down Expand Up @@ -133,10 +133,10 @@ golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c h1:OyQPd6I3pN/9gDxz6L13kYGJgqkpdrAohJRBeXyxlgI=
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c/go.mod h1:X2gu9Qwng7Nn009s/r3RUxqkzQNqOrAy79bluY7ojIg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c h1:xgCzyF2LFIO/0X2UAoVRiXKU5Xg6VjToG4i2/ecSswk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/genproto/googleapis/api v0.0.0-20260316180232-0b37fe3546d5 h1:CogIeEXn4qWYzzQU0QqvYBM8yDF9cFYzDq9ojSpv0Js=
google.golang.org/genproto/googleapis/api v0.0.0-20260316180232-0b37fe3546d5/go.mod h1:EIQZ5bFCfRQDV4MhRle7+OgjNtZ6P1PiZBgAKuxXu/Y=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260316180232-0b37fe3546d5 h1:aJmi6DVGGIStN9Mobk/tZOOQUBbj0BPjZjjnOdoZKts=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260316180232-0b37fe3546d5/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
Expand Down
8 changes: 2 additions & 6 deletions testing/e2e/test_client.go → testing/e2e/test_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ import (
type TestConfig struct {
FsMocks func(fs *afero.Afero)
MockStdin *bytes.Buffer
ClientCalls []ClientCall
ClientCalls []client.ClientCall
}

func NewRootCmd(t *testing.T, c *TestConfig) NewRootCmdFunc {
return func() (*cobra.Command, *bytes.Buffer) {
interceptors := []connect.Interceptor{
&testClientInterceptor{
t: t,
calls: c.ClientCalls,
count: 0,
},
client.NewTestInterceptor(t, c.ClientCalls),
validate.NewInterceptor(),
}

Expand Down
60 changes: 0 additions & 60 deletions testing/e2e/test_interceptor.go

This file was deleted.

55 changes: 0 additions & 55 deletions testing/e2e/test_interceptor_test.go

This file was deleted.

7 changes: 4 additions & 3 deletions tests/e2e/admin/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
adminv2 "github.com/metal-stack/api/go/metalstack/admin/v2"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
Expand Down Expand Up @@ -55,7 +56,7 @@ func Test_AdminComponentCmd_Describe(t *testing.T) {
Name: "describe",
CmdArgs: []string{"admin", "component", "describe", component1().Uuid},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.ComponentServiceGetRequest{
Uuid: component1().Uuid,
Expand Down Expand Up @@ -100,7 +101,7 @@ func Test_AdminComponentCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"admin", "component", "list"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.ComponentServiceListRequest{
Query: &apiv2.ComponentQuery{},
Expand Down Expand Up @@ -150,7 +151,7 @@ func Test_AdminComponentCmd_Delete(t *testing.T) {
Name: "delete",
CmdArgs: []string{"admin", "component", "delete", component1().Uuid},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.ComponentServiceDeleteRequest{
Uuid: component1().Uuid,
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/admin/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
adminv2 "github.com/metal-stack/api/go/metalstack/admin/v2"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
Expand All @@ -16,7 +17,7 @@ func Test_AdminProjectCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"admin", "project", "list"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.ProjectServiceListRequest{},
WantResponse: func() connect.AnyResponse {
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/admin/switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
adminv2 "github.com/metal-stack/api/go/metalstack/admin/v2"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
Expand Down Expand Up @@ -65,7 +66,7 @@ func Test_AdminSwitchCmd_Describe(t *testing.T) {
Name: "describe",
CmdArgs: []string{"admin", "switch", "describe", switch1().Id},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.SwitchServiceGetRequest{
Id: switch1().Id,
Expand Down Expand Up @@ -93,7 +94,7 @@ func Test_AdminSwitchCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"admin", "switch", "list"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.SwitchServiceListRequest{
Query: &apiv2.SwitchQuery{
Expand Down Expand Up @@ -145,7 +146,7 @@ func Test_AdminSwitchCmd_Delete(t *testing.T) {
Name: "delete",
CmdArgs: []string{"admin", "switch", "delete", switch1().Id},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.SwitchServiceDeleteRequest{
Id: switch1().Id,
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/admin/tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
adminv2 "github.com/metal-stack/api/go/metalstack/admin/v2"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
Expand Down Expand Up @@ -41,7 +42,7 @@ func Test_AdminTenantCmd_Create(t *testing.T) {
Name: "create",
CmdArgs: []string{"admin", "tenant", "create", "--name", adminTenant1().Name, "--description", adminTenant1().Description, "--email", adminTenant1().Email},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.TenantServiceCreateRequest{
Name: adminTenant1().Name,
Expand Down Expand Up @@ -71,7 +72,7 @@ func Test_AdminTenantCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"admin", "tenant", "list"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.TenantServiceListRequest{},
WantResponse: func() connect.AnyResponse {
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/admin/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
adminv2 "github.com/metal-stack/api/go/metalstack/admin/v2"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
Expand All @@ -16,7 +17,7 @@ func Test_AdminTokenCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"admin", "token", "list"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.TokenServiceListRequest{},
WantResponse: func() connect.AnyResponse {
Expand Down Expand Up @@ -64,7 +65,7 @@ func Test_AdminTokenCmd_Delete(t *testing.T) {
Name: "delete",
CmdArgs: []string{"admin", "token", "delete", testresources.Token1().Uuid, "--user", "user-123"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &adminv2.TokenServiceRevokeRequest{
Uuid: testresources.Token1().Uuid,
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/api/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
"github.com/metal-stack/cli/tests/e2e/testresources"
Expand Down Expand Up @@ -48,7 +49,7 @@ func Test_AuditCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"audit", "list", "--tenant", "a"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &apiv2.AuditServiceListRequest{
Login: "a",
Expand Down Expand Up @@ -100,7 +101,7 @@ func Test_AuditCmd_Describe(t *testing.T) {
Name: "describe",
CmdArgs: []string{"audit", "describe", "--tenant", "a", Trace1().Uuid},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &apiv2.AuditServiceGetRequest{
Login: "a",
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/api/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
)
Expand All @@ -28,7 +29,7 @@ func Test_HealthCmd(t *testing.T) {
Name: "health",
CmdArgs: []string{"health"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &apiv2.HealthServiceGetRequest{},
WantResponse: func() connect.AnyResponse {
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/api/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"connectrpc.com/connect"
"github.com/metal-stack/api/go/client"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/testing/e2e"
"github.com/metal-stack/cli/tests/e2e/testresources"
Expand All @@ -15,7 +16,7 @@ func Test_ImageCmd_List(t *testing.T) {
Name: "list",
CmdArgs: []string{"image", "list"},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &apiv2.ImageServiceListRequest{
Query: &apiv2.ImageQuery{},
Expand Down Expand Up @@ -66,7 +67,7 @@ func Test_ImageCmd_Describe(t *testing.T) {
Name: "describe",
CmdArgs: []string{"image", "describe", testresources.Image1().Id},
NewRootCmd: e2e.NewRootCmd(t, &e2e.TestConfig{
ClientCalls: []e2e.ClientCall{
ClientCalls: []client.ClientCall{
{
WantRequest: &apiv2.ImageServiceGetRequest{
Id: testresources.Image1().Id,
Expand Down
Loading
Loading