(t *testing.T)
| 110 | }) |
| 111 | |
| 112 | func TestGetWorkersAsStatefulset(t *testing.T) { |
| 113 | |
| 114 | statefulsetInputs := []*appsv1.StatefulSet{ |
| 115 | { |
| 116 | ObjectMeta: metav1.ObjectMeta{ |
| 117 | Name: "sts-jindofs-worker", |
| 118 | Namespace: "big-data", |
| 119 | }, |
| 120 | Spec: appsv1.StatefulSetSpec{ |
| 121 | Replicas: ptr.To[int32](2), |
| 122 | }, |
| 123 | Status: appsv1.StatefulSetStatus{ |
| 124 | ReadyReplicas: 1, |
| 125 | }, |
| 126 | }, |
| 127 | } |
| 128 | |
| 129 | daemonsetInputs := []*appsv1.DaemonSet{ |
| 130 | { |
| 131 | ObjectMeta: metav1.ObjectMeta{ |
| 132 | Name: "ds-jindofs-worker", |
| 133 | Namespace: "big-data", |
| 134 | }, |
| 135 | }, |
| 136 | } |
| 137 | |
| 138 | objs := []runtime.Object{} |
| 139 | |
| 140 | for _, runtimeInput := range daemonsetInputs { |
| 141 | objs = append(objs, runtimeInput.DeepCopy()) |
| 142 | } |
| 143 | for _, statefulsetInput := range statefulsetInputs { |
| 144 | objs = append(objs, statefulsetInput.DeepCopy()) |
| 145 | } |
| 146 | |
| 147 | s := runtime.NewScheme() |
| 148 | _ = appsv1.AddToScheme(s) |
| 149 | fakeClient := fake.NewFakeClientWithScheme(s, objs...) |
| 150 | testCases := []struct { |
| 151 | name string |
| 152 | key types.NamespacedName |
| 153 | success bool |
| 154 | deprecatedError bool |
| 155 | }{ |
| 156 | { |
| 157 | name: "noError", |
| 158 | key: types.NamespacedName{ |
| 159 | Name: "sts-jindofs-worker", |
| 160 | Namespace: "big-data", |
| 161 | }, |
| 162 | success: true, |
| 163 | deprecatedError: false, |
| 164 | }, { |
| 165 | name: "deprecatedError", |
| 166 | key: types.NamespacedName{ |
| 167 | Name: "ds-jindofs-worker", |
| 168 | Namespace: "big-data", |
| 169 | }, |
nothing calls this directly
no test coverage detected