-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pin rocks to prevent updates (#278)
* feat: pin rocks to prevent updates * tests: add install/pin/update integration tests
- Loading branch information
Showing
7 changed files
with
118 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local tempdir = vim.fn.tempname() | ||
vim.system({ "rm", "-r", tempdir }):wait() | ||
vim.system({ "mkdir", "-p", tempdir }):wait() | ||
vim.g.rocks_nvim = { | ||
rocks_path = tempdir, | ||
config_path = vim.fs.joinpath(tempdir, "rocks.toml"), | ||
} | ||
local nio = require("nio") | ||
vim.env.PLENARY_TEST_TIMEOUT = 60000 * 5 | ||
describe("install/update", function() | ||
local operations = require("rocks.operations") | ||
local state = require("rocks.state") | ||
nio.tests.it("install and update rocks", function() | ||
local future = nio.control.future() | ||
operations.add({ "neorg", "7.0.0" }, function() | ||
future.set(true) | ||
end) | ||
future.wait() | ||
local installed_rocks = state.installed_rocks() | ||
assert.same({ | ||
name = "neorg", | ||
version = "7.0.0", | ||
}, installed_rocks.neorg) | ||
future = nio.control.future() | ||
operations.update(function() | ||
future.set(true) | ||
end) | ||
future.wait() | ||
installed_rocks = state.installed_rocks() | ||
local updated_version = vim.version.parse(installed_rocks.neorg.version) | ||
assert.True(updated_version > vim.version.parse("7.0.0")) | ||
end) | ||
end) |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local tempdir = vim.fn.tempname() | ||
vim.system({ "rm", "-r", tempdir }):wait() | ||
vim.system({ "mkdir", "-p", tempdir }):wait() | ||
vim.g.rocks_nvim = { | ||
rocks_path = tempdir, | ||
config_path = vim.fs.joinpath(tempdir, "rocks.toml"), | ||
} | ||
local nio = require("nio") | ||
vim.env.PLENARY_TEST_TIMEOUT = 60000 * 5 | ||
describe("install/pin/update", function() | ||
local operations = require("rocks.operations") | ||
local state = require("rocks.state") | ||
nio.tests.it("update skips pinned install", function() | ||
local future = nio.control.future() | ||
operations.add({ "neorg", "7.0.0", "pin=true" }, function() | ||
future.set(true) | ||
end) | ||
future.wait() | ||
local installed_rocks = state.installed_rocks() | ||
assert.same({ | ||
name = "neorg", | ||
version = "7.0.0", | ||
}, installed_rocks["neorg"]) | ||
future = nio.control.future() | ||
operations.update(function() | ||
future.set(true) | ||
end) | ||
future.wait() | ||
installed_rocks = state.installed_rocks() | ||
assert.same({ | ||
name = "neorg", | ||
version = "7.0.0", | ||
}, installed_rocks["neorg"]) | ||
end) | ||
end) |
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