@@ -648,6 +648,113 @@ def _test_different_names(base_conf, target_conf):
648648 )
649649
650650
651+ def _test_storage (base_conf , target_conf ):
652+ # Check the update of Ebs,Efs,FsxLustreSettings
653+ # with both updatable and not updatable keys
654+ for storage_type in ("Ebs" , "Efs" , "FsxLustre" ):
655+ storage_name = storage_type .lower ()
656+ base_conf ["SharedStorage" ].append (
657+ {
658+ "Name" : f"{ storage_name } 3" ,
659+ "MountDir" : f"/{ storage_name } 3" ,
660+ "StorageType" : storage_type ,
661+ }
662+ )
663+ target_conf ["SharedStorage" ].append (
664+ {
665+ "Name" : f"{ storage_name } 3" ,
666+ "MountDir" : f"/{ storage_name } 3" ,
667+ "StorageType" : storage_type ,
668+ f"{ storage_type } Settings" : {"DeletionPolicy" : "Retain" },
669+ }
670+ )
671+ base_conf ["SharedStorage" ].append (
672+ {
673+ "Name" : f"{ storage_name } 4" ,
674+ "MountDir" : f"/{ storage_name } 4" ,
675+ "StorageType" : storage_type ,
676+ }
677+ )
678+ target_conf ["SharedStorage" ].append (
679+ {
680+ "Name" : f"{ storage_name } 4" ,
681+ "MountDir" : f"/{ storage_name } 4" ,
682+ "StorageType" : storage_type ,
683+ f"{ storage_type } Settings" : {"Encrypted" : True }
684+ if storage_type in ("Ebs" , "Efs" )
685+ else {"DeploymentType" : "PERSISTENT_2" },
686+ }
687+ )
688+
689+ _check_patch (
690+ base_conf ,
691+ target_conf ,
692+ [
693+ Change (
694+ ["SharedStorage[ebs3]" , "EbsSettings" ],
695+ "DeletionPolicy" ,
696+ None ,
697+ "Retain" ,
698+ UpdatePolicy (
699+ UpdatePolicy .SUPPORTED ,
700+ ),
701+ is_list = False ,
702+ ),
703+ Change (
704+ ["SharedStorage[efs3]" , "EfsSettings" ],
705+ "DeletionPolicy" ,
706+ None ,
707+ "Retain" ,
708+ UpdatePolicy (
709+ UpdatePolicy .SUPPORTED ,
710+ ),
711+ is_list = False ,
712+ ),
713+ Change (
714+ ["SharedStorage[fsxlustre3]" , "FsxLustreSettings" ],
715+ "DeletionPolicy" ,
716+ None ,
717+ "Retain" ,
718+ UpdatePolicy (
719+ UpdatePolicy .SUPPORTED ,
720+ ),
721+ is_list = False ,
722+ ),
723+ Change (
724+ ["SharedStorage[ebs4]" , "EbsSettings" ],
725+ "Encrypted" ,
726+ None ,
727+ True ,
728+ UpdatePolicy (
729+ UpdatePolicy .UNSUPPORTED ,
730+ ),
731+ is_list = False ,
732+ ),
733+ Change (
734+ ["SharedStorage[efs4]" , "EfsSettings" ],
735+ "Encrypted" ,
736+ None ,
737+ True ,
738+ UpdatePolicy (
739+ UpdatePolicy .UNSUPPORTED ,
740+ ),
741+ is_list = False ,
742+ ),
743+ Change (
744+ ["SharedStorage[fsxlustre4]" , "FsxLustreSettings" ],
745+ "DeploymentType" ,
746+ None ,
747+ "PERSISTENT_2" ,
748+ UpdatePolicy (
749+ UpdatePolicy .UNSUPPORTED ,
750+ ),
751+ is_list = False ,
752+ ),
753+ ],
754+ UpdatePolicy .UNSUPPORTED ,
755+ )
756+
757+
651758@pytest .mark .parametrize (
652759 "test" ,
653760 [
@@ -658,6 +765,7 @@ def _test_different_names(base_conf, target_conf):
658765 _test_different_names ,
659766 _test_compute_resources ,
660767 _test_queues ,
768+ _test_storage ,
661769 ],
662770)
663771def test_adaptation (mocker , test_datadir , pcluster_config_reader , test ):
0 commit comments