|
| 1 | +--- |
| 2 | +title: QA Samples Proposal |
| 3 | +authors: |
| 4 | + - "@camilamacedo86" |
| 5 | +reviewers: |
| 6 | + - TBD |
| 7 | +approvers: |
| 8 | + - TBD |
| 9 | +creation-date: 2019-11-22 |
| 10 | +last-updated: 2019-11-22 |
| 11 | +status: implementable |
| 12 | +--- |
| 13 | + |
| 14 | +# QA Samples Proposal |
| 15 | + |
| 16 | +## Release Signoff Checklist |
| 17 | + |
| 18 | +- \[x\] Enhancement is `implementable` |
| 19 | +- \[x\] Design details are appropriately documented from clear requirements |
| 20 | +- \[x\] Test plan is defined |
| 21 | +- \[x\] Graduation criteria for dev preview, tech preview, GA |
| 22 | +- \[x\] User-facing documentation is created in [operator-sdk/doc][operator-sdk-doc] |
| 23 | + |
| 24 | +## Summary |
| 25 | + |
| 26 | +The Operator SDK has a repo with [sample projects](https://github.com/operator-framework/operator-sdk-samples |
| 27 | +). This proposal describes quality improvements in for the sample projects. |
| 28 | + |
| 29 | +## Motivation |
| 30 | + |
| 31 | +- Address issues raised in the repository such as ; [Provide docker images for the samples](https://github.com/operator-framework/operator-sdk-samples/issues/88), [Add coveralls](https://github.com/operator-framework/operator-sdk-samples/issues/89), [Add unit test to cover the project](https://github.com/operator-framework/operator-sdk-samples/issues/87), [Add CI tests](https://github.com/operator-framework/operator-sdk-samples/issues/85). |
| 32 | +- Make easier the process to review changes made for the projects |
| 33 | +- Help users know how they can achieve common good practices |
| 34 | + |
| 35 | +## Goals |
| 36 | + |
| 37 | +- As a maintainer, I would like to ensure that samples projects continue to work after the changes performed in the PR are applied |
| 38 | +- As an operator developer, I would like to know how to cover the projects with tests |
| 39 | +- As an operator developer, I would like to know how to use the [test-framework](https://github.com/operator-framework/operator-sdk/blob/master/doc/test-framework/writing-e2e-tests.md)to do unit and integration tests |
| 40 | +- As an operator developer, I would like to know how to call the tests in the CI and integrate them with Travis |
| 41 | +- As an operator developer, I would like to know good practices to ensure the quality of my operators projects |
| 42 | + |
| 43 | +**NOTE** The above goals are valid for the 3 types/projects Go, Ansible and Helm |
| 44 | + |
| 45 | +### Non-Goals |
| 46 | + |
| 47 | +- Change the code business logic implementation of the projects |
| 48 | + |
| 49 | +## Proposal |
| 50 | + |
| 51 | +- Cover the projects with unit and integration tests. |
| 52 | +- Integrate projects with Travis |
| 53 | +- Integrate projects with Coveralls |
| 54 | + |
| 55 | +### User Stories |
| 56 | + |
| 57 | +#### Unit tests for Go Memcached Sample |
| 58 | + |
| 59 | +- I as a GO operator developer, I would like to know how to cover the projects with unit tests using the test-framework |
| 60 | + |
| 61 | +**Acceptance Criteria** |
| 62 | +- The GO project should have a minimum of 70% of its implementation covered by unit tests. |
| 63 | +- The tests should all pass. |
| 64 | +- The project should have a makefile target to call the tests |
| 65 | +- A section with a short info over how to tests and the links for its documents in the README of the project |
| 66 | +- The tests should be done using the default GO testing lib and the [test-framework](https://github.com/operator-framework/operator-sdk/blob/master/doc/test-framework/writing-e2e-tests.md)provided by SDK |
| 67 | + |
| 68 | +**NOTES** |
| 69 | +- See [here](https://github.com/dev4devs-com/postgresql-operator/blob/master/pkg/controller/database/controller_test.go) an example of how to cover the controller. |
| 70 | +- See [here](https://github.com/dev4devs-com/postgresql-operator/blob/master/pkg/controller/database/fakeclient_test.go) an example of how to create the fake client. |
| 71 | + |
| 72 | +#### e2e tests for Go Memcached Sample |
| 73 | + |
| 74 | +- I as a Go dev operator user, I'd like to know how to cover the projects with integration tests using the test-framework |
| 75 | + |
| 76 | +**Acceptance Criteria** |
| 77 | +- The GO project should be covered with a few basic integration tests |
| 78 | +- The tests should all pass. |
| 79 | +- The project should have a makefile target to call the integration test |
| 80 | +- A section with a short info over how to tests and the links for its documents in the README of the project |
| 81 | +- The tests should be done using the default GO testing lib and the [test-framework](https://github.com/operator-framework/operator-sdk/blob/master/doc/test-framework/writing-e2e-tests.md) provided by SDK |
| 82 | + |
| 83 | +#### Unit tests for Ansible Memcached Sample |
| 84 | + |
| 85 | +- As an Ansible operator developer, I would like to know how to cover the projects with unit tests using molecule |
| 86 | + |
| 87 | +**Acceptance Criteria** |
| 88 | +- The Ansible project should be covered by tests using [molecule](https://github.com/operator-framework/operator-sdk-samples/tree/master/ansible/memcached-operator/molecule) which by default is scaffold |
| 89 | +- The tests should all pass. |
| 90 | +- A section with a short info over how to tests and the links for its documents in the README of the project |
| 91 | +- The project should have a makefile target to call the tests |
| 92 | + |
| 93 | +#### tests for Helm Memcached Sample |
| 94 | + |
| 95 | +- As an Helm operator developer, I would like to how to cover the projects with tests |
| 96 | + |
| 97 | +**Acceptance Criteria** |
| 98 | +- The Helm project should have test shell scripts as seen [here](https://github.com/operator-framework/operator-sdk/blob/master/hack/tests/e2e-helm.sh).- The tests should all pass. |
| 99 | +- A section with a short info over how to tests and the links for its documents in the README of the project |
| 100 | +- The project should have a makefile target to call the tests |
| 101 | + |
| 102 | + |
| 103 | +#### e2e tests for Ansible Memcached Sample |
| 104 | + |
| 105 | +- As an Ansible operator developer, I'd like to how to cover the projects with integration tests using molecule |
| 106 | + |
| 107 | +**Acceptance Criteria** |
| 108 | +- The Ansible project should have a few integration tests using [molecule](https://github.com/operator-framework/operator-sdk-samples/tree/master/ansible/memcached-operator/molecule) which by default is scaffold |
| 109 | +- The tests should all pass. |
| 110 | +- A section with a short info over how to tests and the links for its documents in the README of the project |
| 111 | +- The project should have a makefile target to call the tests |
| 112 | + |
| 113 | +#### Travis Integration |
| 114 | + |
| 115 | +- As an operator-sdk maintainer, I would like ensure that samples continue to work after the changes performed in the PR are applied. |
| 116 | +- As an operator developer, I would like to know how to call the tests in the CI and integrate them with Travis |
| 117 | + |
| 118 | +**Acceptance Criteria** |
| 119 | +- The Ansible, Helm and Go project should be integrated with Travis |
| 120 | +- All PRs against the master branch should trigger the CI |
| 121 | +- The unit and integration tests should be checked in the CI |
| 122 | +- The CI should fail if one of the tests do not pass |
| 123 | + |
| 124 | +#### Coveralls Integration |
| 125 | + |
| 126 | +- As an operator developer, I'd like to know good practices to ensure the quality of my operators projects |
| 127 | + |
| 128 | +**Acceptance Criteria** |
| 129 | +- Ansible and GO Memcached samples should be integrated with [Coveralls](https://coveralls.io/) |
| 130 | +- All above stories should be achieved successfully |
| 131 | + |
| 132 | +### Risks and Mitigations |
| 133 | + |
| 134 | +[Coveralls](https://coveralls.io/) may not work well with [molecule](https://github.com/operator-framework/operator-sdk-samples/tree/master/ansible/memcached-operator/molecule), if this is the case we can just not integrate with it or we can find a similar tool. |
| 135 | + |
| 136 | +[operator-sdk-doc]: ../../doc |
0 commit comments