-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4347 from rmol/tbb-4290
Add TBB to functional tests
- Loading branch information
Showing
48 changed files
with
3,512 additions
and
851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ flake8 | |
flaky | ||
mock | ||
pbr | ||
pip-tools>2.0.0 | ||
pip-tools>=3.5.0,<4 | ||
pylint | ||
pytest | ||
requests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,17 +9,19 @@ set -e | |
# Bomb out if container not running | ||
docker inspect securedrop-dev >/dev/null 2>&1 || (echo "ERROR: SD container not running."; exit 1) | ||
|
||
VNCPORT=5909 | ||
|
||
# Maybe we are running macOS | ||
if [ "$(uname -s)" == "Darwin" ]; then | ||
open "vnc://${USER}:[email protected]:5901" & | ||
open "vnc://${USER}:[email protected]:${VNCPORT}" & | ||
exit 0 | ||
fi | ||
|
||
# Find our securedrop docker ip | ||
SD_DOCKER_IP="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' securedrop-dev)" | ||
|
||
# Quit if the VNC port not found | ||
nc -w5 -z "$SD_DOCKER_IP" 5901 || (echo "ERROR: VNC server not found"; exit 1) | ||
nc -w5 -z "$SD_DOCKER_IP" ${VNCPORT} || (echo "ERROR: VNC server not found"; exit 1) | ||
|
||
if [ ! "$(which remote-viewer)" ] | ||
then | ||
|
@@ -32,6 +34,8 @@ then | |
exit 1 | ||
fi | ||
|
||
rv_config="${TMPDIR:-/tmp}/func-vnc.ini" | ||
echo -e "[virt-viewer]\ntype=vnc\nhost=${SD_DOCKER_IP}\nport=5901\npassword=freedom" > "${rv_config}" | ||
|
||
rv_config="${TMPDIR:-/tmp}/sd-vnc.ini" | ||
echo -e "[virt-viewer]\ntype=vnc\nhost=${SD_DOCKER_IP}\nport=${VNCPORT}\npassword=freedom" > "${rv_config}" | ||
|
||
remote-viewer "${rv_config}" 2>/dev/null & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
install_files/ansible-base/roles/app-test/files/tor_app.fact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# | ||
# Ansible local fact producer for tor onion details of app server | ||
# to be chucked into /etc/ansible/facts.d/ with a .fact suffix | ||
|
||
import json | ||
import os | ||
|
||
TOR_SVC_PATH = "/var/lib/tor/services/" | ||
JOURNALIST_DIR = "journalist" | ||
SOURCE_DIR = "source" | ||
|
||
|
||
def extract_sd_onion_data(tor_path=TOR_SVC_PATH, | ||
journalist_dir=JOURNALIST_DIR, | ||
source_dir=SOURCE_DIR, | ||
protocol="http"): | ||
|
||
for interface in [journalist_dir, source_dir]: | ||
hostname_file = os.path.join(TOR_SVC_PATH, interface, 'hostname') | ||
try: | ||
with open(hostname_file) as f: | ||
tor_config = f.readline().rstrip().split() | ||
|
||
onion_addr = "{p}://{a}".format(p=protocol, a=tor_config[0]) | ||
auth_token = tor_config[1] | ||
|
||
# This must be a source interface because we dont see hidservauth info | ||
except IndexError: | ||
source_int = onion_addr | ||
# One of the files doesn't exist :| Maybe tor setup hasnt run yet. | ||
except IOError: | ||
return dict() | ||
else: | ||
journalist_int = onion_addr | ||
|
||
return dict(journalist_location=journalist_int, | ||
source_location=source_int, | ||
hidserv_token=auth_token) | ||
|
||
|
||
if __name__ == '__main__': | ||
print(json.dumps(extract_sd_onion_data())) |
38 changes: 38 additions & 0 deletions
38
install_files/ansible-base/roles/app-test/tasks/extract_apptor_test_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
|
||
- name: Create ansible fact directory | ||
file: | ||
path: /etc/ansible/facts.d | ||
recurse: yes | ||
state: directory | ||
owner: root | ||
group: root | ||
|
||
- name: Copy over tor application fact file | ||
copy: | ||
src: tor_app.fact | ||
dest: /etc/ansible/facts.d/tor_app.fact | ||
mode: 0755 | ||
|
||
- name: Refresh remote "local facts" for glory | ||
setup: | ||
filter: ansible_local | ||
|
||
- name: Gather apptest facts to dict to prepare for output | ||
set_fact: | ||
_tbb_selenium_dict: | ||
hidserv_token: "{{ ansible_local.tor_app.hidserv_token }}" | ||
journalist_location: "{{ ansible_local.tor_app.journalist_location }}" | ||
source_location: "{{ ansible_local.tor_app.source_location }}" | ||
timeout: "{{ tbb_timeout }}" | ||
user: | ||
name: "{{ tbb_selenium_user }}" | ||
password: "{{ tbb_selenium_password }}" | ||
secret: "{{ tbb_selenium_totp_secret }}" | ||
|
||
- name: Dump facts to local json for in-take | ||
copy: | ||
content: "{{ _tbb_selenium_dict | to_nice_json }}" | ||
dest: "{{ tbb_funcfolder }}" | ||
become: no | ||
delegate_to: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,6 @@ | |
tags: always | ||
become: yes | ||
|
||
|
||
- import_playbook: apt.yml | ||
tags: apt | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ set -eu | |
|
||
source "${BASH_SOURCE%/*}/dev-deps" | ||
|
||
run_xvfb & | ||
run_redis & | ||
run_supervisor & | ||
urandom | ||
|
Oops, something went wrong.