Skip to content

Commit

Permalink
Implement verify_recovery for systemimage:install
Browse files Browse the repository at this point in the history
Option as specified in ubports/installer-configs#178

Example:

```yml
- systemimage:install:
    verify_recovery: true
```
  • Loading branch information
NeoTheThird committed Mar 24, 2022
1 parent 24883f3 commit c01c54a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/core/plugins/systemimage/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SystemimagePlugin extends Plugin {
* systemimage:install action
* @returns {Promise<Array<Object>>}
*/
action__install() {
action__install({ verify_recovery } = {}) {
return api
.getImages(
this.props.settings.channel,
Expand All @@ -56,6 +56,16 @@ class SystemimagePlugin extends Plugin {
{
"adb:wait": null
},
...(verify_recovery
? [
{
"adb:assert_prop": {
prop: "ro.ubuntu.recovery",
value: "true"
}
}
]
: []),
{
"adb:preparesystemimage": null
},
Expand Down
12 changes: 10 additions & 2 deletions src/core/plugins/systemimage/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ beforeEach(() => jest.clearAllMocks());

describe("systemimage plugin", () => {
describe("actions", () => {
describe("download", () => {
it("should create download steps", () =>
describe("install", () => {
it("should create install actions", () =>
systemimage.action__install().then(r => {
expect(r).toHaveLength(1);
expect(r[0].actions).toHaveLength(5);
Expand Down Expand Up @@ -49,6 +49,14 @@ describe("systemimage plugin", () => {
}
});
}));
it("should verify recovery", () =>
systemimage.action__install({ verify_recovery: true }).then(r => {
expect(r).toHaveLength(1);
expect(r[0].actions).toHaveLength(6);
expect(r[0].actions).toContainEqual({
"adb:assert_prop": { prop: "ro.ubuntu.recovery", value: "true" }
});
}));
});
});
describe("remote_values", () => {
Expand Down

0 comments on commit c01c54a

Please sign in to comment.