blob: 4c0d38d9928f9393ec3a61581a2eaa9f6a7ef254 [file] [log] [blame]
Tommy Carpenter42493982019-11-06 07:27:16 -05001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
Tommy Carpentercc2250a2019-05-30 15:06:37 -04003
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -04004A1 Developer Guide
5==================
Tommy Carpenter42493982019-11-06 07:27:16 -05006
7.. contents::
8 :depth: 3
9 :local:
Tommy Carpenter5ad8f032019-05-30 14:33:21 -040010
11Tech Stack
Tommy Carpenter42493982019-11-06 07:27:16 -050012----------
Tommy Carpenter5ad8f032019-05-30 14:33:21 -040013
14- OpenAPI3
15- Connexion
16- Flask with Gevent serving
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040017- Python3.8
Tommy Carpenter5ad8f032019-05-30 14:33:21 -040018
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040019Version bumping A1
20------------------
Tommy Carpenter5ad8f032019-05-30 14:33:21 -040021
22This project follows semver. When changes are made, the versions are in:
23
241) ``docs/release-notes.rst``
25
262) ``setup.py``
27
Tommy Carpenter810fcb72019-06-05 12:42:52 -0400283) ``container-tag.yaml``
29
Lott, Christopher (cl778h)438a0a62019-06-18 06:50:13 -0400304) ``integration_tests/a1mediator/Chart.yaml``
Tommy Carpenter18dcbc32019-06-04 10:20:30 -040031
Tommy Carpenter45f8f982020-03-06 09:41:57 -0500325) ``a1/openapi.yaml`` (this is an API version, not a software version; no need to bump on patch changes)
Tommy Carpenter5ad8f032019-05-30 14:33:21 -040033
Tommy Carpenter45f8f982020-03-06 09:41:57 -0500346) in the ric-plt repo that contains a1 helm chart, ``values.yaml``, ``Chart.yml``
Tommy Carpenter971c91c2019-06-12 09:25:48 -040035
Lott, Christopher (cl778h)d5024702019-08-20 15:22:45 -040036
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040037Version bumping RMR
Tommy Carpenter78ba2732020-02-07 14:06:20 -050038-------------------
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040039
Lott, Christopher (cl778h)d26734f2020-04-27 17:25:05 -040040As of 2020/02/13, A1 (Dockerfile), Dockerfile-Unit-Test, and all three
41integration test receivers use an Alpine base image and install RMR
42from a base builder image. Must update and rebuild all 5 containers
43in the A1 repo (or just A1 itself for prod usage).
Tommy Carpenter102b8952020-03-20 10:02:46 -040044
Lott, Christopher (cl778h)d26734f2020-04-27 17:25:05 -040045In addition these items in this repo must be kept in sync:
46* ``rmr-version.yaml`` controls what rmr gets installed for unit testing in Jenkins
47* ``integration_tests/install_rmr.sh`` is a useful script for a variety of local testing.
Lott, Christopher (cl778h)d5024702019-08-20 15:22:45 -040048
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040049Version bumping Python
50----------------------
51
Tommy Carpenter102b8952020-03-20 10:02:46 -040052If you want to update the version of python itself (ie just done from 37 to 38):
Tommy Carpenter8bcc51a2019-10-21 16:07:31 -040053
Tommy Carpenter102b8952020-03-20 10:02:46 -0400541) ``Dockerfile``
Tommy Carpenter9d5ad712019-12-02 11:02:01 -050055
Tommy Carpenter102b8952020-03-20 10:02:46 -0400562) ``Dockerfile-Unit-Test``
Tommy Carpenter8bcc51a2019-10-21 16:07:31 -040057
Tommy Carpenter102b8952020-03-20 10:02:46 -0400583) ``tox.ini``
Lott, Christopher (cl778h)d5024702019-08-20 15:22:45 -040059
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040060Unit Testing
Tommy Carpenter42493982019-11-06 07:27:16 -050061------------
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040062
Lott, Christopher (cl778h)d26734f2020-04-27 17:25:05 -040063Note, before this will work, for the first time on the machine running
64the tests, run ``./install_deps.sh``. This is only needed once on the
65machine. Also, this requires the python packages ``tox`` and
66``pytest``.
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040067
68::
69
70 tox
71 open htmlcov/index.html
72
Lott, Christopher (cl778h)d26734f2020-04-27 17:25:05 -040073Alternatively, you can run the unit tests in Docker (this is somewhat
74less nice because you don't get the pretty HTML)
Tommy Carpenter296f8de2019-08-07 11:38:44 -040075
76::
77
78 docker build --no-cache -t a1test:latest -f Dockerfile-Unit-Test
79
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040080Integration testing
Tommy Carpenter42493982019-11-06 07:27:16 -050081-------------------
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040082
Lott, Christopher (cl778h)d26734f2020-04-27 17:25:05 -040083This tests A1’s external API with three test receivers. This requires
84docker, kubernetes and helm.
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040085
Lott, Christopher (cl778h)75d92b72020-04-24 11:52:42 -040086Build all the images:
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040087
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040088::
89
Lott, Christopher (cl778h)75d92b72020-04-24 11:52:42 -040090 docker build -t a1:latest .
91 cd integration_tests/testxappcode
92 docker build -t delayreceiver:latest -f Dockerfile-delay-receiver .
93 docker build -t queryreceiver:latest -f Dockerfile-query-receiver .
94 docker build -t testreceiver:latest -f Dockerfile-test-receiver .
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040095
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040096
Tommy Carpenter9d5ad712019-12-02 11:02:01 -050097Then, run all the tests from the root (this requires the python packages ``tox``, ``pytest``, and ``tavern``).
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040098
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -040099::
100
101 tox -c tox-integration.ini
102
103This script:
Tommy Carpenter2c1c4e92020-04-07 08:36:42 -04001041. Deploys 3 helm charts (5 containers) into a local kubernetes installation
Tommy Carpenter7dbbfbc2019-06-18 09:58:55 -04001052. Port forwards a pod ClusterIP to localhost
1063. Uses “tavern” to run some tests against the server
1074. Barrages the server with apache bench
1085. Tears everything down