Skip to content

Commit 431ebfc

Browse files
feat: global wait (#669)
* test: dump output when testing * test: assert stderr * redact stderr too * fix: redact full flag values including PEM, silence setup_file noise * feat: global wait * feat: wait should wait until all parent resources are AVAILABLE * fix: capture from regional URLs too * feat: --wait for delete too, better capture href * bump default timeout 10min * test: globalwait tests * feat: rm old code, --wait-for-request and --wait-for-state just sets --wait * fix: wrap each SDK client transport individually, add double-wrap guard * fix: skip wait when command fails, surface re-render errors, defer SetRerendering * fix: use strict UUID regex in looksLikeResourceID to avoid false positives * fix: handle 401/403 in poll, check HTTP status in fetchJSON, use net/url for query params, include URL in errors, track firstSuccessfulPoll * fix: add -t shorthand * fix: no-state resources treated as ready, promote-volume manual check, remove -t global shorthand, update bats tests * regen docs * doc: add global --wait to changelog * test: add --wait to tests * fix: remove old per-command waitfor calls, globalwait handles all waiting Only exception: server create --promote-volume keeps inline WaitForState since it needs fresh server data before the command returns. * fix: update help text to reference --wait instead of old flags * fix: handle 429 rate limit, cache viper in transport, fix relative URLs, structured JSON progress * doc: regen docs * test: remove dead WaitForRequest/WaitForState error tests These tested old per-command waiter error propagation which was removed. Waiting is now handled by globalwait at the transport/post-command layer. * fix: capture relative hrefs from response body for resource refetch CloudAPI returns relative hrefs (e.g. /cloudapi/v6/datacenters/<uuid>). BeforeRender was skipping these, causing FetchResource to use the wrong URL (collection endpoint from transport) and get 404. buildFullURL already handles resolving relative hrefs to absolute. * fix: treat 404 as transient during create/update, terminal only for delete Resources can temporarily return 404 during provisioning. Only treat 404 as "done" when the operation was a DELETE. Track HTTP method in globalwait state from the capturing transport. * deps: fix vulns 1.25 * fix: no-state resources treated as ready, skip JSON progress, validate format before suppressing output * fix: poll request status before resource state, skip action endpoints, fix mongodb.bats * fix: build resource URL from collection URL + id for APIs without href * fix: use distinct progress messages for request vs state polling * fix: single progress bar for all wait phases * test: remove timeout flags * refactor: extract poller struct to reduce parameter counts in polling functions * fix: deprecated --wait flags not activating wait, action endpoint detection, missing contract header, silent 400 success * fix: review * rm: dead code * doc: update changelog * do not retry on 5xx * test: cover test gaps * fix: review comments * wait for GET commands too * refactor: fewer exported funcs * test: fix mariadb and label teests * test: reduce sleeps * test: remove newline test * fix: 400 for waiting on APIs without href * preserve command state on FAILED, ERROR states * feat: get should wait for DELETING resources too * fix: waiting in interactive shell * fix: server list --all * doc: make docs * test: fix postgres test * fix: fallback to before --wait output if fail rerender. Fail command if both empty * review: fix review issues * refactor: promote-volume use new waiter * refactor: struct Waiter * remove waiting... from list as is no-op. add this mention to helptext * action endpoints with no URL should just return * warn on no location to wait on
1 parent 37a5cb9 commit 431ebfc

712 files changed

Lines changed: 5222 additions & 5190 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
## [v6.10.1] – May 2026
44

55
### Added
6-
- Added `object-storage` support, with `whoami --provenance` credentials resolution
6+
- **Global `--wait` (`-w`) flag**: Waits for any resource to reach a terminal ready state (AVAILABLE, ACTIVE, READY, DONE, INACTIVE, SUSPENDED) after create, update, delete, or detach operations. Replaces the old per-command `--wait-for-request` and `--wait-for-state` flags and works across all IONOS Cloud services. After the target resource is ready, it also waits for all parent resources in the hierarchy to become AVAILABLE.
7+
- **`object-storage` commands**: Added support for bucket and object operations against the IONOS S3-compatible Object Storage API. Uses existing IONOS credentials with automatic endpoint resolution via `whoami --provenance`.
78
- Added `--ftp-port` on `image upload` which is usable in combination with `--ftp-url`.
9+
10+
### Deprecated
11+
- `--wait-for-request`, `--wait-for-state`, `--wait-for-deletion`: Still work but are hidden from help. Use `--wait` instead.
12+
- `-W` shorthand (was `--wait-for-state`): Removed due to conflict with `--weight` (`-W`) in NLB and target group commands.
13+
- `-t` shorthand for `--token-id` (container-registry token commands), `--token` (`cfg login`, `token` subcommands), and `--type` (dns record create): Removed to avoid conflict with the global `--timeout` (`-t`) flag. Use the long form instead.
14+
15+
### Known Limitations
16+
- `--wait` combined with `--all` (bulk delete) only waits for the last deleted resource, not all of them. For guaranteed completion of all deletions, delete resources individually with `--wait`.
17+
818
### Changed
919
- Aligned customer-facing brand references to "IONOS CLOUD" in CLI help text, godoc, and release-config descriptions (no behaviour change).
20+
- Default `--timeout` increased from 60s to 600s (10 minutes) to accommodate long-running provisioning operations (e.g. K8s clusters, DBaaS). Per-command timeout defaults have been removed in favour of the global default.
21+
- Removed dead per-resource waiter code (K8s, NatGateway, NLB, ALB, Postgres). Only `ServerStateInterrogator` retained for `--promote-volume`.
1022
- Improved `ionosctl --help` output: rewrote command short descriptions for consistency and grouped commands into sections.
1123
- Improve `ionosctl shell` interactive shell prompt:
1224
- Removed beta warnings and notes. Interactive prompts (e.g. delete confirmations) now work natively instead of requiring `--force`.

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,21 @@ ionosctl datacenter get --datacenter-id <id> --depth 3
243243

244244
### Waiting for Resources
245245

246-
Many create/update/delete operations return immediately while the resource is being provisioned. ionosctl commands that modify resources typically support a `--wait-for-request` (`-w`) flag to block until the operation completes:
246+
Many create/update/delete operations return immediately while the resource is being provisioned. Use the global `--wait` (`-w`) flag to block until the resource reaches AVAILABLE state:
247247

248248
```bash
249249
# Wait for server to be fully provisioned
250-
ionosctl server create --datacenter-id <id> --name "my-server" --cores 2 --ram 4096 --wait-for-request
250+
ionosctl server create --datacenter-id <id> --name "my-server" --cores 2 --ram 4096 --wait
251251

252252
# Wait for deletion to complete
253-
ionosctl server delete --datacenter-id <id> --server-id <id> --force --wait-for-request
253+
ionosctl server delete --datacenter-id <id> --server-id <id> --force --wait
254+
255+
# Custom timeout (default: 600s)
256+
ionosctl dbaas postgres cluster create --name "my-db" --wait --timeout 1200
254257
```
255258

259+
> **Note:** `--wait` combined with `--all` (bulk delete) only waits for the last deleted resource. For guaranteed completion of all deletions, delete resources individually with `--wait`.
260+
256261
### Scripting & Automation
257262

258263
ionosctl is designed to work well in scripts and CI/CD pipelines:
@@ -261,11 +266,11 @@ ionosctl is designed to work well in scripts and CI/CD pipelines:
261266
# Use JSON output + jq for programmatic access
262267
DC_ID=$(ionosctl datacenter list --output json | jq -r '.[0].id')
263268

264-
# Combine --force and --wait-for-request for unattended operations
265-
ionosctl server delete --datacenter-id "$DC_ID" --server-id "$SRV_ID" --force --wait-for-request
269+
# Combine --force and --wait for unattended operations
270+
ionosctl server delete --datacenter-id "$DC_ID" --server-id "$SRV_ID" --force --wait
266271

267272
# Use --quiet to suppress output in scripts (only errors go to stderr)
268-
ionosctl volume create --datacenter-id "$DC_ID" --name "data" --size 50 --quiet --wait-for-request
273+
ionosctl volume create --datacenter-id "$DC_ID" --name "data" --size 50 --quiet --wait
269274

270275
# Delete all servers in a datacenter
271276
ionosctl server delete --datacenter-id "$DC_ID" --all --force
@@ -300,7 +305,8 @@ These flags are available on all (or most) commands:
300305
| `--quiet` | `-q` | Suppress all output except errors |
301306
| `--force` | `-f` | Skip confirmation prompts (for destructive commands) |
302307
| `--all` | `-a` | Target all resources (for delete/remove commands) |
303-
| `--wait-for-request` | `-w` | Block until the API operation completes |
308+
| `--wait` | `-w` | Wait for resource to reach AVAILABLE state |
309+
| `--timeout` | `-t` | Timeout in seconds for `--wait` (default: 600) |
304310
| `--verbose` | `-v` | Increase verbosity (`-v`, `-vv`, `-vvv`) |
305311
| `--no-headers` | | Hide table column headers |
306312
| `--cols` | | Select specific output columns |

commands/compute/applicationloadbalancer/applicationloadbalancer_test.go

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -217,39 +217,6 @@ func TestRunApplicationLoadBalancerGetResponse(t *testing.T) {
217217
})
218218
}
219219

