weizhouapache commented on code in PR #11931:
URL: https://github.com/apache/cloudstack/pull/11931#discussion_r4398396735
##########
test/integration/smoke/test_backup_recovery_nas.py:
##########
@@ -72,14 +113,22 @@ def setUpClass(cls):
cls._cleanup = [cls.account]
- # Create NAS backup repository and offering. Use the same directory as
the storage pool
+ # Create NAS backup repository and offering.
cls.backup_repository = BackupRepository.add(cls.api_client,
zoneid=cls.zone.id, name="Nas",
-
address=cls.storage_pool.ipaddress + ":" + cls.storage_pool.path,
+
address=cls.nas_repository_address,
provider="nas",
type="nfs",)
cls._cleanup.append(cls.backup_repository)
+ # Match the external offering to the repository just created above by
externalid
+ # (== the repository's own id for the nas provider) rather than
blindly taking
+ # index 0 -- a stray repository left over from an earlier interrupted
run (e.g.
+ # one whose backups didn't get cleaned up, so its own teardown
couldn't remove
+ # it either) sorts alongside the new one, and index 0 has no guarantee
of being
+ # the one this run owns.
cls.provider_offerings = BackupOffering.listExternal(cls.api_client,
cls.zone.id)
- cls.backup_offering = BackupOffering.importExisting(cls.api_client,
cls.zone.id, cls.provider_offerings[0].externalid,
-
cls.provider_offerings[0].name, cls.provider_offerings[0].description)
+ matching_offerings = [o for o in cls.provider_offerings if
o.externalid == cls.backup_repository.id]
+ provider_offering = matching_offerings[0] if matching_offerings else
cls.provider_offerings[0]
+ cls.backup_offering = BackupOffering.importExisting(cls.api_client,
cls.zone.id, provider_offering.externalid,
+
provider_offering.name, provider_offering.description)
Review Comment:
it is not considered in the orignal code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]