(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestRender(t *testing.T) { |
| 30 | testCases := []renderTestCase{ |
| 31 | { |
| 32 | name: "Skip deployment", |
| 33 | deploymentConfigs: map[string]*latest.DeploymentConfig{ |
| 34 | "skippedDeployment": { |
| 35 | Name: "skippedDeployment", |
| 36 | }, |
| 37 | }, |
| 38 | options: &Options{ |
| 39 | SkipDeploy: true, |
| 40 | Render: true, |
| 41 | }, |
| 42 | deploymentNames: []string{"unskippedDeployment"}, |
| 43 | }, |
| 44 | { |
| 45 | name: "No deployment method", |
| 46 | deploymentConfigs: map[string]*latest.DeploymentConfig{ |
| 47 | "noMethod": { |
| 48 | Name: "noMethod", |
| 49 | }, |
| 50 | }, |
| 51 | deploymentNames: []string{"noMethod"}, |
| 52 | options: &Options{ |
| 53 | Render: true, |
| 54 | }, |
| 55 | expectedErr: "error deploying: deployment noMethod has no deployment method", |
| 56 | }, |
| 57 | { |
| 58 | name: "Render with kubectl", |
| 59 | deploymentConfigs: map[string]*latest.DeploymentConfig{ |
| 60 | "kubectlRender": { |
| 61 | Name: "kubectlRender", |
| 62 | Kubectl: &latest.KubectlConfig{ |
| 63 | Manifests: []string{}, |
| 64 | }, |
| 65 | }, |
| 66 | }, |
| 67 | options: &Options{ |
| 68 | Render: true, |
| 69 | }, |
| 70 | deploymentNames: []string{"kubectlRender"}, |
| 71 | }, |
| 72 | } |
| 73 | |
| 74 | for _, testCase := range testCases { |
| 75 | kube := fake.NewSimpleClientset() |
| 76 | kubeClient := &fakekube.Client{ |
| 77 | Client: kube, |
| 78 | } |
| 79 | config := &latest.Config{ |
| 80 | Deployments: testCase.deploymentConfigs, |
| 81 | } |
| 82 | controller := NewController() |
| 83 | |
| 84 | if testCase.options == nil { |
| 85 | testCase.options = &Options{} |
| 86 | } |
nothing calls this directly
no test coverage detected