Skip to content

Add gRPC testsuite #1806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Aug 9, 2022
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
874d2e2
testsuite: Added helper functions to handle test envs
cmaglie Jul 12, 2022
dae3242
testsuite: Added helper functions to run arduino-cli
cmaglie Jul 12, 2022
9679f1c
testsuite: Added colored output to arduino-cli Run helper
cmaglie Jul 12, 2022
46c381e
testsuite: Pass cli config through env variables
cmaglie Jul 12, 2022
9ae6760
testsuite: added env commands to download and extract files
cmaglie Jul 13, 2022
1465a20
testsuite: added commands to start cli daemon and run some gRPC calls
cmaglie Jul 13, 2022
f53c673
testsuite: moved test harness inside 'internal' package
cmaglie Jul 13, 2022
82e98ee
testsuite: added first daemon test for gRPC board watch
cmaglie Jul 13, 2022
b453bca
testsuite: added http server helper
cmaglie Jul 28, 2022
db39fb0
testsuite: added JSON helpers
cmaglie Jul 29, 2022
f2c886e
testsuite: Added possibility to use shared download staging folder
cmaglie Jul 29, 2022
1ab2ef4
testsuite: Converted a core_test.py test (WIP)
cmaglie Jul 29, 2022
eac1356
REMOVEME: Deactivate daemon integration test for now
cmaglie Jul 29, 2022
2631e96
testsuite: force colored output
cmaglie Jul 29, 2022
330b51d
testsuite: moved all generic subroutines into their own library
cmaglie Aug 1, 2022
b886381
testsuite: moved daemon test in his own dir
cmaglie Aug 1, 2022
a9d73c2
fixed typo
cmaglie Aug 1, 2022
f3c1463
testsuite: added some helpers to improve daemon testing
cmaglie Aug 1, 2022
94ba9ac
testsuite: added test for #1614
cmaglie Aug 1, 2022
688f7af
Removed converted test
cmaglie Aug 2, 2022
9fea578
testsuite: perform build before test
cmaglie Aug 2, 2022
0c282cd
Added missing comment
cmaglie Aug 2, 2022
55833f8
Renamed test file
cmaglie Aug 2, 2022
eea3ec9
Skip failing tests
cmaglie Aug 2, 2022
ca557ac
Updated licensed cache
cmaglie Aug 2, 2022
a929ff7
re-enable test for fixed bug
cmaglie Aug 2, 2022
1953902
testsuite: disable postinstall
cmaglie Aug 3, 2022
0896f4c
Removed useless startDaemon
cmaglie Aug 5, 2022
f21e86c
Renamed inst -> grpcInst
cmaglie Aug 5, 2022
d977ffe
Close daemon gRPC connection on test cleanup
cmaglie Aug 5, 2022
82e47d3
Added comment
cmaglie Aug 5, 2022
87561fe
Apply suggestions from code review
cmaglie Aug 8, 2022
757fa06
Update internal/integrationtest/arduino-cli.go
cmaglie Aug 9, 2022
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
Prev Previous commit
Next Next commit
Removed converted test
  • Loading branch information
cmaglie committed Aug 5, 2022
commit 688f7afb30bf30f06448901b1dea876a0898cf76
82 changes: 0 additions & 82 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,88 +26,6 @@
import semver


def test_core_search(run_command, httpserver):
# Set up the server to serve our custom index file
test_index = Path(__file__).parent / "testdata" / "test_index.json"
httpserver.expect_request("/test_index.json").respond_with_data(test_index.read_text())

url = httpserver.url_for("/test_index.json")
assert run_command(["core", "update-index", f"--additional-urls={url}"])
# search a specific core
result = run_command(["core", "search", "avr"])
assert result.ok
assert 2 < len(result.stdout.splitlines())
result = run_command(["core", "search", "avr", "--format", "json"])
assert result.ok
data = json.loads(result.stdout)
assert 0 < len(data)
# additional URL
result = run_command(["core", "search", "test_core", "--format", "json", f"--additional-urls={url}"])
assert result.ok
data = json.loads(result.stdout)
assert 1 == len(data)
# show all versions
result = run_command(["core", "search", "test_core", "--all", "--format", "json", f"--additional-urls={url}"])
assert result.ok
data = json.loads(result.stdout)
assert 2 == len(data)

def get_platforms(stdout):
data = json.loads(stdout)
platforms = {p["id"]: [] for p in data}
for p in data:
platforms[p["id"]].append(p["latest"])
return platforms

# Search all Retrokit platforms
result = run_command(["core", "search", "retrokit", "--all", f"--additional-urls={url}", "--format", "json"])
assert result.ok
platforms = get_platforms(result.stdout)
assert "1.0.5" in platforms["Retrokits-RK002:arm"]
assert "1.0.6" in platforms["Retrokits-RK002:arm"]

# Search using Retrokit Package Maintainer
result = run_command(["core", "search", "Retrokits-RK002", "--all", f"--additional-urls={url}", "--format", "json"])
assert result.ok
platforms = get_platforms(result.stdout)
assert "1.0.5" in platforms["Retrokits-RK002:arm"]
assert "1.0.6" in platforms["Retrokits-RK002:arm"]

# Search using the Retrokit Platform name
result = run_command(["core", "search", "rk002", "--all", f"--additional-urls={url}", "--format", "json"])
assert result.ok
platforms = get_platforms(result.stdout)
assert "1.0.5" in platforms["Retrokits-RK002:arm"]
assert "1.0.6" in platforms["Retrokits-RK002:arm"]

# Search using board names
result = run_command(["core", "search", "myboard", "--all", f"--additional-urls={url}", "--format", "json"])
assert result.ok
platforms = get_platforms(result.stdout)
assert "1.2.3" in platforms["Package:x86"]

def run_search(search_args, expected_ids):
res = run_command(["core", "search", "--format", "json"] + search_args.split(" "))
assert res.ok
data = json.loads(res.stdout)
platform_ids = [p["id"] for p in data]
for platform_id in expected_ids:
assert platform_id in platform_ids

run_search("mkr1000", ["arduino:samd"])
run_search("mkr 1000", ["arduino:samd"])

run_search("yún", ["arduino:avr"])
run_search("yùn", ["arduino:avr"])
run_search("yun", ["arduino:avr"])

run_search("nano", ["arduino:avr", "arduino:megaavr", "arduino:samd", "arduino:mbed_nano"])
run_search("nano 33", ["arduino:samd", "arduino:mbed_nano"])
run_search("nano ble", ["arduino:mbed_nano"])
run_search("ble", ["arduino:mbed_nano"])
run_search("ble nano", ["arduino:mbed_nano"])


def test_core_search_no_args(run_command, httpserver):
"""
This tests `core search` with and without additional URLs in case no args
Expand Down