Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
  • Loading branch information
odubajDT committed May 25, 2023
1 parent 59deac4 commit 41ddd04
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,41 @@ func TestKeptnAppVersionReconciler_reconcileWorkloads(t *testing.T) {
},
}, appVersion.Status.WorkloadStatus)
}

func TestKeptnAppVersionReconciler_handleUnaccessibleWorkloadInstanceList(t *testing.T) {
appVersion := &lfcv1alpha3.KeptnAppVersion{
ObjectMeta: v1.ObjectMeta{
Name: "appversion",
Namespace: "default",
},
Spec: lfcv1alpha3.KeptnAppVersionSpec{
KeptnAppSpec: lfcv1alpha3.KeptnAppSpec{
Workloads: []lfcv1alpha3.KeptnWorkloadRef{
{
Name: "workload",
Version: "ver1",
},
},
},
AppName: "app",
},
}
r, _, _, _ := setupReconciler(appVersion)

err := r.handleUnaccessibleWorkloadInstanceList(context.TODO(), appVersion)
require.Nil(t, err)

err = r.Client.Get(context.TODO(), types.NamespacedName{Namespace: appVersion.Namespace, Name: appVersion.Name}, appVersion)
require.Nil(t, err)
require.Equal(t, apicommon.StateUnknown, appVersion.Status.WorkloadOverallStatus)
require.Len(t, appVersion.Status.WorkloadStatus, 1)
require.Equal(t, []lfcv1alpha3.WorkloadStatus{
{
Workload: lfcv1alpha3.KeptnWorkloadRef{
Name: "workload",
Version: "ver1",
},
Status: apicommon.StateUnknown,
},
}, appVersion.Status.WorkloadStatus)
}

0 comments on commit 41ddd04

Please sign in to comment.