Skip to content

Commit 78a594a

Browse files
committed
updated README
1 parent 5ecc4c2 commit 78a594a

File tree

3 files changed

+59
-13
lines changed

3 files changed

+59
-13
lines changed

__tests__/README.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Testing
22

33
### Preparation
4+
###
5+
### Frontend Testing
6+
7+
For frontend testing, ensure you've prepared your environment as follows:
48

59
1. React Testing Library versions 13+ require React v18. If your project uses an older version of React, be sure to install version 12
610
```
@@ -18,7 +22,7 @@ npm i @types/node
1822
npm install -D ts-node
1923
```
2024
3. create jest.config.js
21-
```
25+
```js
2226
module.exports = {
2327
verbose: true,
2428
setupFilesAfterEnv: ['./jest_setup/windowMock.js'],
@@ -34,13 +38,16 @@ module.exports = {
3438
};
3539
```
3640
4. make sure jest_setup folder is at root directory of Chronos with styleMock.js and windowMock.js
37-
41+
```js
3842
styleMock.js
3943
```
44+
```js
4045
module.exports = {};
4146
```
47+
```js
4248
windowMock.js
4349
```
50+
```js
4451
// Mock window environment
4552
window.require = require;
4653

@@ -50,9 +57,45 @@ module.exports = {
5057
// Mock get context
5158
HTMLCanvasElement.prototype.getContext = () => {};
5259
```
53-
5. update database info inside test_settings.json
60+
5. update database info inside `test_settings.json`
5461

5562
6. use `npm run test` to run jest tests
63+
###
64+
### Backend Testing
65+
66+
For backend testing, ensure you've prepared your environment as follows:
67+
68+
1. create `jest.config.js`
69+
```js
70+
module.exports = {
71+
roots: ['<rootDir>'], // Set the root directory for test files (adjust this path to your test folder)
72+
testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
73+
collectCoverage: true,
74+
coverageDirectory: 'coverage',
75+
testPathIgnorePatterns: ['/node_modules/', '/__tests__/'],
76+
};
77+
```
78+
2. install additional packages
79+
```
80+
npm i mongodb-memory-server
81+
```
82+
6. use `npm run backend-test` to run jest tests
83+
84+
### End-to-End Testing
85+
86+
Perform end-to-end testing with the following steps:
87+
88+
1. install the following packages
89+
```
90+
npm i selenium-webdriver
91+
npm i chromedriver
92+
```
93+
94+
2. use `npm run dev:app` to start the app
95+
96+
3. use `./node_modules/.bin/chromedriver` to run the Chromedriver executable
97+
98+
4. use `npm run start:e2e` to run the end-to-end tests
5699

57100
## Contributing
58101

chronos_npm_package/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## What's New?
22
- Enhanced Metrics Collection: Docker now supports Prometheus metrics scraping, offering improved monitoring capabilities
33
- Streamlined Visualization: Docker and Kubernetes integrate with Grafana to provide dynamic visualization of collected metrics
4-
- Ability to select graph type and process kubernetes resource data
4+
- Kubernetes graph type customization and resource data processing
55
- Bug Fixes
66
- Refactored code for additional modularity and customization
77

@@ -144,6 +144,7 @@ Chronos provides the option to send emails. The properties that should be provi
144144

145145

146146
**NOTE: Email notification settings may require alternative security settings to work**
147+
#
147148

148149
### Chronos Tracker for "Microservices" Mode
149150
The mode `microservices` uses the additional setting `dockerized`, which indicates whether or not the microservice has been containerized with Docker. If omitted, Chronos will assume this server is not running in a container, i.e. `dockerized` will default to _false_.
@@ -278,12 +279,13 @@ When viewing your information in the Chronos Electron application the data will
278279

279280
**NOTE:** We provide a jmx_config.yaml file in the Chronos root folder for use with JMX prometheus that provides some useful baseline metrics to monitor.
280281

281-
### Chronos Tracker for "docker" Mode
282-
Chronos can monitor Docker containers by saving metric data from instant queries to a Prometheus server in your Docker container.
282+
#
283+
### Chronos Tracker for "Docker" Mode
284+
Chronos monitors Docker containers by storing metric data through instant Prometheus queries within your Docker container environment.
283285

284-
In `chronos-config.js`, set the `mode` to `docker` and pass it both the name of the port the Prometheus server is listening on INSIDE the container, and the name of the Prometheus service so that its IP address can be resolved using DNS.
286+
In `chronos-config.js`, configure the `mode` parameter to `docker`. Additionally, provide the name of the port where the Prometheus server is actively listening inside the container, and specify the name of the Prometheus service to enable DNS-based resolution of its IP address.
285287

286-
Also add a `grafanaAPIKey` section, this API key will grant chronos access to create and update dashboards in Grafana.
288+
Also add a `grafanaAPIKey` section, this API key will authorize Chronos for dashboard creation and updates in Grafana.
287289

288290
```js
289291
// Excerpt from a chronos-config.js
@@ -302,7 +304,7 @@ module.exports = {
302304

303305
```
304306

305-
Then, insert the code below into a **SINGLE** microservice that will be deployed only as a **SINGLE** container, call `Chronos.docker`:
307+
Then, implement the subsequent code snippet within a **SINGLE** microservice that will be deployed only as a **SINGLE** container, and call `Chronos.docker`:
306308

307309
```js
308310
const chronosConfig = require('./chronos-config.js');
@@ -312,6 +314,7 @@ const chronos = new Chronos(chronosConfig);
312314
chronos.docker();
313315
```
314316

317+
315318
### Chronos Tracker for gRPC
316319

317320
To monitor your gRPC server, setup `chronos-config.js` as if it was a standard microservices example, but be sure to set the `connection` type to `gRPC`.

examples/docker/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ For additional details on how Chronos works this example, please review the Dock
2727

2828
## Grafana API KEY
2929

30-
1. Run docker compose command below (LN 61) to start your Grafana container before you can access your service account token.
30+
1. To initiate your Grafana container and prepare for accessing your service account token, execute the following command: `docker-compose -f docker-compose.yml up`
3131

32-
2. In your browser, go to `localhost:32000`, which will be the login page of grafana. Use `admin` as both username and password to login. You can change the password after login.
32+
2. In your browser, go to `localhost:32000`, which will be the login page of Grafana. Use `admin` as both username and password to login. You can change the password after login.
3333

34-
3. Navigate to `Home -> Administration -> Service accounts`, then click `Add service account` to create an service account. Be sure to choose `Admin` as the role. Then click `Add service account token`, hit `generate`, you are done! Remember this token, you will be using this token to access Grafana HTTP API programmatically.
34+
3. Navigate to `Home -> Administration -> Service accounts`, then click `Add service account` to create a service account. Be sure to choose `Admin` as the role. Then click `Add service account token`, hit `generate`, you are done! Remember this token, you will be using this token to access Grafana HTTP API programmatically.
3535

3636
## Steps to Run Example
3737
Peform the following steps in each of the _books_, _customers_, _frontend_, and _orders_ directories
@@ -55,7 +55,7 @@ CHRONOS_GRAFANA_API_KEY = Bearer [the access token you created in above section
5555

5656
- If you have the dependency as `"@chronosmicro/tracker": "file:./chronos_npm_package"`, which is a **local** file, make sure to change the version from `"file:./chronos_npm_package"` to `"^12.0.1"` and run npm install. **Unless you are wanting to test local copies of the "Chronos_npm_package" file**
5757

58-
3. With the terminal navigated to the the _examples/docker_ folder, run the command:
58+
3. With the terminal navigated to the _examples/docker_ folder, run the command:
5959

6060
```
6161
docker-compose -f docker-compose.yml up

0 commit comments

Comments
 (0)