220-
func TestRunApplicationLoadBalancerGetWait(t *testing.T) {
221-
var b bytes.Buffer
222-
w := bufio.NewWriter(&b)
223-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
224-
viper.Reset()
225-
viper.Set(constants.ArgQuiet, false)
226-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
227-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testApplicationLoadBalancerVar)
228-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testApplicationLoadBalancerVar)
229-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForState), true)
230-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().Get(testApplicationLoadBalancerVar, testApplicationLoadBalancerVar).Return(&applicationloadbalancerTestGet, nil, nil)
231-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().Get(testApplicationLoadBalancerVar, testApplicationLoadBalancerVar).Return(&applicationloadbalancerTestGet, nil, nil)
232-
err := RunApplicationLoadBalancerGet(cfg)
233-
assert.NoError(t, err)
234-
})
235-
}
236-
237-
func TestRunApplicationLoadBalancerGetWaitErr(t *testing.T) {
238-
var b bytes.Buffer
239-
w := bufio.NewWriter(&b)
240-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
241-
viper.Reset()
242-
viper.Set(constants.ArgQuiet, false)
243-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
244-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testApplicationLoadBalancerVar)
245-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testApplicationLoadBalancerVar)
246-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForState), true)
247-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().Get(testApplicationLoadBalancerVar, testApplicationLoadBalancerVar).Return(&applicationloadbalancerTestGet, nil, testApplicationLoadBalancerErr)
248-
err := RunApplicationLoadBalancerGet(cfg)
249-
assert.Error(t, err)
250-
})
251-
}
252-
253220
func TestRunApplicationLoadBalancerGetErr(t *testing.T) {
254221
var b bytes.Buffer
255222
w := bufio.NewWriter(&b)
@@ -322,27 +289,6 @@ func TestRunApplicationLoadBalancerCreateErr(t *testing.T) {
322289
})
323290
}
324291

