summaryrefslogtreecommitdiff
path: root/README.md
blob: 5a86a0e018a03b965a02277d695058f6307aff7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# VTS Dashboard

## Introduction

The VTS Dashboard displays the summarized results of the Multi Device Tests along with graphs.

## Installation

### Steps to run locally:

1. Google App Engine uses Java 8. Install Java 8 before running running locally:
   'sudo apt install openjdk-8-jdk'

   To use java 8:
   Copy the following lines in ~/.bashrc :

```
    function setup_jdk() {
      # Remove the current JDK from PATH
      if [ -n "$JAVA_HOME" ] ; then
        PATH=${PATH/$JAVA_HOME\/bin:/}
      fi
      export JAVA_HOME=$1
      export PATH=$JAVA_HOME/bin:$PATH
    }

    function use_java8() {
    #  setup_jdk /usr/java/jre1.8.0_73
      setup_jdk /usr/lib/jvm/java-8-openjdk-amd64
    }

    Then from cmd:
    $ use_java8
```

2. Maven is used for build. Install Maven 3.3.9:
   Download maven from:
   https://maven.apache.org/download.cgi

   Steps to Install Maven:
   1) Unzip the Binary tar:
      tar -zxf apache-maven-3.3.3-bin.tar.gz

   2) Move the application directory to /usr/local
      sudo cp -R apache-maven-3.3.3 /usr/local

   3) Make a soft link in /usr/bin for universal access of mvn
      sudo ln -s /usr/local/apache-maven-3.3.3/bin/mvn /usr/bin/mvn

   4) Verify maven installation:
      $ mvn -v

      The output should resemble this:

      Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
      Maven home: /opt/apache-maven-3.3.9
      Java version: 1.8.0_45-internal, vendor: Oracle Corporation
      Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "3.13.0-88-generic", arch: "amd64", family: "unix"

3. Install Google Cloud SDK. Follow the instructions listed on official source:
   https://cloud.google.com/sdk/docs/quickstart-linux

   The default location where the application searches for a google-cloud-sdk is:
   /usr/local/share/google/google-cloud-sdk

   Therefore move the extracted folder to this location: /usr/local/share/google/

   Otherwise, to have a custom location, specify the location of
   google-cloud-sdk in test/vti/dashboard/pom.xml by putting the configuration:

```
   <configuration>
     <gcloud_directory>PATH/TO/GCLOUD_DIRECTORY</gcloud_directory>
   </configuration>
```
   within the 'com.google.appengine' plugin tag :

## To run GAE on local machine:

$ cd test/vti/dashboard
$ mvn appengine:devserver

## To deploy to Google App Engine

$ cd test/vti/dashboard
$ mvn appengine:update

visit https://<YOUR-PROJECT-NAME>.appspot.com

## Update config file through gcloud command

You can deploy or update GAE's a config file without deploying the whole project.
The next commands show how to do it.

```
gcloud app deploy --project=<YOUR-PROJECT-NAME> cron.xml
gcloud app deploy --project=<YOUR-PROJECT-NAME> queue.xml
gcloud app deploy --project=<YOUR-PROJECT-NAME> datastore-indexes.xml
```

## Test Data

### Purpose

When you start your local GAE server, you will see empty page as the local datastore do not have any data.
So we need to put some sample data into local datastore so that developers are able to continue to
develop new features or fix bugs. Thus, we developed the next two test APIs, which are only available
in your local dev environment.

```
http://127.0.0.1:8080/api/test_data/report
http://127.0.0.1:8080/api/test_data/plan
```

### How to set test data on json files for generating mock data on local dev server

If you want to generate some mock data for your local development, you need to set some fake data
on json files under the testdata folder. However, you need to abide by some rules in doing this,
otherwise you will end up with errors from the mock data dev API.

First, in test-plan-report-data.json, you need to set the same number of data under "testCaseNames"
and "results". For example, if you put 5 elements of data in "testCaseNames", you should put the same
number of data under "results".

