-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test case for installing with not listed extension (#697)
- Loading branch information
Showing
7 changed files
with
107 additions
and
4 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
22 changes: 22 additions & 0 deletions
22
tests/ten_manager/install_all/extension_not_listed_in_app/BUILD.gn
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,22 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import("//build/ten_runtime/feature/test.gni") | ||
|
||
ten_package_test_prepare_auxiliary_resources("extension_not_listed_in_app") { | ||
resources = [ | ||
"//.gnfiles/build/scripts/cmd_exec.py=>common/cmd_exec.py", | ||
"__init__.py", | ||
"test_app/manifest.json", | ||
"test_app/ten_packages/extension/ext_not_listed/manifest.json", | ||
"test_case.py", | ||
] | ||
|
||
deps = [ | ||
"//core/src/ten_manager", | ||
"//tests/local_registry", | ||
] | ||
} |
Empty file.
12 changes: 12 additions & 0 deletions
12
tests/ten_manager/install_all/extension_not_listed_in_app/test_app/manifest.json
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,12 @@ | ||
{ | ||
"type": "app", | ||
"name": "test_app", | ||
"version": "1.0.0", | ||
"dependencies": [ | ||
{ | ||
"type": "extension", | ||
"name": "ext_b", | ||
"version": "1.0.0" | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
.../extension_not_listed_in_app/test_app/ten_packages/extension/ext_not_listed/manifest.json
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,12 @@ | ||
{ | ||
"type": "extension", | ||
"name": "ext_not_listed", | ||
"version": "1.0.0", | ||
"dependencies": [ | ||
{ | ||
"type": "extension", | ||
"name": "ext_not_existed", | ||
"version": "10000.0.0" | ||
} | ||
] | ||
} |
56 changes: 56 additions & 0 deletions
56
tests/ten_manager/install_all/extension_not_listed_in_app/test_case.py
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,56 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import os | ||
import sys | ||
from .common import cmd_exec | ||
|
||
|
||
def get_installed_extensions_count(app_dir: str): | ||
extension_dir = os.path.join(app_dir, "ten_packages/extension/") | ||
extensions = os.listdir(extension_dir) | ||
|
||
return len(extensions) | ||
|
||
|
||
def test_tman_dependency_resolve(): | ||
base_path = os.path.dirname(os.path.abspath(__file__)) | ||
root_dir = os.path.join(base_path, "../../../../") | ||
|
||
if sys.platform == "win32": | ||
os.environ["PATH"] = ( | ||
os.path.join(root_dir, "ten_manager/lib") + ";" + os.getenv("PATH") | ||
) | ||
tman_bin = os.path.join(root_dir, "ten_manager/bin/tman.exe") | ||
else: | ||
tman_bin = os.path.join(root_dir, "ten_manager/bin/tman") | ||
|
||
app_dir = os.path.join(base_path, "test_app") | ||
|
||
config_file = os.path.join( | ||
root_dir, | ||
"tests/local_registry/config.json", | ||
) | ||
|
||
# Execute 'install_all' in the app. | ||
returncode, output_text = cmd_exec.run_cmd_realtime( | ||
[ | ||
tman_bin, | ||
f"--config-file={config_file}", | ||
"--yes", | ||
"install", | ||
], | ||
cwd=app_dir, | ||
) | ||
if returncode != 0: | ||
print(output_text) | ||
assert False | ||
|
||
assert get_installed_extensions_count(app_dir) == 3 | ||
|
||
|
||
if __name__ == "__main__": | ||
test_tman_dependency_resolve() |
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