Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
chore: address linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Goodness <michael.goodness@mlb.com>
  • Loading branch information
mgoodness committed Jan 12, 2021
1 parent ffda8c5 commit d1113ba
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions pkg/controllers/applicationset_controller_test.go
Expand Up @@ -62,7 +62,7 @@ func TestExtractApplications(t *testing.T) {
err = argov1alpha1.AddToScheme(scheme)
assert.Nil(t, err)

client := fake.NewFakeClientWithScheme(scheme)
client := fake.NewClientBuilder().WithScheme(scheme).Build()

for _, c := range []struct {
name string
Expand Down Expand Up @@ -343,7 +343,7 @@ func TestCreateOrUpdateInCluster(t *testing.T) {
initObjs = append(initObjs, &a)
}

client := fake.NewFakeClientWithScheme(scheme, initObjs...)
client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(initObjs...).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -536,7 +536,7 @@ func TestCreateApplications(t *testing.T) {
initObjs = append(initObjs, &a)
}

client := fake.NewFakeClientWithScheme(scheme, initObjs...)
client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(initObjs...).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -674,7 +674,7 @@ func TestDeleteInCluster(t *testing.T) {
initObjs = append(initObjs, &temp)
}

client := fake.NewFakeClientWithScheme(scheme, initObjs...)
client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(initObjs...).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -717,7 +717,7 @@ func TestGetMinRequeueAfter(t *testing.T) {
err = argov1alpha1.AddToScheme(scheme)
assert.Nil(t, err)

client := fake.NewFakeClientWithScheme(scheme)
client := fake.NewClientBuilder().WithScheme(scheme).Build()

generator := argoprojiov1alpha1.ApplicationSetGenerator{
List: &argoprojiov1alpha1.ListGenerator{},
Expand Down
3 changes: 1 addition & 2 deletions pkg/generators/cluster_test.go
Expand Up @@ -8,7 +8,6 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

Expand Down Expand Up @@ -160,7 +159,7 @@ func TestGenerateParams(t *testing.T) {
}

for _, testCase := range testCases {
fakeClient := fake.NewFakeClientWithScheme(scheme.Scheme, clusters...)
fakeClient := fake.NewClientBuilder().WithRuntimeObjects(clusters...).Build()
cl := &possiblyErroringFakeCtrlRuntimeClient{
fakeClient,
testCase.clientError,
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/git.go
Expand Up @@ -89,7 +89,7 @@ func (g *GitGenerator) generateParamsForGitFiles(appSetGenerator *argoprojiov1al

res := []map[string]string{}

for path, _ := range allPaths {
for path := range allPaths {
params, err := g.generateParamsFromGitFile(appSetGenerator, path)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions pkg/generators/git_test.go
Expand Up @@ -151,7 +151,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) {
}{
{
name: "happy flow: create params from git files",
files: []argoprojiov1alpha1.GitFileGeneratorItem{{"**/config.json"}},
files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}},
repoPaths: []string{
"cluster-config/production/config.json",
"cluster-config/staging/config.json",
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) {
},
{
name: "handles error during getting repo paths",
files: []argoprojiov1alpha1.GitFileGeneratorItem{{"**/config.json"}},
files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}},
repoPaths: []string{},
repoFileContents: map[string][]byte{},
repoPathsError: fmt.Errorf("paths error"),
Expand All @@ -210,7 +210,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) {
},
{
name: "handles error during getting repo file contents",
files: []argoprojiov1alpha1.GitFileGeneratorItem{{"**/config.json"}},
files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}},
repoPaths: []string{
"cluster-config/production/config.json",
"cluster-config/staging/config.json",
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/createOrUpdate.go
Expand Up @@ -15,7 +15,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)

// override "sigs.k8s.io/controller-runtime" CreateOrUpdate function to add equity function for argov1alpha1.ApplicationDestination
// CreateOrUpdate overrides "sigs.k8s.io/controller-runtime" function to add equality for argov1alpha1.ApplicationDestination
// argov1alpha1.ApplicationDestination has a private variable, so the default implementation fails to compare it
func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn) (controllerutil.OperationResult, error) {
key := client.ObjectKeyFromObject(obj)
Expand Down

0 comments on commit d1113ba

Please sign in to comment.