```json
........
"testCaseRunList": [
  {
    "testCaseNames": [
      "stdatomic.atomic_exchange_64bit",
      "stdatomic.atomic_compare_exchange_64bit",
      "stdatomic.atomic_exchange_64bit",
      "stdatomic.atomic_compare_exchange_64bit",
      "stdatomic.atomic_exchange_64bit",
      "stdatomic.atomic_compare_exchange_64bit"
    ],
    "results": [
      2,
      2,
      2,
      2,
      2,
      2
    ]
  }
],
........
```

Second, in test-report-data.json file, you need to make sure that "testModules" should have
the "testName"'s value under "testRunList" and the "testTimes" should have the "startTimestamp"'s value
in the test-report-data.json file.

test-report-data.json
```json
......
  "testRunList": [
    {
      "testName": "BionicUnitTests", <- "testModules" should be copied from here
      "type": 1,
      "startTimestamp":1515562811, <- "testTimes" should be copied from here
......
    {
      "testName": "CpuProfilingTest", <- "testModules" should be copied from here
      "type": 2,
      "startTimestamp":1515562811, <- "testTimes" should be copied from here
......
```

test-plan-report-data.json
```json
......
  {
    "testPlanName": "vts-serving-staging-fuzz",
    "testModules": ["BionicUnitTests", "CpuProfilingTest"],
    "testTimes": [1515562811, 1515562811]
  },
  {
    "testPlanName": "vts-serving-staging-hal-conventional",
    "testModules": ["BionicUnitTests", "CpuProfilingTest"],
    "testTimes": [1515562811, 1515562811]
  }
......
```
"testModules" and "testTimes"'s elements order is also matter.

### Command to generate mock data through API

The next two commands will generate mock data in your local dev datastore.
The execution order of the commands is very important, otherwise you can't find some of the data in your local datastore.
Thus, please execute the below command as I wrote in order.

```
curl -d @testdata/test-report-data.json -m 30 -X POST http://127.0.0.1:8080/api/test_data/report -H "Content-Type: application/json" --verbose
curl -d @testdata/test-plan-report-data.json -m 30 -X POST http://127.0.0.1:8080/api/test_data/plan -H "Content-Type: application/json" --verbose
```

## Monitoring

The following steps list how to create a monitoring service for the VTS Dashboard.

### Create a Stackdriver account

1. Go to Google Cloud Platform Console:
   http://console.developers.google.com

2. In the Google Cloud Platform Console, select Stackdriver > Monitoring.
   If your project is not in a Stackdriver account you'll see a message to
   create a new project.

3. Click Create new Stackdriver account and then Continue.

4. With your project shown, click Create account.

5. In the page, "Add Google Cloud Platform projects to monitor", click Continue to skip ahead.

6. In the page, "Monitor AWS accounts", click Done to skip ahead.

7. In a few seconds you see the following message:
   "Finished Initial collection"
   Click Launch Monitoring.

8. In the page, "Get reports by email", click No reports and Continue.

9. You will see your Stackdriver account dashboard.
   Close the "Welcome to Stackdriver" banner if you don't need it.

### Steps to create an uptime check and an alerting policy

1. Go to Stack Monitoring console:
   https://app.google.stackdriver.com/

2. Go to Alerting > Uptime Checks in the top menu and then click Add Uptime Check.
   You see the New Uptime Check panel.

3. Fill in the following fields for the uptime check:

    Check type: HTTP
    Resource Type: Instance
    Applies To: Single, lamp-1-vm
    Leave the other fields with their default values.

4. Click Test to verify your uptime check is working.

5. Click Save. After you click on save you'll see a panel to
   'Create Alerting Policy'

6. Fill out the configuration for notifications and click save policy.

### Test the check and alert

This procedure can take up to fifteen minutes.

To test the check and alert, go to the VM Instances page, select your instance, and click Stop from the top menu.
You'll have to wait up to five minutes for the next uptime check to fail. The alert and notification don't happen until the next failure occurs.

To correct the "problem," return to the VM Instances page, select your instance, and click Start from the top menu.