Skip to content

Commit

Permalink
Merge c4c053a into 203bbc7
Browse files Browse the repository at this point in the history
  • Loading branch information
itamarst committed May 12, 2021
2 parents 203bbc7 + c4c053a commit 6e85f0f
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 137 deletions.
89 changes: 13 additions & 76 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ jobs:
python-version: 2.7

steps:
- name: Install Tor [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: sudo apt install tor

- name: Install Tor [macOS]
if: matrix.os == 'macos-latest'
run: brew install tor

- name: Install Tor [Windows]
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install tor

# See https://github.com/actions/checkout. A fetch-depth of 0
# fetches all tags and branches.
Expand Down Expand Up @@ -172,82 +185,6 @@ jobs:
# Some magic value required for some magic reason.
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

integration:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- windows-latest
python-version:
- 2.7

steps:

- name: Install Tor [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: sudo apt install tor

- name: Install Tor [macOS]
if: matrix.os == 'macos-latest'
run: brew install tor

- name: Install Tor [Windows]
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install tor

- name: Check out Tahoe-LAFS sources
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
if: ${{ matrix.os != 'windows-latest' }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

# See this step under coverage job.
- name: Set up Python ${{ matrix.python-version }} [Windows x86]
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: 'x86'

- name: Get pip cache directory
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Use pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python packages
run: |
pip install --upgrade tox
pip list
- name: Display tool versions
run: python misc/build_helpers/show-tool-versions.py

- name: Run "tox -e integration"
run: tox -e integration

- name: Upload eliot.log in case of failure
uses: actions/upload-artifact@v1
if: failure()
with:
name: integration.eliot.json
path: integration.eliot.json

packaging:
runs-on: ${{ matrix.os }}
Expand Down
12 changes: 11 additions & 1 deletion integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
"""
Ported to Python 3.
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401

import sys
import shutil
from time import sleep
Expand Down Expand Up @@ -28,7 +38,7 @@
import pytest
import pytest_twisted

from util import (
from .util import (
_CollectOutputProtocol,
_MagicTextProtocol,
_DumpOutputProtocol,
Expand Down
9 changes: 9 additions & 0 deletions integration/test_aaa_aardvark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
# You can safely skip any of these tests, it'll just appear to "take
# longer" to start the first test as the fixtures get built

from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401


def test_create_flogger(flog_gatherer):
print("Created flog_gatherer")
Expand Down
16 changes: 14 additions & 2 deletions integration/test_servers_of_happiness.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
"""
Ported to Python 3.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401

import sys
from os.path import join

from twisted.internet.error import ProcessTerminated

import util
from . import util

import pytest_twisted

Expand Down Expand Up @@ -42,4 +54,4 @@ def test_upload_immutable(reactor, temp_dir, introducer_furl, flog_gatherer, sto
assert isinstance(e, ProcessTerminated)

output = proto.output.getvalue()
assert "shares could be placed on only" in output
assert b"shares could be placed on only" in output
15 changes: 12 additions & 3 deletions integration/test_streaming_logs.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
"""
Ported to Python 3.
"""
from __future__ import (
print_function,
unicode_literals,
absolute_import,
division,
)

from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401

from six import ensure_text

import json

from os.path import (
join,
)
from urlparse import (
from urllib.parse import (
urlsplit,
)

Expand Down Expand Up @@ -68,7 +77,7 @@ def _connect_client(reactor, api_auth_token, ws_url):
factory = WebSocketClientFactory(
url=ws_url,
headers={
"Authorization": "{} {}".format(SCHEME, api_auth_token),
"Authorization": "{} {}".format(str(SCHEME, "ascii"), api_auth_token),
}
)
factory.protocol = _StreamingLogClientProtocol
Expand Down Expand Up @@ -127,7 +136,7 @@ def _test_streaming_logs(reactor, temp_dir, alice):
node_url = cfg.get_config_from_file("node.url")
api_auth_token = cfg.get_private_config("api_auth_token")

ws_url = node_url.replace("http://", "ws://")
ws_url = ensure_text(node_url).replace("http://", "ws://")
log_url = ws_url + "private/logs/v1"

print("Connecting to {}".format(log_url))
Expand Down
22 changes: 17 additions & 5 deletions integration/test_tor.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
"""
Ported to Python 3.
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401

import sys
from os.path import join

import pytest
import pytest_twisted

import util
from . import util

from twisted.python.filepath import (
FilePath,
Expand Down Expand Up @@ -55,7 +65,7 @@ def test_onion_service_storage(reactor, request, temp_dir, flog_gatherer, tor_ne
cap = proto.output.getvalue().strip().split()[-1]
print("TEH CAP!", cap)

proto = util._CollectOutputProtocol()
proto = util._CollectOutputProtocol(capture_stderr=False)
reactor.spawnProcess(
proto,
sys.executable,
Expand All @@ -68,7 +78,7 @@ def test_onion_service_storage(reactor, request, temp_dir, flog_gatherer, tor_ne
yield proto.done

dave_got = proto.output.getvalue().strip()
assert dave_got == open(gold_path, 'r').read().strip()
assert dave_got == open(gold_path, 'rb').read().strip()


@pytest_twisted.inlineCallbacks
Expand Down Expand Up @@ -100,7 +110,7 @@ def _create_anonymous_node(reactor, name, control_port, request, temp_dir, flog_
# Which services should this client connect to?
write_introducer(node_dir, "default", introducer_furl)
with node_dir.child('tahoe.cfg').open('w') as f:
f.write('''
node_config = '''
[node]
nickname = %(name)s
web.port = %(web_port)s
Expand All @@ -125,7 +135,9 @@ def _create_anonymous_node(reactor, name, control_port, request, temp_dir, flog_
'log_furl': flog_gatherer,
'control_port': control_port,
'local_port': control_port + 1000,
})
}
node_config = node_config.encode("utf-8")
f.write(node_config)

print("running")
yield util._run_node(reactor, node_dir.path, request, None)
Expand Down

0 comments on commit 6e85f0f

Please sign in to comment.