Skip to content
Open
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
7 changes: 4 additions & 3 deletions cmd/sonobuoy/app/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,17 @@ func AddLegacyE2EFlags(cfg *SonobuoyConfig, env *PluginEnvVars, pluginTransforms
&envVarModierFlag{
plugin: e2ePlugin, field: "E2E_FOCUS",
PluginEnvVars: *env,
validationFunc: regexpValidation},
validationFunc: regexpValidation,
},
e2eFocusFlag,
"Specify the E2E_FOCUS value for the e2e plugin, specifying which tests to run. Shorthand for --plugin-env=e2e.E2E_FOCUS=<string>",
)
fs.Var(
&envVarModierFlag{
plugin: e2ePlugin, field: "E2E_SKIP",
PluginEnvVars: *env,
validationFunc: regexpValidation},
validationFunc: regexpValidation,
},
e2eSkipFlag,
"Specify the E2E_SKIP value for the e2e plugin, specifying which tests to skip. Shorthand for --plugin-env=e2e.E2E_SKIP=<string>",
)
Expand Down Expand Up @@ -616,7 +618,6 @@ func (f *e2eDockerConfigFlag) Set(str string) error {
}
m.ConfigMap[name] = string(fData)
return nil

})
return nil
}
Expand Down
34 changes: 17 additions & 17 deletions cmd/sonobuoy/app/envvars_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,78 +35,78 @@ func TestPluginEnvSet(t *testing.T) {
init: PluginEnvVars(map[string]map[string]string{}),
input: "name.env=val",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
}, {
desc: "Set value again same plugin",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name.env2=val2",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val", "env2": "val2"},
"name": {"env": "val", "env2": "val2"},
}),
}, {
desc: "Set value again different plugin",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name2.env2=val2",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name2": map[string]string{"env2": "val2"},
"name": {"env": "val"},
"name2": {"env2": "val2"},
}),
}, {
desc: "Override value already in map",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name.env=val2",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val2"},
"name": {"env": "val2"},
}),
}, {
desc: "Empty string if no equals",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name.env2",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val", "env2": ""},
"name": {"env": "val", "env2": ""},
}),
}, {
desc: "Empty string if equals but no value",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name.env2=",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val", "env2": ""},
"name": {"env": "val", "env2": ""},
}),
}, {
desc: "Splits on first period",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name.env.with.dot=val2",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val", "env.with.dot": "val2"},
"name": {"env": "val", "env.with.dot": "val2"},
}),
}, {
desc: "Splits on first equals and period",
init: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
input: "name.env.with.dot=val=with=equals",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val", "env.with.dot": "val=with=equals"},
"name": {"env": "val", "env.with.dot": "val=with=equals"},
}),
}, {
desc: "Starting with nil map",
init: PluginEnvVars(nil),
input: "name.env=val",
expect: PluginEnvVars(map[string]map[string]string{
"name": map[string]string{"env": "val"},
"name": {"env": "val"},
}),
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/sonobuoy/app/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (g *genFlags) RunConfig() (*client.RunConfig, error) {

func NewCmdGen() *cobra.Command {
var genflags genFlags
var GenCommand = &cobra.Command{
GenCommand := &cobra.Command{
Use: "gen",
Short: "Generates a sonobuoy manifest for submission via kubectl",
Run: genManifest(&genflags),
Expand Down
2 changes: 1 addition & 1 deletion cmd/sonobuoy/app/gen_cli_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func NewCmdGenCLIDocs() *cobra.Command {
var docsCmd = &cobra.Command{
docsCmd := &cobra.Command{
Use: "cli <output dir>",
Short: "Generates markdown docs for the CLI",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/sonobuoy/app/gen_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func NewCmdGenConfig() *cobra.Command {
var f genFlags

var GenCommand = &cobra.Command{
GenCommand := &cobra.Command{
Use: "config",
Short: "Generates a Sonobuoy config for input to sonobuoy gen or run.",
Run: genConfigCobra(&f),
Expand Down
4 changes: 2 additions & 2 deletions cmd/sonobuoy/app/gen_plugin_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func NewCmdGenE2E() *cobra.Command {
var genE2Eflags genFlags
configMapFiles := []string{}

var cmd = &cobra.Command{
cmd := &cobra.Command{
Use: "e2e",
Short: "Generates the e2e plugin definition based on the given options",
RunE: genManifestForPlugin(&genE2Eflags, e2ePlugin),
Expand Down Expand Up @@ -267,7 +267,7 @@ func genManifestForPlugin(genflags *genFlags, pluginName string) func(cmd *cobra

func NewCmdGenSystemdLogs() *cobra.Command {
var genSystemdLogsflags genFlags
var cmd = &cobra.Command{
cmd := &cobra.Command{
Use: "systemd-logs",
Short: "Generates the systemd-logs plugin definition based on the given options",
RunE: genManifestForPlugin(&genSystemdLogsflags, systemdLogsPlugin),
Expand Down
2 changes: 1 addition & 1 deletion cmd/sonobuoy/app/gen_plugin_def_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestPluginGenDef(t *testing.T) {
}

if *update {
os.WriteFile(tC.expectFile, []byte(manifest), 0666)
os.WriteFile(tC.expectFile, []byte(manifest), 0o666)
} else {
fileData, err := os.ReadFile(tC.expectFile)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion cmd/sonobuoy/app/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ func TestVerifyKubernetesVersion(t *testing.T) {
}
}
})

}
}
3 changes: 0 additions & 3 deletions cmd/sonobuoy/app/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,16 @@ func getPods(flags *getFlags) error {
}

sbc, err := getSonobuoyClientFromKubecfg(flags.kubecfg)

if err != nil {
return errors.Wrap(err, "could not create sonobuoy client")
}

client, err := sbc.Client()

if err != nil {
return errors.Wrap(err, "could not retrieve kubernetes client")
}

pods, err := client.CoreV1().Pods(flags.namespace).List(context.TODO(), listOptions)

if err != nil {
return errors.Wrap(err, "could not retrieve list of pods")
}
Expand Down
6 changes: 2 additions & 4 deletions cmd/sonobuoy/app/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ type imagesFlags struct {
pluginEnvs PluginEnvVars
}

var (
// transformSink avoids nil issues despite not really needing the transforms for these commands.
transformSink = map[string][]func(*manifest.Manifest) error{}
)
// transformSink avoids nil issues despite not really needing the transforms for these commands.
var transformSink = map[string][]func(*manifest.Manifest) error{}

func runListImages(flags imagesFlags) {
client := image.NewDockerClient()
Expand Down
Loading