@contrail/cli 3.5.5-alpha.a4b6430 → 3.5.5-alpha.a73fd77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/apps.js +0 -2
- package/dist/commands/app/upgrade.js +4 -0
- package/dist/commands/app/upgrade.spec.js +36 -0
- package/dist/interfaces.d.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/dist/api/apps.spec.js +0 -21
- /package/dist/{api/apps.spec.d.ts → commands/app/upgrade.spec.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.5.5-alpha.
|
|
20
|
+
@contrail/cli/3.5.5-alpha.a73fd77 linux-x64 node-v24.21.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
package/dist/api/apps.js
CHANGED
|
@@ -26,8 +26,6 @@ async function upgradeAppVersion(appOrg, appVersionId) {
|
|
|
26
26
|
id: appOrg.id,
|
|
27
27
|
object: {
|
|
28
28
|
appVersionId: appVersionId,
|
|
29
|
-
// The API then updates installed workflows to the new version's configuration, keeping any value the org changed.
|
|
30
|
-
syncEventWorkflowTemplates: true,
|
|
31
29
|
},
|
|
32
30
|
});
|
|
33
31
|
}
|
|
@@ -95,6 +95,10 @@ async function upgradeAndWait(appOrgToUpgrade, versionToUpgrade) {
|
|
|
95
95
|
entityName: 'app-org',
|
|
96
96
|
id: appOrgToUpgrade.id,
|
|
97
97
|
});
|
|
98
|
+
if (appStillUpgrading.status === 'READY' && appStillUpgrading.lastInstallError) {
|
|
99
|
+
logger_1.default.info(`${chalk_1.default.red.bold('APP UPGRADE')} ${appStillUpgrading.lastInstallError}`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
98
102
|
if (appStillUpgrading.status === 'READY') {
|
|
99
103
|
logger_1.default.info(`${chalk_1.default.green.bold('APP UPGRADE')} App Upgraded`);
|
|
100
104
|
return;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const get = jest.fn();
|
|
4
|
+
const update = jest.fn();
|
|
5
|
+
const info = jest.fn();
|
|
6
|
+
jest.mock('@contrail/sdk', () => ({
|
|
7
|
+
Auth: jest.fn(),
|
|
8
|
+
Entities: jest.fn(() => ({
|
|
9
|
+
get: (...args) => get(...args),
|
|
10
|
+
update: (...args) => update(...args),
|
|
11
|
+
})),
|
|
12
|
+
}));
|
|
13
|
+
jest.mock('../../common', () => ({ delay: () => Promise.resolve() }));
|
|
14
|
+
jest.mock('../../logger', () => ({ info: (...args) => info(...args) }));
|
|
15
|
+
const upgrade_1 = require("./upgrade");
|
|
16
|
+
describe('upgradeAndWait', () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
get.mockReset();
|
|
19
|
+
update.mockReset().mockResolvedValue({});
|
|
20
|
+
info.mockReset();
|
|
21
|
+
});
|
|
22
|
+
it('should report success once the app is ready', async () => {
|
|
23
|
+
get.mockResolvedValue({ status: 'READY' });
|
|
24
|
+
await (0, upgrade_1.upgradeAndWait)({ id: 'app-org-1' }, 'version-2');
|
|
25
|
+
expect(info).toHaveBeenLastCalledWith(expect.stringContaining('App Upgraded'));
|
|
26
|
+
});
|
|
27
|
+
it('should report why the upgrade was reverted instead of calling it upgraded', async () => {
|
|
28
|
+
get.mockResolvedValue({
|
|
29
|
+
status: 'READY',
|
|
30
|
+
lastInstallError: '1.0.1 could not finish installing (template write failed); reverted to 1.0.0',
|
|
31
|
+
});
|
|
32
|
+
await (0, upgrade_1.upgradeAndWait)({ id: 'app-org-1' }, 'version-2');
|
|
33
|
+
expect(info).toHaveBeenLastCalledWith(expect.stringContaining('reverted to 1.0.0'));
|
|
34
|
+
expect(info).not.toHaveBeenCalledWith(expect.stringContaining('App Upgraded'));
|
|
35
|
+
});
|
|
36
|
+
});
|
package/dist/interfaces.d.ts
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
package/dist/api/apps.spec.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const update = jest.fn();
|
|
4
|
-
jest.mock('@contrail/sdk', () => ({
|
|
5
|
-
Auth: jest.fn(),
|
|
6
|
-
Entities: jest.fn(() => ({
|
|
7
|
-
update: (...args) => update(...args),
|
|
8
|
-
})),
|
|
9
|
-
}));
|
|
10
|
-
const apps_1 = require("./apps");
|
|
11
|
-
describe('upgradeAppVersion', () => {
|
|
12
|
-
it('should ask the API to apply the new version workflow configuration along with the version change', async () => {
|
|
13
|
-
update.mockResolvedValue({ id: 'app-org-1' });
|
|
14
|
-
await (0, apps_1.upgradeAppVersion)({ id: 'app-org-1' }, 'version-2');
|
|
15
|
-
expect(update).toHaveBeenCalledWith({
|
|
16
|
-
entityName: 'app-org',
|
|
17
|
-
id: 'app-org-1',
|
|
18
|
-
object: { appVersionId: 'version-2', syncEventWorkflowTemplates: true },
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
});
|
|
File without changes
|