Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func TestReconcileKogitoDataIndex_Reconcile1(t *testing.T) {
- ns := t.Name()
- instance := &v1alpha1.KogitoDataIndex{
- ObjectMeta: metav1.ObjectMeta{
- Name: "my-data-index",
- Namespace: ns,
- },
- Spec: v1alpha1.KogitoDataIndexSpec{
- HTTPPort: 9090,
- KafkaMeta: v1alpha1.KafkaMeta{KafkaProperties: v1alpha1.KafkaConnectionProperties{UseKogitoInfra: false}},
- InfinispanMeta: v1alpha1.InfinispanMeta{InfinispanProperties: v1alpha1.InfinispanConnectionProperties{UseKogitoInfra: false}},
- },
- }
- client := test.CreateFakeClient([]runtime.Object{instance}, nil, nil)
- r := &ReconcileKogitoDataIndex{
- client: client,
- scheme: meta.GetRegisteredSchema(),
- }
- req := reconcile.Request{
- NamespacedName: types.NamespacedName{
- Name: instance.Name,
- Namespace: instance.Namespace,
- },
- }
- // basic checks
- res, err := r.Reconcile(req)
- if err != nil {
- t.Fatalf("reconcile: (%v)", err)
- }
- if res.Requeue {
- t.Error("reconcile did not requeue request as expected")
- }
- // check infra
- infra, ready, err := infrastructure.EnsureKogitoInfra(ns, client).WithoutInfinispan().WithoutKafka().Apply()
- assert.NoError(t, err)
- assert.True(t, ready)
- assert.NotNil(t, infra)
- assert.Equal(t, infrastructure.DefaultKogitoInfraName, infra.GetName())
- statefulSet := &appsv1.StatefulSet{}
- kubernetes.ResourceC(client).FetchWithKey(types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace}, statefulSet)
- fmt.Print(statefulSet)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement