(t *testing.T)
| 152 | } |
| 153 | |
| 154 | func TestSourceRCs(t *testing.T) { |
| 155 | fs := testTempFileSource(t) |
| 156 | defer os.RemoveAll(string(fs)) |
| 157 | |
| 158 | rcFile := path.Join(string(fs), "test.rc.json") |
| 159 | |
| 160 | selector := map[string]string{"app": "example"} |
| 161 | |
| 162 | terminationPeriod := int64(30) |
| 163 | kubeRC := &kube.ReplicationController{ |
| 164 | ObjectMeta: kube.ObjectMeta{ |
| 165 | Name: "example-rc", |
| 166 | Namespace: kube.NamespaceDefault, |
| 167 | }, |
| 168 | TypeMeta: unversioned.TypeMeta{ |
| 169 | Kind: "ReplicationController", |
| 170 | APIVersion: "v1", |
| 171 | }, |
| 172 | Spec: kube.ReplicationControllerSpec{ |
| 173 | Selector: selector, |
| 174 | Replicas: 2, |
| 175 | Template: &kube.PodTemplateSpec{ |
| 176 | ObjectMeta: kube.ObjectMeta{ |
| 177 | Labels: selector, |
| 178 | }, |
| 179 | Spec: kube.PodSpec{ |
| 180 | Containers: []kube.Container{ |
| 181 | { |
| 182 | Name: "example", |
| 183 | Image: "hello-world", |
| 184 | ImagePullPolicy: kube.PullAlways, |
| 185 | TerminationMessagePath: kube.TerminationMessagePathDefault, |
| 186 | }, |
| 187 | { |
| 188 | Name: "cache", |
| 189 | Image: "redis", |
| 190 | ImagePullPolicy: kube.PullAlways, |
| 191 | TerminationMessagePath: kube.TerminationMessagePathDefault, |
| 192 | }, |
| 193 | }, |
| 194 | SecurityContext: &kube.PodSecurityContext{}, |
| 195 | RestartPolicy: kube.RestartPolicyAlways, |
| 196 | DNSPolicy: kube.DNSDefault, |
| 197 | TerminationGracePeriodSeconds: &terminationPeriod, |
| 198 | }, |
| 199 | }, |
| 200 | }, |
| 201 | } |
| 202 | |
| 203 | testWriteYAMLToFile(t, rcFile, kubeRC) |
| 204 | |
| 205 | rcs, err := fs.Entities(entity.EntityReplicationController) |
| 206 | assert.NoError(t, err, "should be okay") |
| 207 | assert.Len(t, rcs, 1, "should have single rc") |
| 208 | |
| 209 | expectedKubeRC := kubeRC |
| 210 | testClearTypeInfo(expectedKubeRC) |
| 211 | expectedKubeRC.Labels = selector |
nothing calls this directly
no test coverage detected