325-
func TestRunApplicationLoadBalancerCreateWaitErr(t *testing.T) {
326-
var b bytes.Buffer
327-
w := bufio.NewWriter(&b)
328-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
329-
viper.Reset()
330-
viper.Set(constants.ArgQuiet, false)
331-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
332-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testApplicationLoadBalancerVar)
333-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgName), testApplicationLoadBalancerVar)
334-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgIps), testApplicationLoadBalancerVar)
335-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgPrivateIps), testApplicationLoadBalancerVar)
336-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgTargetLan), testApplicationLoadBalancerIntVar)
337-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgListenerLan), testApplicationLoadBalancerIntVar)
338-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForRequest), true)
339-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().Create(testApplicationLoadBalancerVar, applicationloadbalancerTest).Return(&applicationloadbalancerTest, &testutil.TestResponse, nil)
340-
rm.CloudApiV6Mocks.Request.EXPECT().GetStatus(testutil.TestRequestIdVar).Return(&testutil.TestRequestStatus, nil, testutil.TestRequestErr)
341-
err := RunApplicationLoadBalancerCreate(cfg)
342-
assert.Error(t, err)
343-
})
344-
}
345-
346292
func TestRunApplicationLoadBalancerUpdate(t *testing.T) {
347293
var b bytes.Buffer
348294
w := bufio.NewWriter(&b)
@@ -383,28 +329,6 @@ func TestRunApplicationLoadBalancerUpdateErr(t *testing.T) {
383329
})
384330
}
385331

