Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[codespell]
# Skip auto-generated and binary files that should not be spell-checked
skip = yarn.lock,*.tar.gz,*.tgz,*.jar,*.zip,*.png,*.jpg,*.gif,*.ico,*.svg,*.woff,*.woff2,*.ttf,*.eot
# Ignore legitimate technical terms flagged as false positives
# assignin: real npm package name (lodash.assignin)
ignore-words-list = assignin

24 changes: 24 additions & 0 deletions build-tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,30 @@ RUN apt-get update && apt-get install --no-install-recommends -y nodejs npm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /root/.npm

#####################
# Install Chrome Required for tez-ui ember tests #
#####################
# hadolint ignore=DL3008
RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub \
| gpg --dearmor -o /etc/apt/keyrings/google-chrome.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] https://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get -q update \
&& apt-get -q install --no-install-recommends -y google-chrome-stable \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Create a google-chrome wrapper so that testem 0.9.11 (bundled in ember-cli
# 1.13.14) can find and launch Chrome headlessly. testem 0.9.11 calls
# 'google-chrome' via 'which' with hardcoded non-headless args and ignores
# browser_args/CHROME_BIN config. This wrapper injects the required headless
# flags before forwarding all arguments to the real binary.
# hadolint ignore=DL3059
RUN printf '#!/bin/bash\nexec /usr/bin/google-chrome-stable --headless --disable-gpu --no-sandbox --disable-dev-shm-usage "$@"\n' \
> /usr/local/bin/google-chrome \
&& chmod +x /usr/local/bin/google-chrome
ENV CHROME_BIN=google-chrome-stable

################################
# Copy over parallel downloads #
################################
Expand Down
34 changes: 33 additions & 1 deletion tez-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,39 @@ You will need the following things properly installed on your computer.

### Running Tests

* `yarn test`
Tests run in **headless Chrome**
Google Chrome must be installed on your machine.

**Step 1: Set `CHROME_BIN` to your Chrome binary**

On Linux:
```bash
export CHROME_BIN=google-chrome-stable
```
On macOS:
```bash
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
```

**Step 2: Run the tests**

Via Maven (from the `tez-ui` directory):
```bash
mvn clean install
```
If `CHROME_BIN` is not set in your environment, you can also pass the Chrome path
directly as a Maven property:
```bash
mvn clean install -Dchrome.bin="/path/to/Google Chrome"
```
Via Yarn (from inside `src/main/webapp`):
```bash
yarn test
```
To skip tests:
```bash
mvn clean package -DskipTests
```

### Building

Expand Down
13 changes: 9 additions & 4 deletions tez-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
<allow-root-build>--allow-root=false</allow-root-build>

<skipTests>false</skipTests>

<!--
Chrome binary used by testem for headless UI tests.
Override on the command line: -Dchrome.bin="/path/to/chrome"
Falls back to google-chrome-stable when not overridden.
-->
<chrome.bin>google-chrome-stable</chrome.bin>
</properties>

<profiles>
Expand Down Expand Up @@ -92,8 +99,7 @@
<argument>test:mvn</argument>
</arguments>
<environmentVariables>
<!-- workaround for systems using a newer OpenSSL (3+) which is incompatible with PhantomJS -->
<OPENSSL_CONF>/dev/null</OPENSSL_CONF>
<CHROME_BIN>${chrome.bin}</CHROME_BIN>
</environmentVariables>
</configuration>
</execution>
Expand Down Expand Up @@ -154,8 +160,7 @@
<argument>test:mvn</argument>
</arguments>
<environmentVariables>
<!-- workaround for systems using a newer OpenSSL (3+) which is incompatible with PhantomJS -->
<OPENSSL_CONF>/dev/null</OPENSSL_CONF>
<CHROME_BIN>${chrome.bin}</CHROME_BIN>
</environmentVariables>
</configuration>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions tez-ui/src/main/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
"ember-truth-helpers": "1.3.0",
"bower-shrinkwrap-resolver-ext": "^0.1.0",
"loader.js": "4.2.3",
"testem": "0.9.11",
"phantomjs-prebuilt": "2.1.13"
"testem": "1.18.5"
},
"dependencies": {
"em-tgraph": "0.0.14"
},
"resolutions": {
"moment": "2.30.1",
"**/form-data/async": "2.6.4",
"**/mkdirp/minimist": "1.2.6",
"**/optimist/minimist": "1.2.6",
Expand Down
12 changes: 10 additions & 2 deletions tez-ui/src/main/webapp/testem.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"browser_start_timeout": 120,
"timeout": 300,
"exit_timeout": 5,
"launchers": {
"Chrome": {
"command": "scripts/chrome-launcher.sh --headless --disable-gpu --no-sandbox --disable-dev-shm-usage --no-default-browser-check --no-first-run --ignore-certificate-errors --test-type <url>",
"protocol": "browser"
}
},
"launch_in_ci": [
"PhantomJS"
"Chrome"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
}
3 changes: 2 additions & 1 deletion tez-ui/src/main/webapp/tests/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"andThen",
"currentURL",
"currentPath",
"currentRouteName"
"currentRouteName",
"QUnit"
],
"node": false,
"browser": false,
Expand Down
9 changes: 9 additions & 0 deletions tez-ui/src/main/webapp/tests/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@ import {
} from 'ember-qunit';

setResolver(resolver);

QUnit.done(function() {
// After all tests complete, the qunit_adapter sends 'all-test-results' to testem
// via Socket.IO through two nested setTimeout(0) calls. We wait 500ms to ensure
// the message is flushed before we close the browser.
setTimeout(function() {
window.close();
}, 500);
});
Loading