Support from Acquia helps fund testing for Drupal Acquia logo

Comments

baldwinlouie created an issue. See original summary.

baldwinlouie’s picture

Status: Active » Needs review
FileSize
785 bytes

Attaching patch with test case. Also by writing the test case, I found a bug in the VolumeAttachForm.php. This patch includes that fix as well.

baldwinlouie’s picture

FileSize
7.09 KB

Uploading a new patch. Previous patch did not include the new test case file.

yas’s picture

@baldwin,

Could you please repeat the test like the following code ? (c.f. https://www.drupal.org/project/cloud/issues/3017114)

const MAX_TEST_REPEAT_COUNT = 3;

public function testVolumeAttachDetach() {
  $this->_testVolumeAttachDetachRepeat($max_test_repeat_count = MAX_TEST_REPEAT_COUNT);
}

private function _testVolumeAttachDetachRepeat($max_test_repeat_count = 1) {
  for ($i = 0; $ < max_test_repeat_count; $i++) {
    // Actual test code here
  }
}
yas’s picture

Status: Needs review » Needs work
baldwinlouie’s picture

Status: Needs work » Needs review
FileSize
6.94 KB

Added a loop to perform the test case multiple times.

yas’s picture

@baldwinlouie

Thank you for adding the loop.

As we discussed inhttps://www.drupal.org/project/cloud/issues/3017114, what about the following as our default test case design pattern for repeating? We can show our intention to the other developer, that we repeat the test by giving the max repeat count parameter explicitly.

const MAX_TEST_REPEAT_COUNT = 3;

public function testVolumeAttachDetach() {
  $this->_testVolumeAttachDetachRepeat($max_test_repeat_count = MAX_TEST_REPEAT_COUNT);
}

private function _testVolumeAttachDetachRepeat($max_test_repeat_count = 1) {
  for ($i = 0; $ < max_test_repeat_count; $i++) {
    // Actual test code here
  }
}
baldwinlouie’s picture

FileSize
7.11 KB

@yas, I've uploaded the new patch with the design pattern we agreed on.

yas’s picture

@baldwinlouie

Thank you for the modification. Now it looks good to me.

@xiaohua-guan

Do you agree to the patch?

Xiaohua Guan’s picture

Status: Needs review » Reviewed & tested by the community

@yas

It looks ok to me. And I changed the status to RTBC.

  • yas committed b9769fe on 8.x-1.x authored by baldwinlouie
    Issue #3018419 by baldwinlouie, yas, Xiaohua Guan: Add test case for...
yas’s picture

Status: Reviewed & tested by the community » Fixed

@baldwinlouie
@xiaohua-guan

I merged it and closed this issue. Thank you for your contribution!

baldwinlouie’s picture

Status: Fixed » Needs review
FileSize
928 bytes

@yas, With the recent CamelCase refactoring, the Volume Attach/Detach test stopped working. I'm attaching an updated patch to fix this.

yas’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, I'll merge the patch. Thanks!

  • yas committed 11a2c1e on 8.x-1.x authored by baldwinlouie
    Issue #3018419 by baldwinlouie, yas, Xiaohua Guan: Add test case for...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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