Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint files with 'integration' build flag #1508

Merged
merged 17 commits into from May 18, 2020
Merged
2 changes: 2 additions & 0 deletions .golangci.yml
Expand Up @@ -16,6 +16,8 @@ linters:
- goconst
- lll
run:
build-tags:
- integration
skip-dirs:
# autogenerated clientset by client-gen
- pkg/client
Expand Down
7 changes: 5 additions & 2 deletions pkg/controller/instance/instance_controller_test.go
Expand Up @@ -74,7 +74,6 @@ func TestRestartController(t *testing.T) {
}
instanceKey, _ := client.ObjectKeyFromObject(in)
assert.NoError(t, c.Create(context.TODO(), in))
defer c.Delete(context.TODO(), in)

ov := &v1beta1.OperatorVersion{
ObjectMeta: metav1.ObjectMeta{Name: "foo-operator", Namespace: "default"},
Expand All @@ -90,7 +89,6 @@ func TestRestartController(t *testing.T) {
},
}
assert.NoError(t, c.Create(context.TODO(), ov))
defer c.Delete(context.TODO(), ov)

log.Print("And a deploy plan that was already run")
assert.Eventually(t, func() bool { return instancePlanFinished(instanceKey, "deploy", c) }, timeout, tick)
Expand Down Expand Up @@ -140,6 +138,7 @@ func startTestManager(t *testing.T) (chan struct{}, *sync.WaitGroup, client.Clie
Recorder: mgr.GetEventRecorderFor("instance-controller"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr)
assert.NoError(t, err, "Error when setting up manager")

stop := make(chan struct{})
wg := &sync.WaitGroup{}
Expand Down Expand Up @@ -326,6 +325,8 @@ func Test_makePipes(t *testing.T) {
}

for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
got, err := PipesMap(tt.planName, tt.plan, tt.tasks, tt.emeta)
if err != nil {
Expand Down Expand Up @@ -553,6 +554,8 @@ func Test_fetchNewExecutionPlan(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
got, err := fetchNewExecutionPlan(tt.i, tt.ov)
assert.Equal(t, tt.wantErr, err != nil, "expected error %v, but got %v", tt.wantErr, err)
Expand Down