@optimizely/ocp-cli 1.2.11 → 1.2.14-beta.0
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/dist/commands/app/Init.js +1 -1
- package/dist/commands/app/Init.js.map +1 -1
- package/dist/commands/directory/ListFunctions.js +4 -1
- package/dist/commands/directory/ListFunctions.js.map +1 -1
- package/dist/commands/directory/ListSourceFunctions.d.ts +7 -0
- package/dist/commands/directory/ListSourceFunctions.js +83 -0
- package/dist/commands/directory/ListSourceFunctions.js.map +1 -0
- package/dist/lib/Rivendell.d.ts +1 -0
- package/dist/lib/Rivendell.js.map +1 -1
- package/dist/oo-cli.manifest.json +41 -1
- package/package.json +10 -6
- package/src/commands/app/Init.ts +1 -1
- package/src/commands/directory/ListFunctions.ts +5 -1
- package/src/commands/directory/ListSourceFunctions.ts +67 -0
- package/src/lib/Rivendell.ts +1 -0
- package/src/test/e2e/__tests__/accounts/accounts.test.ts +120 -0
- package/src/test/e2e/__tests__/availability/availability.test.ts +156 -0
- package/src/test/e2e/__tests__/directory/directory.test.ts +668 -0
- package/src/test/e2e/__tests__/jobs/jobs.test.ts +487 -0
- package/src/test/e2e/__tests__/review/review.test.ts +355 -0
- package/src/test/e2e/config/fixture-loader.ts +130 -0
- package/src/test/e2e/config/setup.ts +29 -0
- package/src/test/e2e/config/test-data-config.ts +27 -0
- package/src/test/e2e/config/test-data-helpers.ts +23 -0
- package/src/test/e2e/fixtures/baselines/accounts/whoami.txt +11 -0
- package/src/test/e2e/fixtures/baselines/accounts/whois.txt +4 -0
- package/src/test/e2e/fixtures/baselines/directory/info.txt +7 -0
- package/src/test/e2e/fixtures/baselines/directory/list.txt +4 -0
- package/src/test/e2e/fixtures/baselines/jobs/list.txt +4 -0
- package/src/test/e2e/fixtures/baselines/review/list.txt +4 -0
- package/src/test/e2e/lib/base-test.ts +150 -0
- package/src/test/e2e/lib/command-discovery.ts +324 -0
- package/src/test/e2e/utils/baseline-normalizer.ts +79 -0
- package/src/test/e2e/utils/cli-executor.ts +349 -0
- package/src/test/e2e/utils/command-registry.ts +99 -0
- package/src/test/e2e/utils/output-validator.ts +661 -0
- package/src/test/setup.ts +3 -1
- package/src/test/tsconfig.json +17 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/setup.js +0 -4
- package/dist/test/setup.js.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { BaseE2ETest } from '../../lib/base-test';
|
|
2
|
+
|
|
3
|
+
class AvailabilityE2ETest extends BaseE2ETest {
|
|
4
|
+
// Availability commands
|
|
5
|
+
async runListCommand() {
|
|
6
|
+
return this.execute(['availability', 'list']);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Public wrapper methods to access protected assertions
|
|
10
|
+
public checkSuccess(result: any) {
|
|
11
|
+
this.assertSuccess(result);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public checkFailure(result: any) {
|
|
15
|
+
this.assertFailure(result);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public checkOutputContains(result: any, text: string) {
|
|
19
|
+
this.assertOutputContains(result, text);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public clearHistory() {
|
|
23
|
+
this.cliExecutor.clearProcessHistory();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public executePublic(args: string[], options?: any) {
|
|
27
|
+
return this.execute(args, options);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('Availability Commands E2E Tests', () => {
|
|
32
|
+
let testInstance: AvailabilityE2ETest;
|
|
33
|
+
|
|
34
|
+
beforeAll(() => {
|
|
35
|
+
testInstance = new AvailabilityE2ETest();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterAll(async () => {
|
|
39
|
+
if (testInstance) {
|
|
40
|
+
await testInstance.cleanup();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
// Clean up process history after each test
|
|
46
|
+
if (testInstance) {
|
|
47
|
+
testInstance.clearHistory();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('availability list', () => {
|
|
52
|
+
it('should list all availability zones', async () => {
|
|
53
|
+
const result = await testInstance.runListCommand();
|
|
54
|
+
|
|
55
|
+
expect(result.exitCode).toBe(0);
|
|
56
|
+
expect(result.stdout).toBeTruthy();
|
|
57
|
+
|
|
58
|
+
// Check for table headers
|
|
59
|
+
expect(result.stdout).toMatch(/Name/);
|
|
60
|
+
expect(result.stdout).toMatch(/Description/);
|
|
61
|
+
|
|
62
|
+
// Should contain at least the 'us' availability zone
|
|
63
|
+
expect(result.stdout).toMatch(/us/);
|
|
64
|
+
expect(result.stdout).toMatch(/United States/);
|
|
65
|
+
}, 15000);
|
|
66
|
+
|
|
67
|
+
it('should return well-formatted output', async () => {
|
|
68
|
+
const result = await testInstance.runListCommand();
|
|
69
|
+
|
|
70
|
+
expect(result.exitCode).toBe(0);
|
|
71
|
+
expect(result.stdout).toBeTruthy();
|
|
72
|
+
|
|
73
|
+
// Output should be tabular format
|
|
74
|
+
const lines = result.stdout.trim().split('\n').filter(line => line.trim());
|
|
75
|
+
expect(lines.length).toBeGreaterThanOrEqual(2); // At least header + one zone
|
|
76
|
+
|
|
77
|
+
// Each line should have proper spacing
|
|
78
|
+
lines.forEach(line => {
|
|
79
|
+
expect(line).toMatch(/\s+/); // Should contain whitespace for formatting
|
|
80
|
+
});
|
|
81
|
+
}, 10000);
|
|
82
|
+
|
|
83
|
+
it('should complete within reasonable time', async () => {
|
|
84
|
+
const result = await testInstance.runListCommand();
|
|
85
|
+
|
|
86
|
+
expect(result.executionTime).toBeLessThan(10000); // 10 seconds
|
|
87
|
+
expect(result.timedOut).toBe(false);
|
|
88
|
+
}, 15000);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('Error Scenarios', () => {
|
|
92
|
+
it('should handle malformed command gracefully', async () => {
|
|
93
|
+
const result = await testInstance.executePublic(['availability', 'invalid-command']);
|
|
94
|
+
|
|
95
|
+
expect(result.exitCode).not.toBe(0);
|
|
96
|
+
expect(result.stderr).toBeTruthy();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should handle unexpected parameters', async () => {
|
|
100
|
+
const result = await testInstance.executePublic(['availability', 'list', 'unexpected-param']);
|
|
101
|
+
|
|
102
|
+
// Command should either ignore extra params or fail gracefully
|
|
103
|
+
expect(result.exitCode).toBeDefined();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('Performance Tests', () => {
|
|
108
|
+
it('should complete availability list within reasonable time', async () => {
|
|
109
|
+
const result = await testInstance.runListCommand();
|
|
110
|
+
|
|
111
|
+
expect(result.executionTime).toBeLessThan(10000); // 10 seconds
|
|
112
|
+
expect(result.executionTime).toBeGreaterThan(0);
|
|
113
|
+
}, 15000);
|
|
114
|
+
|
|
115
|
+
it('should handle multiple concurrent requests', async () => {
|
|
116
|
+
const promises = Array(3).fill(null).map(() => testInstance.runListCommand());
|
|
117
|
+
const results = await Promise.all(promises);
|
|
118
|
+
|
|
119
|
+
results.forEach(result => {
|
|
120
|
+
expect(result.exitCode).toBe(0);
|
|
121
|
+
expect(result.stdout).toBeTruthy();
|
|
122
|
+
expect(result.executionTime).toBeLessThan(15000);
|
|
123
|
+
});
|
|
124
|
+
}, 25000);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('Output Validation', () => {
|
|
128
|
+
it('should contain expected availability zones', async () => {
|
|
129
|
+
const result = await testInstance.runListCommand();
|
|
130
|
+
|
|
131
|
+
expect(result.exitCode).toBe(0);
|
|
132
|
+
expect(result.stdout).toBeTruthy();
|
|
133
|
+
|
|
134
|
+
// Should contain standard zones
|
|
135
|
+
expect(result.stdout).toMatch(/us/i);
|
|
136
|
+
|
|
137
|
+
// Check that output is properly formatted
|
|
138
|
+
const lines = result.stdout.trim().split('\n');
|
|
139
|
+
const headerLine = lines.find(line => line.includes('Name') && line.includes('Description'));
|
|
140
|
+
expect(headerLine).toBeTruthy();
|
|
141
|
+
}, 10000);
|
|
142
|
+
|
|
143
|
+
it('should not contain sensitive information in output', async () => {
|
|
144
|
+
const result = await testInstance.runListCommand();
|
|
145
|
+
|
|
146
|
+
expect(result.exitCode).toBe(0);
|
|
147
|
+
expect(result.stdout).toBeTruthy();
|
|
148
|
+
|
|
149
|
+
// Output should not contain sensitive data patterns
|
|
150
|
+
expect(result.stdout).not.toMatch(/password/i);
|
|
151
|
+
expect(result.stdout).not.toMatch(/token/i);
|
|
152
|
+
expect(result.stdout).not.toMatch(/secret/i);
|
|
153
|
+
expect(result.stdout).not.toMatch(/key/i);
|
|
154
|
+
}, 10000);
|
|
155
|
+
});
|
|
156
|
+
});
|