diff --git a/cmd/cloud/rbac_cli_test.go b/cmd/cloud/rbac_cli_test.go index a4521e97..70e1f194 100644 --- a/cmd/cloud/rbac_cli_test.go +++ b/cmd/cloud/rbac_cli_test.go @@ -39,8 +39,13 @@ func TestCreateRoleCmd(t *testing.T) { saveConfig(rbacTestAPIKey) oldURL := opts.APIURL + oldKey := opts.APIKey opts.APIURL = server.URL - defer func() { opts.APIURL = oldURL }() + opts.APIKey = rbacTestAPIKey + defer func() { + opts.APIURL = oldURL + opts.APIKey = oldKey + }() _ = createRoleCmd.Flags().Set("description", "read-only") _ = createRoleCmd.Flags().Set("permissions", string(domain.PermissionInstanceRead))