Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.49 KB | None | 0 0
  1. func TestReconcileKogitoDataIndex_Reconcile1(t *testing.T) {
  2.     ns := t.Name()
  3.     instance := &v1alpha1.KogitoDataIndex{
  4.         ObjectMeta: metav1.ObjectMeta{
  5.             Name:      "my-data-index",
  6.             Namespace: ns,
  7.         },
  8.         Spec: v1alpha1.KogitoDataIndexSpec{
  9.             HTTPPort:       9090,
  10.             KafkaMeta:      v1alpha1.KafkaMeta{KafkaProperties: v1alpha1.KafkaConnectionProperties{UseKogitoInfra: false}},
  11.             InfinispanMeta: v1alpha1.InfinispanMeta{InfinispanProperties: v1alpha1.InfinispanConnectionProperties{UseKogitoInfra: false}},
  12.         },
  13.     }
  14.  
  15.     client := test.CreateFakeClient([]runtime.Object{instance}, nil, nil)
  16.     r := &ReconcileKogitoDataIndex{
  17.         client: client,
  18.         scheme: meta.GetRegisteredSchema(),
  19.     }
  20.     req := reconcile.Request{
  21.         NamespacedName: types.NamespacedName{
  22.             Name:      instance.Name,
  23.             Namespace: instance.Namespace,
  24.         },
  25.     }
  26.  
  27.     // basic checks
  28.     res, err := r.Reconcile(req)
  29.     if err != nil {
  30.         t.Fatalf("reconcile: (%v)", err)
  31.     }
  32.     if res.Requeue {
  33.         t.Error("reconcile did not requeue request as expected")
  34.     }
  35.  
  36.     // check infra
  37.     infra, ready, err := infrastructure.EnsureKogitoInfra(ns, client).WithoutInfinispan().WithoutKafka().Apply()
  38.     assert.NoError(t, err)
  39.     assert.True(t, ready)
  40.     assert.NotNil(t, infra)
  41.     assert.Equal(t, infrastructure.DefaultKogitoInfraName, infra.GetName())
  42.  
  43.     statefulSet := &appsv1.StatefulSet{}
  44.     kubernetes.ResourceC(client).FetchWithKey(types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace}, statefulSet)
  45.  
  46.     fmt.Print(statefulSet)
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement