diff options
| author | ruki <[email protected]> | 2026-08-15 00:10:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-15 00:10:02 +0800 |
| commit | 045ce8a7a62e38357af0fd250675f279f14beafe (patch) | |
| tree | a28db860b0f7af1a5a66bf2ed29c87126a29324a /tests/actions | |
| parent | 7028d912fbeabab132e242ec1782645582a75078 (diff) | |
fix addon testpreload
Diffstat (limited to 'tests/actions')
| -rw-r--r-- | tests/actions/addon/test.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/actions/addon/test.lua b/tests/actions/addon/test.lua index 0963972a3..d59ae6f4b 100644 --- a/tests/actions/addon/test.lua +++ b/tests/actions/addon/test.lua @@ -58,6 +58,14 @@ function _with_repo(recipes, func) local cachefile = path.join(global.cachedir(), "repository") local cache = os.isfile(cachefile) and io.load(cachefile) or {} cache.repositories = cache.repositories or {} + + -- a killed test run may leave its temporary repository registered, and a dangling + -- repository breaks every following xrepo command, so we drop them here + for name, dirs in pairs(cache.repositories) do + if name:startswith("addon-test-repo-") and not os.isdir(dirs[1]) then + cache.repositories[name] = nil + end + end cache.repositories[reponame] = {repodir} io.save(cachefile, cache) os.tryrm(path.join(global.cachedir(), "quick_search")) @@ -359,8 +367,12 @@ function test_install_from_repo(t) t:require(os.iorunv("xmake", {"hello_addon"}):find("hello from custom-plugin", 1, true)) -- it should be searchable, and the addons should not be found by the package search + -- + -- @note we cannot run the `xrepo` program here, it may not be in the PATH, e.g. on the ci, + -- and `xrepo search` is just a wrapper of it + -- t:require(os.iorunv("xmake", {"addon", "--search", "custom-plugin"}):find("custom-plugin", 1, true)) - t:require_not(os.iorunv("xrepo", {"search", "custom-plugin"}):find("custom-plugin", 1, true)) + t:require_not(os.iorunv("xmake", {"lua", "private.xrepo", "search", "custom-plugin"}):find("custom-plugin", 1, true)) end) end |