386-
func TestRunApplicationLoadBalancerUpdateWaitErr(t *testing.T) {
387-
var b bytes.Buffer
388-
w := bufio.NewWriter(&b)
389-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
390-
viper.Reset()
391-
viper.Set(constants.ArgQuiet, false)
392-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
393-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testApplicationLoadBalancerVar)
394-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testApplicationLoadBalancerVar)
395-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgName), testApplicationLoadBalancerNewVar)
396-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgIps), testApplicationLoadBalancerNewVar)
397-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgPrivateIps), testApplicationLoadBalancerNewVar)
398-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgTargetLan), testApplicationLoadBalancerNewIntVar)
399-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgListenerLan), testApplicationLoadBalancerNewIntVar)
400-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForRequest), true)
401-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().Update(testApplicationLoadBalancerVar, testApplicationLoadBalancerVar, applicationloadbalancerProperties).Return(&applicationloadbalancerNew, &testutil.TestResponse, nil)
402-
rm.CloudApiV6Mocks.Request.EXPECT().GetStatus(testutil.TestRequestIdVar).Return(&testutil.TestRequestStatus, nil, testutil.TestRequestErr)
403-
err := RunApplicationLoadBalancerUpdate(cfg)
404-
assert.Error(t, err)
405-
})
406-
}
407-
408332
func TestRunApplicationLoadBalancerDelete(t *testing.T) {
409333
var b bytes.Buffer
410334
w := bufio.NewWriter(&b)
@@ -504,24 +428,6 @@ func TestRunApplicationLoadBalancerDeleteErr(t *testing.T) {
504428
})
505429
}
506430

507-
func TestRunApplicationLoadBalancerDeleteWaitErr(t *testing.T) {
508-
var b bytes.Buffer
509-
w := bufio.NewWriter(&b)
510-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
511-
viper.Reset()
512-
viper.Set(constants.ArgQuiet, false)
513-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
514-
viper.Set(constants.ArgForce, true)
515-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testApplicationLoadBalancerVar)
516-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testApplicationLoadBalancerVar)
517-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForRequest), true)
518-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().Delete(testApplicationLoadBalancerVar, testApplicationLoadBalancerVar).Return(&testutil.TestResponse, nil)
519-
rm.CloudApiV6Mocks.Request.EXPECT().GetStatus(testutil.TestRequestIdVar).Return(&testutil.TestRequestStatus, nil, testutil.TestRequestErr)
520-
err := RunApplicationLoadBalancerDelete(cfg)
521-
assert.Error(t, err)
522-
})
523-
}
524-
525431
func TestRunApplicationLoadBalancerDeleteAskForConfirm(t *testing.T) {
526432
var b bytes.Buffer
527433
w := bufio.NewWriter(&b)

commands/compute/applicationloadbalancer/create.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55

66
"github.com/ionos-cloud/ionosctl/v6/commands/compute/completer"
7-
"github.com/ionos-cloud/ionosctl/v6/internal/constants"
87
"github.com/ionos-cloud/ionosctl/v6/internal/core"
98
cloudapiv6 "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6"
109
"github.com/spf13/cobra"
@@ -19,7 +18,7 @@ func ApplicationLoadBalancerCreateCmd() *core.Command {
1918
ShortDesc: "Create an Application Load Balancer",
2019
LongDesc: `Use this command to create an Application Load Balancer in a specified Virtual Data Center.
2120
22-
You can wait for the Request to be executed using ` + "`" + `--wait-for-request` + "`" + ` option.
21+
Use ` + "`" + `--wait` + "`" + ` (` + "`" + `-w` + "`" + `) to wait for the resource to reach AVAILABLE state.
2322
2423
Required values to run command:
2524
@@ -38,8 +37,6 @@ Required values to run command:
3837
cmd.AddIntFlag(cloudapiv6.ArgTargetLan, "", 1, "ID of the balanced private target LAN (outbound).")
3938
cmd.AddStringSliceFlag(cloudapiv6.ArgIps, "", nil, "Collection of the Application Load Balancer IP addresses. (Inbound and outbound) IPs of the listenerLan are customer-reserved public IPs for the public Load Balancers, and private IPs for the private Load Balancers.")
4039
cmd.AddStringSliceFlag(cloudapiv6.ArgPrivateIps, "", nil, "Collection of private IP addresses with the subnet mask of the Application Load Balancer. IPs must contain valid a subnet mask. If no IP is provided, the system will generate an IP with /24 subnet.")
41-
cmd.AddBoolFlag(constants.ArgWaitForRequest, constants.ArgWaitForRequestShort, constants.DefaultWait, "Wait for the Request for Application Load Balancer creation to be executed")
42-
cmd.AddIntFlag(constants.ArgTimeout, constants.ArgTimeoutShort, cloudapiv6.AlbTimeoutSeconds, "Timeout option for Request for Application Load Balancer creation [seconds]")
4340

4441
return cmd
4542
}

commands/compute/applicationloadbalancer/delete.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55

66
"github.com/ionos-cloud/ionosctl/v6/commands/compute/completer"
7-
"github.com/ionos-cloud/ionosctl/v6/internal/constants"
87
"github.com/ionos-cloud/ionosctl/v6/internal/core"
98
cloudapiv6 "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6"
109
"github.com/spf13/cobra"
@@ -20,7 +19,7 @@ func ApplicationLoadBalancerDeleteCmd() *core.Command {
2019
ShortDesc: "Delete an Application Load Balancer",
2120
LongDesc: `Use this command to delete a specified Application Load Balancer from a Virtual Data Center.
2221
23-
You can wait for the Request to be executed using ` + "`" + `--wait-for-request` + "`" + ` or ` + "`" + `-w` + "`" + ` option. You can force the command to execute without user input using ` + "`" + `--force` + "`" + ` option.
22+
Use ` + "`" + `--wait` + "`" + ` (` + "`" + `-w` + "`" + `) to wait for the resource to reach AVAILABLE state. You can force the command to execute without user input using ` + "`" + `--force` + "`" + ` option.
2423
2524
Required values to run command:
2625
@@ -40,8 +39,6 @@ Required values to run command:
4039
return completer.ApplicationLoadBalancersIds(viper.GetString(core.GetFlagName(deleteCmd.NS, cloudapiv6.ArgDataCenterId))), cobra.ShellCompDirectiveNoFileComp
4140
})
4241
deleteCmd.AddBoolFlag(cloudapiv6.ArgAll, cloudapiv6.ArgAllShort, false, "Delete all Application Load Balancers")
43-
deleteCmd.AddBoolFlag(constants.ArgWaitForRequest, constants.ArgWaitForRequestShort, constants.DefaultWait, "Wait for the Request for Application Load Balancer deletion to be executed")
44-
deleteCmd.AddIntFlag(constants.ArgTimeout, constants.ArgTimeoutShort, cloudapiv6.LbTimeoutSeconds, "Timeout option for Request for Application Load Balancer deletion [seconds]")
4542

4643
return deleteCmd
4744
}

commands/compute/applicationloadbalancer/flowlog/applicationloadbalancer_flowlog_test.go

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -276,27 +276,6 @@ func TestRunApplicationLoadBalancerFlowLogCreateErr(t *testing.T) {
276276
})
277277
}
278278

279-
func TestRunApplicationLoadBalancerFlowLogCreateWaitErr(t *testing.T) {
280-
var b bytes.Buffer
281-
w := bufio.NewWriter(&b)
282-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
283-
viper.Reset()
284-
viper.Set(constants.ArgQuiet, false)
285-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
286-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForRequest), true)
287-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testutil.TestFlowLogVar)
288-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testutil.TestFlowLogVar)
289-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgName), testutil.TestFlowLogVar)
290-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgAction), testutil.TestFlowLogVar)
291-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDirection), testutil.TestFlowLogVar)
292-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgS3Bucket), testutil.TestFlowLogVar)
293-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().CreateFlowLog(testutil.TestFlowLogVar, testutil.TestFlowLogVar, testutil.TestInputFlowLog).Return(&testutil.TestFlowLog, &testutil.TestResponse, nil)
294-
rm.CloudApiV6Mocks.Request.EXPECT().GetStatus(testutil.TestRequestIdVar).Return(&testutil.TestRequestStatus, nil, testutil.TestRequestErr)
295-
err := RunApplicationLoadBalancerFlowLogCreate(cfg)
296-
assert.Error(t, err)
297-
})
298-
}
299-
300279
func TestRunApplicationLoadBalancerFlowLogUpdate(t *testing.T) {
301280
var b bytes.Buffer
302281
w := bufio.NewWriter(&b)
@@ -337,28 +316,6 @@ func TestRunApplicationLoadBalancerFlowLogUpdateErr(t *testing.T) {
337316
})
338317
}
339318

