|
1 | 1 | # plotly.js image testing
|
2 | 2 |
|
3 |
| -Test plotly.js with the Plotly Image-Server docker container. |
| 3 | +Test plotly.js with Plotly's image testing docker container. |
4 | 4 |
|
| 5 | +Requirements: |
| 6 | +- `docker` | [installation guidelines](http://docs.docker.com/engine/installation/) |
| 7 | +- `docker-machine` (for Mac and Windows users only) | [installation guidelines](https://docs.docker.com/machine/install-machine/) |
| 8 | +- `docker-compose` | [installation guidelines](https://docs.docker.com/compose/install/) |
| 9 | + |
| 10 | +### Step 0: Start the docker machine (Mac and Windows users only) |
| 11 | + |
| 12 | +Boot up docker machine (named `default`): |
| 13 | + |
| 14 | +```bash |
| 15 | +docker-machine start default |
| 16 | +``` |
| 17 | + |
| 18 | +Set up the docker environment for `docker-compose`: |
| 19 | + |
| 20 | +```bash |
| 21 | +eval $(docker-machine env default) |
| 22 | +``` |
| 23 | + |
| 24 | +the above evaluates the output of `docker-machine env default`. |
| 25 | + |
| 26 | + |
| 27 | +### Step 1: Run the testing container |
| 28 | + |
| 29 | +Plotly.js uses `docker-compose` to ease the creation/stopping/deletion of testing docker container. |
5 | 30 |
|
6 |
| -### Run the container with `docker compose` |
7 | 31 |
|
8 |
| -Plotly.js uses `docker-compose` to ease the creation/stopping/deletion of testing docker container, |
9 |
| -please refer [installing docker-compose](https://docs.docker.com/compose/install/) for installation. |
10 | 32 | Inside your `plotly.js` directory, run
|
11 | 33 |
|
12 | 34 | ```bash
|
13 |
| -$ docker-compose up -d |
| 35 | +docker-compose up -d |
14 | 36 | ```
|
15 | 37 |
|
16 | 38 | In the `docker-compose.yml` file, `latest` is the latest Plotly Image-Server docker container version
|
17 | 39 | as listed on [hub.docker.com](https://hub.docker.com/r/plotly/imageserver/tags/) and
|
18 |
| -`imagetest` is the name of the docker container. |
| 40 | +`imagetest` is the name of the docker container. The `-d` flag tells docker to start the containers in the background and leave them running. |
19 | 41 |
|
20 | 42 |
|
21 |
| -### Run the tests |
| 43 | +### Step 2: Run the tests |
22 | 44 |
|
23 | 45 | Inside your `plotly.js` directory, run
|
24 | 46 |
|
25 | 47 | ```bash
|
26 | 48 | npm run test-image
|
27 | 49 | ```
|
28 | 50 |
|
29 |
| -### SSH into docker |
| 51 | +if some tests fail, compare their outputs using `npm run start-image_viewer`. |
| 52 | + |
| 53 | +### Step 3: Stop your testing container |
| 54 | + |
| 55 | +Once done testing, inside your `plotly.js` directory, run |
| 56 | + |
| 57 | +```bash |
| 58 | +docker-compose stop |
| 59 | +``` |
| 60 | + |
| 61 | +### Docker tricks |
| 62 | + |
| 63 | +##### SSH into docker container |
30 | 64 |
|
31 | 65 | ```bash
|
32 | 66 | ssh -p 2022 root@localhost # with password `root`
|
@@ -58,36 +92,40 @@ ssh-keygen -f "${HOME}/.ssh/known_hosts" -R [localhost]:2022
|
58 | 92 |
|
59 | 93 | to remove host information.
|
60 | 94 |
|
| 95 | +##### List docker machines |
| 96 | + |
| 97 | +```bash |
| 98 | +docker-machine ls |
| 99 | +``` |
61 | 100 |
|
62 |
| -### List all images |
| 101 | +##### List all images |
63 | 102 |
|
64 | 103 | ```bash
|
65 | 104 | docker images
|
66 | 105 | ```
|
67 | 106 |
|
68 |
| -### List all containers |
| 107 | +##### List all containers |
69 | 108 |
|
70 | 109 | ```bash
|
71 | 110 | docker ps -a
|
72 | 111 | ```
|
73 | 112 |
|
74 | 113 | whereas `docker ps` lists only the started containers.
|
75 | 114 |
|
76 |
| - |
77 |
| -### Stop your testing container |
| 115 | +##### Remove your testing container |
78 | 116 |
|
79 | 117 | Inside your `plotly.js` directory, run
|
80 | 118 |
|
81 | 119 | ```bash
|
82 |
| -docker-compose stop |
| 120 | +docker-compose rm -f |
83 | 121 | ```
|
84 | 122 |
|
85 |
| -### Remove your testing container |
| 123 | +#### Remove your docker machine |
86 | 124 |
|
87 |
| -Inside your `plotly.js` directory, run |
| 125 | +If named `default`: |
88 | 126 |
|
89 | 127 | ```bash
|
90 |
| -docker-compose rm -f |
| 128 | +docker-machine kill default |
91 | 129 | ```
|
92 | 130 |
|
93 | 131 | For more comprehensive information about docker, please refer to the [docker docs](http://docs.docker.com/).
|
0 commit comments