@cloudbeat/atlas-cli 0.4.0 → 0.4.2

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.
@@ -47,19 +47,24 @@ function registerCapacity(program) {
47
47
  .option('--json', 'machine-readable output')
48
48
  .action(async (opts) => {
49
49
  const api = api_1.AtlasApi.fromConfig();
50
- const [servers, clusters] = await Promise.all([api.servers(), api.clusters()]);
51
- // Caps and quota are newer than the fleet endpoints; an Atlas that predates
52
- // them should still answer the main question rather than failing outright.
50
+ // Only servers are essential. Caps and quota are newer than the fleet
51
+ // endpoints, and listing clusters needs account-admin rights an operator
52
+ // does not have (403) — none of that should stop the command answering
53
+ // the main question, which is what this credential can run on.
53
54
  const optional = async (call) => call.catch(() => null);
54
- const [fleet, quota] = await Promise.all([
55
+ const [servers, clusterList, fleet, quota] = await Promise.all([
56
+ api.servers(),
57
+ optional(api.clusters()),
55
58
  optional(api.fleet()),
56
59
  optional(api.quota()),
57
60
  ]);
61
+ const clusters = clusterList ?? [];
58
62
  const free = servers.filter(s => !s.jmeter_running);
59
63
  if (opts.json) {
60
64
  (0, ui_1.json)({
61
65
  servers,
62
66
  clusters,
67
+ clustersVisible: clusterList !== null,
63
68
  fleet,
64
69
  quota,
65
70
  available: { servers: free.length, of: servers.length },
@@ -114,6 +114,16 @@ function registerResults(program) {
114
114
  const res = await api.stop(testId);
115
115
  if (opts.json)
116
116
  (0, ui_1.json)({ testId, ...res });
117
+ // A run that had already ended is not a failed stop. Without this, every
118
+ // naturally-finished run answers with its (powered-off) servers listed as
119
+ // unreachable, which reads like the test is still out there running.
120
+ if (res.alreadyFinished) {
121
+ if (!opts.json) {
122
+ const when = res.finishedAt ? new Date(res.finishedAt).toLocaleString() : 'earlier';
123
+ ui_1.log.ok(`${testId} had already finished (${when}) — nothing to stop.`);
124
+ }
125
+ return;
126
+ }
117
127
  if (res.unreachable?.length || res.stillRunning?.length) {
118
128
  // The API only marks a server stopped once it confirms the process is
119
129
  // gone; anything else must be surfaced, not rounded up to success.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbeat/atlas-cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Atlas CLI — run JMeter load tests from CI and record scenarios",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {