Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
- Fix a test case error:
Drupal\Tests\openstack\Functional\Config\OpenStackCloudConfigTest::testCloudConfig Exception: Notice: Trying to access array offset on value of type null openstack_form_cloud_config_openstack_get_region()() (Line: 296)
- Fix an error "Cannot read credentials" in OpenStack Cloud service provider
Comment | File | Size | Author |
---|---|---|---|
#25 | 3137586-25.patch | 11.24 KB | jigish.addweb |
Comments
Comment #2
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #3
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #4
yasComment #5
yasComment #6
yasComment #7
shobhit_juyal CreditAttribution: shobhit_juyal as a volunteer and at Srijan | A Material+ Company commentedHi,
I have tried to fix the issue here. And as suggested, uploading the same patch file here to review.
Note: The patch was as per the issue fixed for #3138080, I'd not recreated here.
Comment #8
yas@shobhit_juyal
Thank you for uploading the patch. Could you please re-create the patch? We've merged the patch at #3138080.
Comment #9
shobhit_juyal CreditAttribution: shobhit_juyal as a volunteer and at Srijan | A Material+ Company commentedWorking to upload patch
Comment #10
shobhit_juyal CreditAttribution: shobhit_juyal as a volunteer and at Srijan | A Material+ Company commentedHi @yas,
Here is the patch..
Comment #11
shobhit_juyal CreditAttribution: shobhit_juyal as a volunteer and at Srijan | A Material+ Company commentedComment #12
shobhit_juyal CreditAttribution: shobhit_juyal as a volunteer and at Srijan | A Material+ Company commentedneeds a review, unassigning myself.
Thanks
Comment #13
baldwinlouie CreditAttribution: baldwinlouie commentedThank you for the patches.
@all, I think we should merge the contents of both patches.
@shobhit_juyal's patch is great for fixing the PHP warning. @jigish.addweb's patch fills in the mockdata for the actual test.
Comment #14
yas@baldwinlouie
Thank you for your review. I also created the patch for the test case.
@shobhit_juyal
Thank you for re-creating the patch. The patch looks fixing the issue, and yes, actually the tests have been passed successfully however it might not fix the root cause. I guess the patch would only fix the issue by bypassing the test case. Our expectation is that OpenStack cloud service provider creation form validates if the parameter of the region is valid (= existing) or not by calling
describeRegions()
w/ the credential parameters if we pass the correct credentials.@shobhit_juyal
@jigishaddweb
I added a test case for
OpenStackCloudConfigTest::testCloudConfig()
to make it error w/ a message'Region is invalid. Please enter valid region.'
by passing a wrong input parameter of the region while saving a new OpenStack cloud service provider. So could you please check the test w/ that patch?Comment #15
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commented@yas
Thank you for the patch.
Getting below error in
OpenStackCloudConfigTest::testCloudConfig()
.Also, need to re-create the patch due to #3138473-7 patch merge.
Comment #16
yas@jigishaddweb
Yes, that's what I recognized. If my additional test case is correct (please review it carefully), the current code have something wrong so it should be fixed.
I re-created the patch for the additional test case so you can use it.
Comment #17
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #18
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #19
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #20
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commented@yas
I fixed below issues in the new patch
Please review the new patch.
Thanks
Comment #21
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #22
yas@jigishaddweb
Thank you for updating the patch. It looks good, so could you please change
isset
to!empty
?Comment #23
shobhit_juyal CreditAttribution: shobhit_juyal as a volunteer and at Srijan | A Material+ Company commentedHi @yas
Here, I guess, isset is fine because it check the existence of the array's key.
Thanks
Comment #24
yas@shobhit_juyal
Thank you for your review. We are trying to use
!empty
in any cases of theisset
context in the entire Cloud family modules sinceisset
and!empty
is not exactly the same; and!empty
will more fit to our expectation in most of cases.Especially in the following case, we don't want to pass the variable
$response['Regions']
at theif
statement in case of$response['Regions'] = []
.Moreover, we put
?: []
inforeach
statement to avoid null pointer exception. e.g.HTH
Comment #25
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedComment #26
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commented@yas Thank you for reviewing the patch.
I updated the code. Please review the updated patch.
Thanks
Comment #27
yas@jigishaddweb
Thank you for the update. It looks good to me now.
@baldwinlouie
What do you think?
Comment #28
baldwinlouie CreditAttribution: baldwinlouie commented@yas and @jigish, The patch looks good to me. I do have the following comment, but it can be another ticket for refactoring.
This can be another ticket, but I think this function can move up to aws_cloud module. aws_cloud has a similar function, and I think we can refactor this.
Comment #29
yas@baldwinlouie
Thank you for your review. That's a good point, so let's address it in another issue. I'll merge the patch to
8.x-1.x
and8.x-2.x
and close this issue asFixed
.Comment #32
yas