Skip to content

Commit

Permalink
controller: add more tests for flavor merge
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheu committed Jan 22, 2024
1 parent 25278c0 commit 449357b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions controllers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,17 @@ func TestReconcileRpaasInstance_getRpaasInstance(t *testing.T) {
Namespace: "default",
},
Spec: v1alpha1.RpaasFlavorSpec{
Default: true,
InstanceTemplate: &v1alpha1.RpaasInstanceSpec{
DNS: &v1alpha1.DNSConfig{
Zone: "apps.example.com",
TTL: func(n int32) *int32 { return &n }(300),
},
PodTemplate: nginxv1alpha1.NginxPodTemplateSpec{
Annotations: map[string]string{
"rpaas.extensions.tsuru.io/is-default-pod-annotation": "true",
},
},
},
},
},
Expand Down Expand Up @@ -530,6 +536,11 @@ func TestReconcileRpaasInstance_getRpaasInstance(t *testing.T) {
Zone: "apps.test",
TTL: func(n int32) *int32 { return &n }(30),
}
i.Spec.PodTemplate = nginxv1alpha1.NginxPodTemplateSpec{
Annotations: map[string]string{
"rpaas.extensions.tsuru.io/is-default-pod-annotation": "true",
},
}
return i
},
},
Expand Down Expand Up @@ -721,6 +732,21 @@ func TestReconcileRpaasInstance_getRpaasInstance(t *testing.T) {
},
},
},
&v1alpha1.RpaasFlavor{
ObjectMeta: metav1.ObjectMeta{
Name: "flavor-d",
Namespace: "default",
},
Spec: v1alpha1.RpaasFlavorSpec{
InstanceTemplate: &v1alpha1.RpaasInstanceSpec{
PodTemplate: nginxv1alpha1.NginxPodTemplateSpec{
Annotations: map[string]string{
"donotuse.tsuru.io": "flavor-d",
},
},
},
},
},
},
instance: func(i *v1alpha1.RpaasInstance) *v1alpha1.RpaasInstance {
i.Spec.Flavors = []string{"flavor-a", "flavor-b", "flavor-c"}
Expand Down

0 comments on commit 449357b

Please sign in to comment.