Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matrus2 committed Jul 10, 2023
1 parent 607e2ea commit 2ddff14
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
5 changes: 3 additions & 2 deletions examples/third_party_integration/flux/flux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ package flux

import (
"context"
"testing"
"time"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/e2e-framework/klient/wait"
"sigs.k8s.io/e2e-framework/klient/wait/conditions"
"sigs.k8s.io/e2e-framework/pkg/envconf"
"sigs.k8s.io/e2e-framework/pkg/features"
"testing"
"time"
)

func TestFluxRepoWorkflow(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion examples/third_party_integration/flux/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ package flux

import (
"os"
"sigs.k8s.io/e2e-framework/third_party/flux"
"testing"

"sigs.k8s.io/e2e-framework/pkg/env"
"sigs.k8s.io/e2e-framework/pkg/envconf"
"sigs.k8s.io/e2e-framework/pkg/envfuncs"
"sigs.k8s.io/e2e-framework/third_party/flux"
)

var (
Expand Down
18 changes: 9 additions & 9 deletions third_party/flux/cmd_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package flux

import (
"fmt"
"strings"

"github.com/vladimirvivien/gexe"
log "k8s.io/klog/v2"
"strings"
)

type Opts struct {
Expand Down Expand Up @@ -115,10 +116,8 @@ func (m *Manager) run(opts *Opts) (err error) {
err = fmt.Errorf("'flux' command is missing. Please ensure the tool exists before using the flux manager")
return
}
command, err := m.getCommand(opts)
if err != nil {
return
}
command := m.getCommand(opts)

log.V(4).InfoS("Running Flux Operation", "command", command)
proc := m.e.RunProc(command)
result := proc.Result()
Expand All @@ -134,7 +133,7 @@ func New(kubeConfig string) *Manager {
return &Manager{e: gexe.New(), kubeConfig: kubeConfig}
}

func (m *Manager) getCommand(opt *Opts) (string, error) {
func (m *Manager) getCommand(opt *Opts) string {
commandParts := []string{"flux", opt.mode}

if opt.name != "" {
Expand Down Expand Up @@ -167,7 +166,7 @@ func (m *Manager) getCommand(opt *Opts) (string, error) {

commandParts = append(commandParts, opt.args...)
commandParts = append(commandParts, "--kubeconfig", m.kubeConfig)
return strings.Join(commandParts, " "), nil
return strings.Join(commandParts, " ")
}

func (m *Manager) installFlux(opts ...Option) error {
Expand All @@ -181,7 +180,8 @@ func (m *Manager) uninstallFlux(opts ...Option) error {
o.mode = "uninstall -s"
return m.run(o)
}
func (m *Manager) createSource(sourceType Source, name string, url string, opts ...Option) error {

func (m *Manager) createSource(sourceType Source, name, url string, opts ...Option) error {
o := m.processOpts(opts...)
o.mode = string("create source " + sourceType)
o.name = name
Expand All @@ -196,7 +196,7 @@ func (m *Manager) deleteSource(sourceType Source, name string, opts ...Option) e
return m.run(o)
}

func (m *Manager) createKustomization(name string, source string, opts ...Option) error {
func (m *Manager) createKustomization(name, source string, opts ...Option) error {
o := m.processOpts(opts...)
o.mode = "create ks"
o.name = name
Expand Down
7 changes: 4 additions & 3 deletions third_party/flux/flux_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package flux
import (
"context"
"fmt"

"sigs.k8s.io/e2e-framework/pkg/env"
"sigs.k8s.io/e2e-framework/pkg/envconf"
)
Expand All @@ -40,12 +41,12 @@ func InstallFlux(opts ...Option) env.Func {
}

// CreateGitRepo creates a reference to a specific repository, it is a source for Kustomization or HelmRelease
func CreateGitRepo(gitRepoName string, gitRepoUrl string, opts ...Option) env.Func {
func CreateGitRepo(gitRepoName, gitRepoURL string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
}
err := manager.createSource(Git, gitRepoName, gitRepoUrl, opts...)
err := manager.createSource(Git, gitRepoName, gitRepoURL, opts...)
if err != nil {
return ctx, fmt.Errorf("git reporistory creation failed: %w", err)
}
Expand All @@ -54,7 +55,7 @@ func CreateGitRepo(gitRepoName string, gitRepoUrl string, opts ...Option) env.Fu
}

// CreateKustomization is used to point to a specific source and path for reconciliation
func CreateKustomization(kustomizationName string, sourceRef string, opts ...Option) env.Func {
func CreateKustomization(kustomizationName, sourceRef string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
Expand Down

0 comments on commit 2ddff14

Please sign in to comment.