dell / terraform-provider-redfish

Terraform provider for Redfish REST APIs
https://registry.terraform.io/providers/dell/redfish/latest
Mozilla Public License 2.0
94 stars 21 forks source link

Fix: Perform firmware versioned checks for virtual_media resource import #174

Closed rounak-adhikary closed 8 months ago

rounak-adhikary commented 8 months ago

Summary

For firmware v5, we use manager URLs whereas for v6 onwards, we use system URLs. But manager URLs still gives us all the data during read on firmware v6 onwards. To eliminate confusion, I have packaged the firmware checks (originally coded in create only) into a function which will be called from create and import both. Once the resource is created or imported, it can keep using the URL stored in state.

Additionally, during import, we shall check if the virtual media is mounted or not. If not mounted, we shall throw error.

Acceptance tests for firmware v7

root@lglap049:~/terraform-provider-redfish# go test ./redfish/provider/ -v -timeout 8h -coverprofile=cover.out -run TestAccRedfishVirtualMedia
open redfish_test.env: no such file or directory
=== RUN   TestAccRedfishVirtualMedia_fetch
--- PASS: TestAccRedfishVirtualMedia_fetch (14.19s)
=== RUN   TestAccRedfishVirtualMedia_basic
--- PASS: TestAccRedfishVirtualMedia_basic (9.43s)
=== RUN   TestAccRedfishVirtualMedia_InvalidImage_Negative
--- PASS: TestAccRedfishVirtualMedia_InvalidImage_Negative (0.59s)
=== RUN   TestAccRedfishVirtualMedia_InvalidTransferMethod_Negative
--- PASS: TestAccRedfishVirtualMedia_InvalidTransferMethod_Negative (0.65s)
=== RUN   TestAccRedfishVirtualMedia_InvalidTransferProtocol_Negative
--- PASS: TestAccRedfishVirtualMedia_InvalidTransferProtocol_Negative (2.48s)
=== RUN   TestAccRedfishVirtualMediaNoMediaNegative_basic
--- PASS: TestAccRedfishVirtualMediaNoMediaNegative_basic (15.71s)
=== RUN   TestAccRedfishVirtualMediaServer2_basic
--- PASS: TestAccRedfishVirtualMediaServer2_basic (8.57s)
=== RUN   TestAccRedfishVirtualMediaServer2_InvalidTransferProtocol_Negative
--- PASS: TestAccRedfishVirtualMediaServer2_InvalidTransferProtocol_Negative (2.72s)
=== RUN   TestAccRedfishVirtualMediaServer2Update_InvalidTransferProtocol_Negative
--- PASS: TestAccRedfishVirtualMediaServer2Update_InvalidTransferProtocol_Negative (13.08s)
=== RUN   TestAccRedfishVirtualMediaUpdate_basic
--- PASS: TestAccRedfishVirtualMediaUpdate_basic (18.21s)
=== RUN   TestAccRedfishVirtualMediaUpdate_InvalidImage_Negative
--- PASS: TestAccRedfishVirtualMediaUpdate_InvalidImage_Negative (8.99s)
=== RUN   TestAccRedfishVirtualMediaUpdate_InvalidTransferMethod_Negative
--- PASS: TestAccRedfishVirtualMediaUpdate_InvalidTransferMethod_Negative (8.41s)
PASS
coverage: 11.0% of statements
ok      terraform-provider-redfish/redfish/provider     103.129s        coverage: 11.0% of statements
root@lglap049:~/terraform-provider-redfish#

Aceptance Tests for firmware v5

root@lglap049:~/terraform-provider-redfish# go test ./redfish/provider/ -v -timeout 8h -coverprofile=cover5.out -run TestAccRedfishVirtualMedia
open redfish_test.env: no such file or directory
=== RUN   TestAccRedfishVirtualMedia_fetch
--- PASS: TestAccRedfishVirtualMedia_fetch (11.34s)
=== RUN   TestAccRedfishVirtualMedia_basic
--- PASS: TestAccRedfishVirtualMedia_basic (16.40s)
=== RUN   TestAccRedfishVirtualMedia_InvalidImage_Negative
--- PASS: TestAccRedfishVirtualMedia_InvalidImage_Negative (0.60s)
=== RUN   TestAccRedfishVirtualMedia_InvalidTransferMethod_Negative
--- PASS: TestAccRedfishVirtualMedia_InvalidTransferMethod_Negative (0.66s)
=== RUN   TestAccRedfishVirtualMedia_InvalidTransferProtocol_Negative
--- PASS: TestAccRedfishVirtualMedia_InvalidTransferProtocol_Negative (3.62s)
=== RUN   TestAccRedfishVirtualMediaNoMediaNegative_basic
--- PASS: TestAccRedfishVirtualMediaNoMediaNegative_basic (11.98s)
=== RUN   TestAccRedfishVirtualMediaServer2_basic
--- PASS: TestAccRedfishVirtualMediaServer2_basic (9.38s)
=== RUN   TestAccRedfishVirtualMediaServer2_InvalidTransferProtocol_Negative
--- PASS: TestAccRedfishVirtualMediaServer2_InvalidTransferProtocol_Negative (3.57s)
=== RUN   TestAccRedfishVirtualMediaServer2Update_InvalidTransferProtocol_Negative
--- PASS: TestAccRedfishVirtualMediaServer2Update_InvalidTransferProtocol_Negative (22.84s)
=== RUN   TestAccRedfishVirtualMediaUpdate_basic
--- PASS: TestAccRedfishVirtualMediaUpdate_basic (22.16s)
=== RUN   TestAccRedfishVirtualMediaUpdate_InvalidImage_Negative
--- PASS: TestAccRedfishVirtualMediaUpdate_InvalidImage_Negative (10.70s)
=== RUN   TestAccRedfishVirtualMediaUpdate_InvalidTransferMethod_Negative
--- PASS: TestAccRedfishVirtualMediaUpdate_InvalidTransferMethod_Negative (11.82s)
PASS
coverage: 10.6% of statements
ok      terraform-provider-redfish/redfish/provider     125.170s        coverage: 10.6% of statements
root@lglap049:~/terraform-provider-redfish#
terraform-providers-svc commented 8 months ago

Can one of the admins verify this patch?