Skip to content

Commit c1a026f

Browse files
committed
Update controller e2e tests
Signed-off-by: Sunny <[email protected]>
1 parent c43e6bf commit c1a026f

File tree

6 files changed

+926
-1302
lines changed

6 files changed

+926
-1302
lines changed

internal/controller/controllers_fuzzer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import (
5757
"github.com/fluxcd/pkg/runtime/testenv"
5858
sourcev1 "github.com/fluxcd/source-controller/api/v1"
5959

60-
image_automationv1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
60+
image_automationv1 "github.com/fluxcd/image-automation-controller/api/v1beta2"
6161
"github.com/fluxcd/image-automation-controller/pkg/update"
6262
)
6363

internal/controller/imageupdateautomation_controller_test.go

+15-13
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,22 @@ limitations under the License.
1616

1717
package controller
1818

19-
import (
20-
"testing"
19+
// import (
20+
// "testing"
2121

22-
fuzz "github.com/AdaLogics/go-fuzz-headers"
23-
)
22+
// fuzz "github.com/AdaLogics/go-fuzz-headers"
2423

25-
func Fuzz_templateMsg(f *testing.F) {
26-
f.Add("template", []byte{})
27-
f.Add("", []byte{})
24+
// "github.com/fluxcd/image-automation-controller/internal/source"
25+
// )
2826

29-
f.Fuzz(func(t *testing.T, template string, seed []byte) {
30-
var values TemplateData
31-
fuzz.NewConsumer(seed).GenerateStruct(&values)
27+
// func Fuzz_templateMsg(f *testing.F) {
28+
// f.Add("template", []byte{})
29+
// f.Add("", []byte{})
3230

33-
_, _ = templateMsg(template, &values)
34-
})
35-
}
31+
// f.Fuzz(func(t *testing.T, template string, seed []byte) {
32+
// var values source.TemplateData
33+
// fuzz.NewConsumer(seed).GenerateStruct(&values)
34+
35+
// _, _ = templateMsg(template, &values)
36+
// })
37+
// }

internal/controller/suite_test.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
2828
"k8s.io/client-go/kubernetes/scheme"
29+
"k8s.io/client-go/tools/record"
2930
ctrl "sigs.k8s.io/controller-runtime"
3031
"sigs.k8s.io/controller-runtime/pkg/client"
3132

@@ -34,7 +35,7 @@ import (
3435
"github.com/fluxcd/pkg/runtime/testenv"
3536
sourcev1 "github.com/fluxcd/source-controller/api/v1"
3637

37-
imagev1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
38+
imagev1 "github.com/fluxcd/image-automation-controller/api/v1beta2"
3839
// +kubebuilder:scaffold:imports
3940
)
4041

@@ -85,9 +86,10 @@ func runTestsWithFeatures(m *testing.M, feats map[string]bool) int {
8586

8687
controllerName := "image-automation-controller"
8788
if err := (&ImageUpdateAutomationReconciler{
88-
Client: testEnv,
89-
EventRecorder: testEnv.GetEventRecorderFor(controllerName),
90-
features: feats,
89+
Client: testEnv,
90+
EventRecorder: record.NewFakeRecorder(32),
91+
features: feats,
92+
ControllerName: controllerName,
9193
}).SetupWithManager(ctx, testEnv, ImageUpdateAutomationReconcilerOptions{
9294
RateLimiter: controller.GetDefaultRateLimiter(),
9395
}); err != nil {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: update-no
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: hello
10+
image: helloworld:1.0.0 # SETTER_SITE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: update-yes
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: hello
10+
image: helloworld:1.0.1 # SETTER_SITE

0 commit comments

Comments
 (0)