Problem/Motivation

Acceptance criteria

We want to make $edit[0], $edit[1], ... until $edit[$repeat_count - 1] . In the current code, $edit will be overwritten in the loop.

BEFORE (current):

    $edit = [];
    for ($i = 0; $i < $repeat_count; $i++) {
      $edit = [
        ['k8s_js_refresh_interval' => rand(1, 9999)],
        ['k8s_update_pricing_data_cache' => !$config->get('k8s_update_pricing_data_cache')],
        ['k8s_view_expose_items_per_page' => !$config->get('k8s_view_expose_items_per_page')],
        ['k8s_view_items_per_page' => $items_per_page[array_rand($items_per_page)]],
        ['k8s_update_resources_queue_cron_time' => rand(1, 9999)],
        ['k8s_queue_limit' => rand(1, 50)],
        ['k8s_yaml_file_extensions' => $this->random->name(10, TRUE)],
      ];
    }

AFTER:

    $edit = [];
    for ($i = 0; $i < $repeat_count; $i++) {
      $edit[] = [
        'k8s_js_refresh_interval' => rand(1, 9999),
        'k8s_update_pricing_data_cache' => !$config->get('k8s_update_pricing_data_cache'),
        'k8s_view_expose_items_per_page' => !$config->get('k8s_view_expose_items_per_page'),
        'k8s_view_items_per_page' => $items_per_page[array_rand($items_per_page)],
        'k8s_update_resources_queue_cron_time' => rand(1, 9999),
        'k8s_queue_limit' => random_int(1, 50), // WE SHOULD USE `ramdom_int()`
        'k8s_yaml_file_extensions' => $this->random->name(10, TRUE),
      ];
    }

Issue fork cloud-3246330

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

yutong.li created an issue. See original summary.

yutong.li’s picture

Issue summary: View changes

yutong.li credited yas.

yutong.li’s picture

yutong.li’s picture

Status: Active » Needs review
yas’s picture

Status: Needs review » Reviewed & tested by the community

@yutong.li

Thank you for fixing the logic. It looks good to me. I'll merge the patch to 4.x and close this issue as Fixed.

  • yas committed f5a3fb9 on 4.x authored by yutong.li
    Issue #3246330 by yutong.li, yas: Fix the logic of $edit in Aws Cloud...

yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.