Skip to content

Commit

Permalink
test: add 'piko test cluster'
Browse files Browse the repository at this point in the history
Adds 'piko test cluster' to run a local Piko cluster.
  • Loading branch information
andydunstall committed Jul 13, 2024
1 parent 9eccc52 commit 187c9f6
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 39 deletions.
2 changes: 0 additions & 2 deletions cli/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/andydunstall/piko/cli/forward"
"github.com/andydunstall/piko/cli/server"
"github.com/andydunstall/piko/cli/test"
workloadv2 "github.com/andydunstall/piko/cli/workloadv2"
"github.com/andydunstall/piko/pkg/build"
)

Expand Down Expand Up @@ -65,7 +64,6 @@ to an upstream listener via Piko. Such as to forward port 3000 to endpoint
cmd.AddCommand(agent.NewCommand())
cmd.AddCommand(forward.NewCommand())
cmd.AddCommand(test.NewCommand())
cmd.AddCommand(workloadv2.NewCommand())

return cmd
}
Expand Down
10 changes: 5 additions & 5 deletions cli/workloadv2/cluster.go → cli/test/cluster/command.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package workload
package cluster

import (
"context"
Expand All @@ -11,15 +11,15 @@ import (
"github.com/spf13/cobra"
"go.uber.org/zap"

"github.com/andydunstall/piko/pikotest/cluster"
"github.com/andydunstall/piko/pikotest/cluster/config"
"github.com/andydunstall/piko/pikotest/cluster/proxy"
"github.com/andydunstall/piko/pkg/build"
pikoconfig "github.com/andydunstall/piko/pkg/config"
"github.com/andydunstall/piko/pkg/log"
"github.com/andydunstall/piko/workloadv2/cluster"
"github.com/andydunstall/piko/workloadv2/cluster/config"
"github.com/andydunstall/piko/workloadv2/cluster/proxy"
)

func newClusterCommand() *cobra.Command {
func NewCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "cluster",
Short: "create a cluster of Piko nodes",
Expand Down
2 changes: 2 additions & 0 deletions cli/test/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package test
import (
"github.com/spf13/cobra"

"github.com/andydunstall/piko/cli/test/cluster"
"github.com/andydunstall/piko/cli/test/workload"
)

Expand All @@ -14,6 +15,7 @@ func NewCommand() *cobra.Command {
}

cmd.AddCommand(workload.NewCommand())
cmd.AddCommand(cluster.NewCommand())

return cmd
}
24 changes: 0 additions & 24 deletions cli/workloadv2/command.go

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"go.uber.org/zap"

"github.com/andydunstall/piko/pikotest/cluster/config"
"github.com/andydunstall/piko/pkg/log"
"github.com/andydunstall/piko/workloadv2/cluster/config"
)

type Manager struct {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http/httputil"
"sync"

"github.com/andydunstall/piko/workloadv2/cluster"
"github.com/andydunstall/piko/pikotest/cluster"
)

type reverseProxy struct {
Expand Down
2 changes: 1 addition & 1 deletion tests/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/stretchr/testify/assert"

cluster "github.com/andydunstall/piko/workloadv2/cluster"
cluster "github.com/andydunstall/piko/pikotest/cluster"
)

// Tests the admin server.
Expand Down
2 changes: 1 addition & 1 deletion tests/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/stretchr/testify/assert"

"github.com/andydunstall/piko/client"
"github.com/andydunstall/piko/pikotest/cluster"
"github.com/andydunstall/piko/server/auth"
"github.com/andydunstall/piko/workloadv2/cluster"
)

type pikoEndpointClaims struct {
Expand Down
2 changes: 1 addition & 1 deletion tests/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/andydunstall/piko/client"
cluster "github.com/andydunstall/piko/workloadv2/cluster"
"github.com/andydunstall/piko/pikotest/cluster"
)

// TestClient_ListenAndForward tests forwarding incoming connections to a local
Expand Down
4 changes: 2 additions & 2 deletions tests/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/assert"

"github.com/andydunstall/piko/client"
"github.com/andydunstall/piko/workloadv2/cluster"
"github.com/andydunstall/piko/workloadv2/cluster/config"
"github.com/andydunstall/piko/pikotest/cluster"
"github.com/andydunstall/piko/pikotest/cluster/config"
)

// Tests proxying traffic across multiple Piko server nodes.
Expand Down
2 changes: 1 addition & 1 deletion tests/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/andydunstall/piko/client"
cluster "github.com/andydunstall/piko/workloadv2/cluster"
"github.com/andydunstall/piko/pikotest/cluster"
)

type errorMessage struct {
Expand Down

0 comments on commit 187c9f6

Please sign in to comment.