340-
func TestRunApplicationLoadBalancerFlowLogUpdateWaitErr(t *testing.T) {
341-
var b bytes.Buffer
342-
w := bufio.NewWriter(&b)
343-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
344-
viper.Reset()
345-
viper.Set(constants.ArgQuiet, false)
346-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
347-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForRequest), true)
348-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testutil.TestFlowLogVar)
349-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testutil.TestFlowLogVar)
350-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgFlowLogId), testutil.TestFlowLogVar)
351-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgName), testutil.TestFlowLogNewVar)
352-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgAction), testutil.TestFlowLogNewVar)
353-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDirection), testutil.TestFlowLogNewVar)
354-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgS3Bucket), testutil.TestFlowLogNewVar)
355-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().UpdateFlowLog(testutil.TestFlowLogVar, testutil.TestFlowLogVar, testutil.TestFlowLogVar, &testutil.TestFlowLogProperties).Return(&testutil.TestFlowLogUpdated, &testutil.TestResponse, nil)
356-
rm.CloudApiV6Mocks.Request.EXPECT().GetStatus(testutil.TestRequestIdVar).Return(&testutil.TestRequestStatus, nil, testutil.TestRequestErr)
357-
err := RunApplicationLoadBalancerFlowLogUpdate(cfg)
358-
assert.Error(t, err)
359-
})
360-
}
361-
362319
func TestRunApplicationLoadBalancerFlowLogDelete(t *testing.T) {
363320
var b bytes.Buffer
364321
w := bufio.NewWriter(&b)
@@ -446,25 +403,6 @@ func TestRunApplicationLoadBalancerFlowLogDeleteErr(t *testing.T) {
446403
})
447404
}
448405

449-
func TestRunApplicationLoadBalancerFlowLogDeleteWaitErr(t *testing.T) {
450-
var b bytes.Buffer
451-
w := bufio.NewWriter(&b)
452-
core.CmdConfigTest(t, w, func(cfg *core.CommandConfig, rm *core.ResourcesMocksTest) {
453-
viper.Reset()
454-
viper.Set(constants.ArgQuiet, false)
455-
viper.Set(constants.ArgOutput, constants.DefaultOutputFormat)
456-
viper.Set(constants.ArgForce, true)
457-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgDataCenterId), testutil.TestFlowLogVar)
458-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgApplicationLoadBalancerId), testutil.TestFlowLogVar)
459-
viper.Set(core.GetFlagName(cfg.NS, cloudapiv6.ArgFlowLogId), testutil.TestFlowLogVar)
460-
viper.Set(core.GetFlagName(cfg.NS, constants.ArgWaitForRequest), true)
461-
rm.CloudApiV6Mocks.ApplicationLoadBalancer.EXPECT().DeleteFlowLog(testutil.TestFlowLogVar, testutil.TestFlowLogVar, testutil.TestFlowLogVar).Return(&testutil.TestResponse, nil)
462-
rm.CloudApiV6Mocks.Request.EXPECT().GetStatus(testutil.TestRequestIdVar).Return(&testutil.TestRequestStatus, nil, testutil.TestRequestErr)
463-
err := RunApplicationLoadBalancerFlowLogDelete(cfg)
464-
assert.Error(t, err)
465-
})
466-
}
467-
468406
func TestRunApplicationLoadBalancerFlowLogDeleteAskForConfirm(t *testing.T) {
469407
var b bytes.Buffer
470408
w := bufio.NewWriter(&b)

0 commit comments

Comments
 (0)