|
| 1 | +--- |
| 2 | +title: "Building / Testing" |
| 3 | +weight: 4 |
| 4 | +--- |
| 5 | + |
| 6 | +Java 11+ is required to build and test the code. |
| 7 | + |
| 8 | +Docker is required to run the integration test suite. |
| 9 | + |
| 10 | +## Building (unit tests only) |
| 11 | + |
| 12 | +### Commands |
| 13 | + |
| 14 | +```shell |
| 15 | +git clone https://github.com/prometheus/jmx_exporter |
| 16 | +cd jmx_exporter |
| 17 | +./mvnw clean package |
| 18 | +``` |
| 19 | + |
| 20 | +### Example Output |
| 21 | + |
| 22 | +```shell |
| 23 | +... |
| 24 | +[INFO] Reactor Summary for Prometheus JMX Exporter <VERSION>: |
| 25 | +[INFO] |
| 26 | +[INFO] Prometheus JMX Exporter ............................ SUCCESS [ 1.049 s] |
| 27 | +[INFO] Prometheus JMX Exporter - Collector ................ SUCCESS [ 12.947 s] |
| 28 | +[INFO] Prometheus JMX Exporter - Common ................... SUCCESS [ 3.792 s] |
| 29 | +[INFO] Prometheus JMX Exporter - Java Agent ............... SUCCESS [ 44.846 s] |
| 30 | +[INFO] Prometheus JMX Exporter - Standalone Server ........ SUCCESS [ 7.049 s] |
| 31 | +[INFO] Prometheus JMX Exporter - Integration Test Suite ... SUCCESS [ 0.278 s] |
| 32 | +[INFO] Prometheus JMX Exporter - JMX Example Application .. SUCCESS [ 1.925 s] |
| 33 | +[INFO] Prometheus JMX Exporter - Integration Tests ........ SUCCESS [ 4.505 s] |
| 34 | +[INFO] ------------------------------------------------------------------------ |
| 35 | +[INFO] BUILD SUCCESS |
| 36 | +[INFO] ------------------------------------------------------------------------ |
| 37 | +[INFO] Total time: 01:17 min |
| 38 | +[INFO] Finished at: 2024-12-02T13:39:20-05:00 |
| 39 | +[INFO] ------------------------------------------------------------------------ |
| 40 | +``` |
| 41 | + |
| 42 | +## Integration Testing (smoke test containers) |
| 43 | + |
| 44 | +Integration tests use [Verifyica](https://github.com/verifyica-team/verifyica) for integration testing. |
| 45 | + |
| 46 | +Integration tests require Docker configuration changes due to parallel testing/the number of Docker networks used during testing. |
| 47 | + |
| 48 | +**Integration testing time using smoke test containers varies based on your machine specifications.** |
| 49 | + |
| 50 | +- **~7 minutes on an AMD Ryzen 9 7900 with an NVMe drive** |
| 51 | +- **~20 minutes using a standard GitHub action runner** |
| 52 | + |
| 53 | +**Notes** |
| 54 | + |
| 55 | +- You may need to set up your Docker hub login to pull images |
| 56 | + |
| 57 | +### Docker Configuration |
| 58 | + |
| 59 | +Create a Docker `daemon.json` file. |
| 60 | + |
| 61 | +```shell |
| 62 | +/etc/docker/daemon.json |
| 63 | +``` |
| 64 | + |
| 65 | +```yaml |
| 66 | +{ |
| 67 | + "default-address-pools" : [ |
| 68 | + { |
| 69 | + "base" : "172.16.0.0/16", |
| 70 | + "size" : 24 |
| 71 | + }, |
| 72 | + { |
| 73 | + "base" : "192.168.0.0/16", |
| 74 | + "size" : 24 |
| 75 | + } |
| 76 | + ] |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +Restart Docker. |
| 81 | + |
| 82 | +### Commands |
| 83 | + |
| 84 | +```shell |
| 85 | +git clone https://github.com/prometheus/jmx_exporter |
| 86 | +cd jmx_exporter |
| 87 | +./integration_test_suite/pull-smoke-test-docker-images.sh |
| 88 | +./mvnw clean verify |
| 89 | +``` |
| 90 | + |
| 91 | +**Notes** |
| 92 | + |
| 93 | +- The `smoke-test.sh` shell script can be used to build and run the integration test suite using smoke test containers. |
| 94 | + - `./smoke-test.sh` |
| 95 | +- Output is captured and logged to `smoke-test.log`. |
| 96 | + |
| 97 | +### Example Output |
| 98 | + |
| 99 | +```shell |
| 100 | +[INFO] ------------------------------------------------------------------------ |
| 101 | +[INFO] Verifyica 0.7.2 Summary (2024-12-02T13:53:18-05:00) |
| 102 | +[INFO] ------------------------------------------------------------------------ |
| 103 | +[INFO] Test classes : 40 Passed : 40 Failed : 0 Skipped : 0 |
| 104 | +[INFO] Test arguments : 506 Passed : 506 Failed : 0 Skipped : 0 |
| 105 | +[INFO] Test methods : 2302 Passed : 2302 Failed : 0 Skipped : 0 |
| 106 | +[INFO] |
| 107 | +[INFO] ------------------------------------------------------------------------ |
| 108 | +[INFO] TESTS PASSED |
| 109 | +[INFO] ------------------------------------------------------------------------ |
| 110 | +[INFO] Compact Summary | 40 40 0 0 | 506 506 0 0 | 2302 2302 0 0 | 387351.971080 ms | P |
| 111 | +[INFO] ------------------------------------------------------------------------ |
| 112 | +[INFO] Total time : 6 m, 27 s, 351 ms (387351.97108 ms) |
| 113 | +[INFO] Finished at : 2024-12-02T13:59:47-05:00 |
| 114 | +[INFO] ------------------------------------------------------------------------ |
| 115 | +[INFO] ------------------------------------------------------------------------ |
| 116 | +[INFO] Reactor Summary for Prometheus JMX Exporter <VERSION>>: |
| 117 | +[INFO] |
| 118 | +[INFO] Prometheus JMX Exporter ............................ SUCCESS [ 0.755 s] |
| 119 | +[INFO] Prometheus JMX Exporter - Collector ................ SUCCESS [ 9.543 s] |
| 120 | +[INFO] Prometheus JMX Exporter - Common ................... SUCCESS [ 3.092 s] |
| 121 | +[INFO] Prometheus JMX Exporter - Java Agent ............... SUCCESS [ 35.511 s] |
| 122 | +[INFO] Prometheus JMX Exporter - Standalone Server ........ SUCCESS [ 5.672 s] |
| 123 | +[INFO] Prometheus JMX Exporter - Integration Test Suite ... SUCCESS [ 0.259 s] |
| 124 | +[INFO] Prometheus JMX Exporter - JMX Example Application .. SUCCESS [ 1.488 s] |
| 125 | +[INFO] Prometheus JMX Exporter - Integration Tests ........ SUCCESS [06:42 min] |
| 126 | +[INFO] ------------------------------------------------------------------------ |
| 127 | +[INFO] BUILD SUCCESS |
| 128 | +[INFO] ------------------------------------------------------------------------ |
| 129 | +[INFO] Total time: 07:39 min |
| 130 | +[INFO] Finished at: 2024-12-02T13:59:47-05:00 |
| 131 | +[INFO] ------------------------------------------------------------------------ |
| 132 | +``` |
| 133 | + |
| 134 | +## Integration Tests (all test containers) |
| 135 | + |
| 136 | +Integration tests use [Verifyica](https://github.com/verifyica-team/verifyica) for integration testing. |
| 137 | + |
| 138 | +Integration tests require Docker configuration changes due to parallel testing/the number of Docker networks used during testing. |
| 139 | + |
| 140 | +**Integration testing using all test containers requires SIGNIFICANT time and disk space.** |
| 141 | + |
| 142 | +- **~100 Docker containers (Java and Prometheus containers)** |
| 143 | +- **~2 hours on an AMD Ryzen 9 7900 + NVMe** |
| 144 | +- **3+ hours on a Dual Intel Xeon CPU E5-2680 v4** |
| 145 | + |
| 146 | +**Notes** |
| 147 | + |
| 148 | +- You may need to set up your Docker hub login to pull images |
| 149 | + |
| 150 | +### Docker Configuration |
| 151 | + |
| 152 | +Create or edit... |
| 153 | + |
| 154 | +```shell |
| 155 | +/etc/docker/daemon.json |
| 156 | +``` |
| 157 | + |
| 158 | +**Content** |
| 159 | + |
| 160 | +```yaml |
| 161 | +{ |
| 162 | + "default-address-pools" : [ |
| 163 | + { |
| 164 | + "base" : "172.16.0.0/16", |
| 165 | + "size" : 24 |
| 166 | + }, |
| 167 | + { |
| 168 | + "base" : "192.168.0.0/16", |
| 169 | + "size" : 24 |
| 170 | + } |
| 171 | + ] |
| 172 | +} |
| 173 | +``` |
| 174 | + |
| 175 | +Restart Docker. |
| 176 | + |
| 177 | +### Commands |
| 178 | + |
| 179 | +```shell |
| 180 | +git clone https://github.com/prometheus/jmx_exporter |
| 181 | +cd jmx_exporter |
| 182 | +./integration_test_suite/pull-smoke-test-docker-images.sh |
| 183 | +./mvnw clean verify |
| 184 | +``` |
| 185 | + |
| 186 | +### Scripts |
| 187 | + |
| 188 | +Test scripts are available to build and run various integration test suite scenarios |
| 189 | + |
| 190 | +- [run-quick-test.sh](https://github.com/prometheus/jmx_exporter/blob/main/run-quick-test.sh) |
| 191 | +- [run-smoke-test.sh](https://github.com/prometheus/jmx_exporter/blob/main/run-smoke-test.sh) |
| 192 | +- [run-regression-test.sh](https://github.com/prometheus/jmx_exporter/blob/main/run-regression-test.sh) |
| 193 | +- [run-targeted-test.sh](https://github.com/prometheus/jmx_exporter/blob/main/run-targeted-test.sh) |
| 194 | +- [run-stress-test.sh](https://github.com/prometheus/jmx_exporter/blob/main/run-stress-test.sh) |
| 195 | + |
| 196 | +### Output |
| 197 | + |
| 198 | +Output is similar to integration testing using smoke test containers. |
0 commit comments