mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 17:58:50 +02:00
plumbing for the 'zrok test canary' commands (#771)
This commit is contained in:
parent
3cf98fc04f
commit
5bee2bb312
@ -24,7 +24,8 @@ func init() {
|
|||||||
adminCmd.AddCommand(adminDeleteCmd)
|
adminCmd.AddCommand(adminDeleteCmd)
|
||||||
adminCmd.AddCommand(adminListCmd)
|
adminCmd.AddCommand(adminListCmd)
|
||||||
adminCmd.AddCommand(adminUpdateCmd)
|
adminCmd.AddCommand(adminUpdateCmd)
|
||||||
testCmd.AddCommand(loopCmd)
|
testCmd.AddCommand(testCanaryCmd)
|
||||||
|
testCmd.AddCommand(testLoopCmd)
|
||||||
rootCmd.AddCommand(adminCmd)
|
rootCmd.AddCommand(adminCmd)
|
||||||
rootCmd.AddCommand(configCmd)
|
rootCmd.AddCommand(configCmd)
|
||||||
rootCmd.AddCommand(modifyCmd)
|
rootCmd.AddCommand(modifyCmd)
|
||||||
@ -82,12 +83,6 @@ var configCmd = &cobra.Command{
|
|||||||
Short: "Configure your zrok environment",
|
Short: "Configure your zrok environment",
|
||||||
}
|
}
|
||||||
|
|
||||||
var loopCmd = &cobra.Command{
|
|
||||||
Use: "loopback",
|
|
||||||
Aliases: []string{"loop"},
|
|
||||||
Short: "Loopback testing utilities",
|
|
||||||
}
|
|
||||||
|
|
||||||
var modifyCmd = &cobra.Command{
|
var modifyCmd = &cobra.Command{
|
||||||
Use: "modify",
|
Use: "modify",
|
||||||
Aliases: []string{"mod"},
|
Aliases: []string{"mod"},
|
||||||
@ -101,7 +96,18 @@ var shareCmd = &cobra.Command{
|
|||||||
|
|
||||||
var testCmd = &cobra.Command{
|
var testCmd = &cobra.Command{
|
||||||
Use: "test",
|
Use: "test",
|
||||||
Short: "Utilities for testing zrok deployments",
|
Short: "Utilities for testing deployments",
|
||||||
|
}
|
||||||
|
|
||||||
|
var testCanaryCmd = &cobra.Command{
|
||||||
|
Use: "canary",
|
||||||
|
Short: "Utilities for performance management",
|
||||||
|
}
|
||||||
|
|
||||||
|
var testLoopCmd = &cobra.Command{
|
||||||
|
Use: "loopback",
|
||||||
|
Aliases: []string{"loop"},
|
||||||
|
Short: "Loopback testing utilities",
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
29
cmd/zrok/testCanaryPeriodic.go
Normal file
29
cmd/zrok/testCanaryPeriodic.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
testCanaryCmd.AddCommand(newTestCanaryPeriodicCommand().cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
type testCanaryPeriodicCommand struct {
|
||||||
|
cmd *cobra.Command
|
||||||
|
}
|
||||||
|
|
||||||
|
func newTestCanaryPeriodicCommand() *testCanaryPeriodicCommand {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "periodic",
|
||||||
|
Short: "Run a periodic canary inspection",
|
||||||
|
Args: cobra.NoArgs,
|
||||||
|
}
|
||||||
|
command := &testCanaryPeriodicCommand{cmd: cmd}
|
||||||
|
cmd.Run = command.run
|
||||||
|
return command
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testCanaryPeriodicCommand) run(_ *cobra.Command, _ []string) {
|
||||||
|
logrus.Info("periodic")
|
||||||
|
}
|
@ -28,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
loopCmd.AddCommand(newTestLoopPublicCommand().cmd)
|
testLoopCmd.AddCommand(newTestLoopPublicCommand().cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
type testLoopPublicCommand struct {
|
type testLoopPublicCommand struct {
|
||||||
@ -50,22 +50,22 @@ func newTestLoopPublicCommand() *testLoopPublicCommand {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "public",
|
Use: "public",
|
||||||
Short: "Start a loop agent testing public proxy shares",
|
Short: "Start a loop agent testing public proxy shares",
|
||||||
Args: cobra.ExactArgs(0),
|
Args: cobra.NoArgs,
|
||||||
}
|
}
|
||||||
r := &testLoopPublicCommand{cmd: cmd}
|
command := &testLoopPublicCommand{cmd: cmd}
|
||||||
cmd.Run = r.run
|
cmd.Run = command.run
|
||||||
cmd.Flags().IntVarP(&r.loopers, "loopers", "l", 1, "Number of current loopers to start")
|
cmd.Flags().IntVarP(&command.loopers, "loopers", "l", 1, "Number of current loopers to start")
|
||||||
cmd.Flags().IntVarP(&r.iterations, "iterations", "i", 1, "Number of iterations per looper")
|
cmd.Flags().IntVarP(&command.iterations, "iterations", "i", 1, "Number of iterations per looper")
|
||||||
cmd.Flags().IntVarP(&r.statusEvery, "status-every", "E", 100, "Show status every # iterations")
|
cmd.Flags().IntVarP(&command.statusEvery, "status-every", "E", 100, "Show status every # iterations")
|
||||||
cmd.Flags().IntVarP(&r.timeoutSeconds, "timeout-seconds", "T", 30, "Time out after # seconds when sending http requests")
|
cmd.Flags().IntVarP(&command.timeoutSeconds, "timeout-seconds", "T", 30, "Time out after # seconds when sending http requests")
|
||||||
cmd.Flags().IntVar(&r.minPayload, "min-payload", 64, "Minimum payload size in bytes")
|
cmd.Flags().IntVar(&command.minPayload, "min-payload", 64, "Minimum payload size in bytes")
|
||||||
cmd.Flags().IntVar(&r.maxPayload, "max-payload", 10240, "Maximum payload size in bytes")
|
cmd.Flags().IntVar(&command.maxPayload, "max-payload", 10240, "Maximum payload size in bytes")
|
||||||
cmd.Flags().IntVar(&r.minDwellMs, "min-dwell-ms", 1000, "Minimum dwell time in milliseconds")
|
cmd.Flags().IntVar(&command.minDwellMs, "min-dwell-ms", 1000, "Minimum dwell time in milliseconds")
|
||||||
cmd.Flags().IntVar(&r.maxDwellMs, "max-dwell-ms", 1000, "Maximum dwell time in milliseconds")
|
cmd.Flags().IntVar(&command.maxDwellMs, "max-dwell-ms", 1000, "Maximum dwell time in milliseconds")
|
||||||
cmd.Flags().IntVar(&r.minPacingMs, "min-pacing-ms", 0, "Minimum pacing in milliseconds")
|
cmd.Flags().IntVar(&command.minPacingMs, "min-pacing-ms", 0, "Minimum pacing in milliseconds")
|
||||||
cmd.Flags().IntVar(&r.maxPacingMs, "max-pacing-ms", 0, "Maximum pacing in milliseconds")
|
cmd.Flags().IntVar(&command.maxPacingMs, "max-pacing-ms", 0, "Maximum pacing in milliseconds")
|
||||||
cmd.Flags().StringArrayVar(&r.frontendSelection, "frontends", []string{"public"}, "Selected frontends to use for the share")
|
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontends", []string{"public"}, "Selected frontends to use for the share")
|
||||||
return r
|
return command
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *testLoopPublicCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *testLoopPublicCommand) run(_ *cobra.Command, _ []string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user