@@ -21,6 +21,7 @@ func TestCalculateReadyCondition(t *testing.T) {
2121 {Type : TypeSourceReady , Status : metav1 .ConditionTrue , Reason : "CloneSucceeded" },
2222 {Type : TypeDeployed , Status : metav1 .ConditionTrue , Reason : "DeploySucceeded" },
2323 {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionTrue , Reason : "UpToDate" },
24+ {Type : TypeServiceReady , Status : metav1 .ConditionTrue , Reason : "ServiceReady" },
2425 },
2526 expectedStatus : metav1 .ConditionTrue ,
2627 expectedReason : "ReconcileSucceeded" ,
@@ -31,6 +32,7 @@ func TestCalculateReadyCondition(t *testing.T) {
3132 {Type : TypeSourceReady , Status : metav1 .ConditionTrue , Reason : "CloneSucceeded" },
3233 {Type : TypeDeployed , Status : metav1 .ConditionFalse , Reason : "DeployFailed" , Message : "deployment failed" },
3334 {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionTrue , Reason : "UpToDate" },
35+ {Type : TypeServiceReady , Status : metav1 .ConditionTrue , Reason : "ServiceReady" },
3436 },
3537 expectedStatus : metav1 .ConditionFalse ,
3638 expectedReason : "DeployFailed" ,
@@ -42,6 +44,7 @@ func TestCalculateReadyCondition(t *testing.T) {
4244 {Type : TypeSourceReady , Status : metav1 .ConditionTrue , Reason : "CloneSucceeded" },
4345 {Type : TypeDeployed , Status : metav1 .ConditionUnknown , Reason : "NotChecked" , Message : "deployment not checked yet" },
4446 {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionTrue , Reason : "UpToDate" },
47+ {Type : TypeServiceReady , Status : metav1 .ConditionTrue , Reason : "ServiceReady" },
4548 },
4649 expectedStatus : metav1 .ConditionFalse ,
4750 expectedReason : "NotChecked" ,
@@ -53,6 +56,7 @@ func TestCalculateReadyCondition(t *testing.T) {
5356 {Type : TypeSourceReady , Status : metav1 .ConditionUnknown , Reason : "NotCloned" , Message : "source not cloned yet" },
5457 {Type : TypeDeployed , Status : metav1 .ConditionUnknown , Reason : "NotDeployed" , Message : "not deployed yet" },
5558 {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionTrue , Reason : "UpToDate" },
59+ {Type : TypeServiceReady , Status : metav1 .ConditionTrue , Reason : "ServiceReady" },
5660 },
5761 expectedStatus : metav1 .ConditionFalse ,
5862 expectedReason : "NotCloned" ,
@@ -64,6 +68,7 @@ func TestCalculateReadyCondition(t *testing.T) {
6468 {Type : TypeSourceReady , Status : metav1 .ConditionUnknown , Reason : "NotCloned" , Message : "source not cloned yet" },
6569 {Type : TypeDeployed , Status : metav1 .ConditionFalse , Reason : "DeployFailed" , Message : "deployment failed" },
6670 {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionTrue , Reason : "UpToDate" },
71+ {Type : TypeServiceReady , Status : metav1 .ConditionTrue , Reason : "ServiceReady" },
6772 },
6873 expectedStatus : metav1 .ConditionFalse ,
6974 expectedReason : "DeployFailed" ,
@@ -75,10 +80,23 @@ func TestCalculateReadyCondition(t *testing.T) {
7580 {Type : TypeSourceReady , Status : metav1 .ConditionUnknown , Reason : "unknown" , Message : "" },
7681 {Type : TypeDeployed , Status : metav1 .ConditionUnknown , Reason : "unknown" , Message : "" },
7782 {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionUnknown , Reason : "unknown" , Message : "" },
83+ {Type : TypeServiceReady , Status : metav1 .ConditionUnknown , Reason : "unknown" , Message : "" },
7884 },
7985 expectedStatus : metav1 .ConditionFalse ,
8086 expectedReason : "unknown" ,
8187 },
88+ {
89+ name : "service not ready makes overall not ready" ,
90+ conditions : []metav1.Condition {
91+ {Type : TypeSourceReady , Status : metav1 .ConditionTrue , Reason : "CloneSucceeded" },
92+ {Type : TypeDeployed , Status : metav1 .ConditionTrue , Reason : "DeploySucceeded" },
93+ {Type : TypeMiddlewareUpToDate , Status : metav1 .ConditionTrue , Reason : "UpToDate" },
94+ {Type : TypeServiceReady , Status : metav1 .ConditionFalse , Reason : "ServiceNotReady" , Message : "Underlying service is not ready" },
95+ },
96+ expectedStatus : metav1 .ConditionFalse ,
97+ expectedReason : "ServiceNotReady" ,
98+ expectedMessage : "Underlying service is not ready" ,
99+ },
82100 }
83101
84102 for _ , tt := range tests {
0 commit comments