Best Python code snippet using avocado_python
test_storagespace.py
Source:test_storagespace.py
...26 return False27 else:28 return False29 reconstructor = Reconstructor(Define.WINDOWS_8, Define.RAID_LEVEL_SIMPLE)30 reconstructor.add_disk(disk1)31 reconstructor.add_disk(disk2)32 reconstructor.add_disk(disk3)33 reconstructor.parse_metadata()34 reconstructor.restore_virtual_disk()35def test_windows8_2mirror():36 disk1 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_2MIRROR)37 disk2 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_2MIRROR)38 disk3 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_2MIRROR)39 if disk1.open_disk("D:\\Windows 8.1\\02. 2Mirror\\Windows_8.1_Physical_5GB.001"):40 if disk1.parse_disk():41 pass42 else:43 return False44 else:45 return False46 if disk2.open_disk("D:\\Windows 8.1\\02. 2Mirror\\Windows_8.1_Physical_10GB.001"):47 if disk2.parse_disk():48 pass49 else:50 return False51 else:52 return False53 if disk3.open_disk("D:\\Windows 8.1\\02. 2Mirror\\Windows_8.1_Physical_15GB.001"):54 if disk3.parse_disk():55 pass56 else:57 return False58 else:59 return False60 reconstructor = Reconstructor(Define.WINDOWS_8, Define.RAID_LEVEL_2MIRROR)61 reconstructor.add_disk(disk1)62 reconstructor.add_disk(disk2)63 reconstructor.add_disk(disk3)64 reconstructor.parse_metadata()65 reconstructor.restore_virtual_disk()66def test_windows8_3mirror():67 disk1 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_3MIRROR)68 disk2 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_3MIRROR)69 disk3 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_3MIRROR)70 disk4 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_3MIRROR)71 disk5 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_3MIRROR)72 if disk1.open_disk("D:\\Windows 8.1\\03. 3Mirror\\Windows_8.1_Physical_5GB.001"):73 if disk1.parse_disk():74 pass75 else:76 return False77 else:78 return False79 if disk2.open_disk("D:\\Windows 8.1\\03. 3Mirror\\Windows_8.1_Physical_10GB.001"):80 if disk2.parse_disk():81 pass82 else:83 return False84 else:85 return False86 if disk3.open_disk("D:\\Windows 8.1\\03. 3Mirror\\Windows_8.1_Physical_15GB.001"):87 if disk3.parse_disk():88 pass89 else:90 return False91 else:92 return False93 if disk4.open_disk("D:\\Windows 8.1\\03. 3Mirror\\Windows_8.1_Physical_20GB.001"):94 if disk4.parse_disk():95 pass96 else:97 return False98 else:99 return False100 if disk5.open_disk("D:\\Windows 8.1\\03. 3Mirror\\Windows_8.1_Physical_25GB.001"):101 if disk5.parse_disk():102 pass103 else:104 return False105 else:106 return False107 reconstructor = Reconstructor(Define.WINDOWS_8, Define.RAID_LEVEL_3MIRROR)108 reconstructor.add_disk(disk1)109 reconstructor.add_disk(disk2)110 reconstructor.add_disk(disk3)111 reconstructor.add_disk(disk4)112 reconstructor.add_disk(disk5)113 reconstructor.parse_metadata()114 reconstructor.restore_virtual_disk()115def test_windows8_parity():116 disk1 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_PARITY)117 disk2 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_PARITY)118 disk3 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_PARITY)119 disk4 = StorageSpace(Define.WINDOWS_8, Define.RAID_LEVEL_PARITY)120 if disk1.open_disk("D:\\Windows 8.1\\04. Parity\\Windows_8.1_Physical_5GB.001"):121 if disk1.parse_disk():122 pass123 else:124 return False125 else:126 return False127 if disk2.open_disk("D:\\Windows 8.1\\04. Parity\\Windows_8.1_Physical_10GB.001"):128 if disk2.parse_disk():129 pass130 else:131 return False132 else:133 return False134 if disk3.open_disk("D:\\Windows 8.1\\04. Parity\\Windows_8.1_Physical_15GB.001"):135 if disk3.parse_disk():136 pass137 else:138 return False139 else:140 return False141 if disk4.open_disk("D:\\Windows 8.1\\04. Parity\\Windows_8.1_Physical_20GB.001"):142 if disk4.parse_disk():143 pass144 else:145 return False146 else:147 return False148 reconstructor = Reconstructor(Define.WINDOWS_8, Define.RAID_LEVEL_PARITY)149 reconstructor.add_disk(disk1)150 reconstructor.add_disk(disk2)151 reconstructor.add_disk(disk3)152 reconstructor.add_disk(disk4)153 reconstructor.parse_metadata()154 reconstructor.restore_virtual_disk()155def test_windows10_simple():156 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_SIMPLE)157 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_SIMPLE)158 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_SIMPLE)159 if disk1.open_disk("D:\\Windows 10\\01. Simple\\Windows_10_Physical_5GB.001"):160 if disk1.parse_disk():161 pass162 else:163 return False164 else:165 return False166 if disk2.open_disk("D:\\Windows 10\\01. Simple\\Windows_10_Physical_10GB.001"):167 if disk2.parse_disk():168 pass169 else:170 return False171 else:172 return False173 if disk3.open_disk("D:\\Windows 10\\01. Simple\\Windows_10_Physical_15GB.001"):174 if disk3.parse_disk():175 pass176 else:177 return False178 else:179 return False180 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_SIMPLE)181 reconstructor.add_disk(disk1)182 reconstructor.add_disk(disk2)183 reconstructor.add_disk(disk3)184 reconstructor.parse_metadata()185 reconstructor.restore_virtual_disk()186def test_windows10_2mirror2():187 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)188 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)189 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)190 if disk1.open_disk("D:\\temp\\5GB_1.001"):191 if disk1.parse_disk():192 pass193 else:194 return False195 else:196 return False197 if disk2.open_disk("D:\\temp\\5GB_2.001"):198 if disk2.parse_disk():199 pass200 else:201 return False202 else:203 return False204 if disk3.open_disk("D:\\temp\\5GB_3.001"):205 if disk3.parse_disk():206 pass207 else:208 return False209 else:210 return False211 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)212 reconstructor.add_disk(disk1)213 reconstructor.add_disk(disk2)214 reconstructor.add_disk(disk3)215 reconstructor.parse_metadata()216 reconstructor.restore_virtual_disk()217def test_windows10_2mirror():218 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)219 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)220 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)221 if disk1.open_disk("D:\\Windows 10\\02. 2Mirror\\Windows_10_Physical_5GB.001"):222 if disk1.parse_disk():223 pass224 else:225 return False226 else:227 return False228 if disk2.open_disk("D:\\Windows 10\\02. 2Mirror\\Windows_10_Physical_10GB.001"):229 if disk2.parse_disk():230 pass231 else:232 return False233 else:234 return False235 if disk3.open_disk("D:\\Windows 10\\02. 2Mirror\\Windows_10_Physical_15GB.001"):236 if disk3.parse_disk():237 pass238 else:239 return False240 else:241 return False242 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_2MIRROR)243 reconstructor.add_disk(disk1)244 reconstructor.add_disk(disk2)245 reconstructor.add_disk(disk3)246 reconstructor.parse_metadata()247 reconstructor.restore_virtual_disk()248def test_windows10_3mirror():249 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_3MIRROR)250 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_3MIRROR)251 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_3MIRROR)252 disk4 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_3MIRROR)253 disk5 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_3MIRROR)254 if disk1.open_disk("D:\\Windows 10\\03. 3Mirror\\Windows_10_Physical_5GB.001"):255 if disk1.parse_disk():256 pass257 else:258 return False259 else:260 return False261 if disk2.open_disk("D:\\Windows 10\\03. 3Mirror\\Windows_10_Physical_10GB.001"):262 if disk2.parse_disk():263 pass264 else:265 return False266 else:267 return False268 if disk3.open_disk("D:\\Windows 10\\03. 3Mirror\\Windows_10_Physical_15GB.001"):269 if disk3.parse_disk():270 pass271 else:272 return False273 else:274 return False275 if disk4.open_disk("D:\\Windows 10\\03. 3Mirror\\Windows_10_Physical_20GB.001"):276 if disk4.parse_disk():277 pass278 else:279 return False280 else:281 return False282 if disk5.open_disk("D:\\Windows 10\\03. 3Mirror\\Windows_10_Physical_25GB.001"):283 if disk5.parse_disk():284 pass285 else:286 return False287 else:288 return False289 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_3MIRROR)290 reconstructor.add_disk(disk1)291 reconstructor.add_disk(disk2)292 reconstructor.add_disk(disk3)293 reconstructor.add_disk(disk4)294 reconstructor.add_disk(disk5)295 reconstructor.parse_metadata()296 reconstructor.restore_virtual_disk()297def test_windows10_parity():298 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)299 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)300 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)301 disk4 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)302 # if disk1.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_5GB.001"):303 # if disk1.parse_disk():304 # pass305 # else:306 # return False307 # else:308 # return False309 #310 # if disk2.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_10GB.001"):311 # if disk2.parse_disk():312 # pass313 # else:314 # return False315 # else:316 # return False317 #318 # if disk3.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_15GB.001"):319 # if disk3.parse_disk():320 # pass321 # else:322 # return False323 # else:324 # return False325 #326 # if disk4.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_20GB.001"):327 # if disk4.parse_disk():328 # pass329 # else:330 # return False331 # else:332 # return False333 if disk1.open_disk("D:\\temp\\ì ì¥ìê³µê°\\10GB.001"):334 if disk1.parse_disk():335 pass336 else:337 return False338 else:339 return False340 if disk2.open_disk("D:\\temp\\ì ì¥ìê³µê°\\20GB.001"):341 if disk2.parse_disk():342 pass343 else:344 return False345 else:346 return False347 if disk3.open_disk("D:\\temp\\ì ì¥ìê³µê°\\30GB.001"):348 if disk3.parse_disk():349 pass350 else:351 return False352 else:353 return False354 if disk4.open_disk("D:\\temp\\ì ì¥ìê³µê°\\40GB.001"):355 if disk4.parse_disk():356 pass357 else:358 return False359 else:360 return False361 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)362 reconstructor.add_disk(disk1)363 reconstructor.add_disk(disk2)364 reconstructor.add_disk(disk3)365 reconstructor.add_disk(disk4)366 reconstructor.parse_metadata()367 reconstructor.restore_virtual_disk()368def test_windows10_parity2():369 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)370 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)371 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)372 disk4 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)373 # if disk1.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_5GB.001"):374 # if disk1.parse_disk():375 # pass376 # else:377 # return False378 # else:379 # return False380 #381 # if disk2.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_10GB.001"):382 # if disk2.parse_disk():383 # pass384 # else:385 # return False386 # else:387 # return False388 #389 # if disk3.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_15GB.001"):390 # if disk3.parse_disk():391 # pass392 # else:393 # return False394 # else:395 # return False396 #397 # if disk4.open_disk("D:\\Windows 10\\04. Parity\\Windows_10_Physical_20GB.001"):398 # if disk4.parse_disk():399 # pass400 # else:401 # return False402 # else:403 # return False404 if disk1.open_disk("F:\\10GB.vhd"):405 if disk1.parse_disk():406 pass407 else:408 return False409 else:410 return False411 if disk2.open_disk("F:\\20GB.vhd"):412 if disk2.parse_disk():413 pass414 else:415 return False416 else:417 return False418 if disk3.open_disk("F:\\30GB.vhd"):419 if disk3.parse_disk():420 pass421 else:422 return False423 else:424 return False425 if disk4.open_disk("F:\\40GB.vhd"):426 if disk4.parse_disk():427 pass428 else:429 return False430 else:431 return False432 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)433 reconstructor.add_disk(disk1)434 reconstructor.add_disk(disk2)435 reconstructor.add_disk(disk3)436 reconstructor.add_disk(disk4)437 reconstructor.parse_metadata()438 reconstructor.restore_virtual_disk()439def test_windows_server_2012_simple():440 disk1 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_SIMPLE)441 disk2 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_SIMPLE)442 disk3 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_SIMPLE)443 if disk1.open_disk("D:\\Windows Server 2012\\01. Simple\\Windows_Server_2012_Physical_5GB.001"):444 if disk1.parse_disk():445 pass446 else:447 return False448 else:449 return False450 if disk2.open_disk("D:\\Windows Server 2012\\01. Simple\\Windows_Server_2012_Physical_10GB.001"):451 if disk2.parse_disk():452 pass453 else:454 return False455 else:456 return False457 if disk3.open_disk("D:\\Windows Server 2012\\01. Simple\\Windows_Server_2012_Physical_15GB.001"):458 if disk3.parse_disk():459 pass460 else:461 return False462 else:463 return False464 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_SIMPLE)465 reconstructor.add_disk(disk1)466 reconstructor.add_disk(disk2)467 reconstructor.add_disk(disk3)468 reconstructor.parse_metadata()469 reconstructor.restore_virtual_disk()470def test_windows_server_2012_2mirror():471 disk1 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_2MIRROR)472 disk2 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_2MIRROR)473 disk3 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_2MIRROR)474 if disk1.open_disk("D:\\Windows Server 2012\\02. 2Mirror\\Windows_Server_2012_Physical_5GB.001"):475 if disk1.parse_disk():476 pass477 else:478 return False479 else:480 return False481 if disk2.open_disk("D:\\Windows Server 2012\\02. 2Mirror\\Windows_Server_2012_Physical_10GB.001"):482 if disk2.parse_disk():483 pass484 else:485 return False486 else:487 return False488 if disk3.open_disk("D:\\Windows Server 2012\\02. 2Mirror\\Windows_Server_2012_Physical_15GB.001"):489 if disk3.parse_disk():490 pass491 else:492 return False493 else:494 return False495 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_2MIRROR)496 reconstructor.add_disk(disk1)497 reconstructor.add_disk(disk2)498 reconstructor.add_disk(disk3)499 reconstructor.parse_metadata()500 reconstructor.restore_virtual_disk()501def test_windows_server_2012_3mirror():502 disk1 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_3MIRROR)503 disk2 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_3MIRROR)504 disk3 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_3MIRROR)505 disk4 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_3MIRROR)506 disk5 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_3MIRROR)507 if disk1.open_disk("D:\\Windows Server 2012\\03. 3Mirror\\Windows_Server_2012_Physical_5GB.001"):508 if disk1.parse_disk():509 pass510 else:511 return False512 else:513 return False514 if disk2.open_disk("D:\\Windows Server 2012\\03. 3Mirror\\Windows_Server_2012_Physical_10GB.001"):515 if disk2.parse_disk():516 pass517 else:518 return False519 else:520 return False521 if disk3.open_disk("D:\\Windows Server 2012\\03. 3Mirror\\Windows_Server_2012_Physical_15GB.001"):522 if disk3.parse_disk():523 pass524 else:525 return False526 else:527 return False528 if disk4.open_disk("D:\\Windows Server 2012\\03. 3Mirror\\Windows_Server_2012_Physical_20GB.001"):529 if disk4.parse_disk():530 pass531 else:532 return False533 else:534 return False535 if disk5.open_disk("D:\\Windows Server 2012\\03. 3Mirror\\Windows_Server_2012_Physical_25GB.001"):536 if disk5.parse_disk():537 pass538 else:539 return False540 else:541 return False542 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_3MIRROR)543 reconstructor.add_disk(disk1)544 reconstructor.add_disk(disk2)545 reconstructor.add_disk(disk3)546 reconstructor.add_disk(disk4)547 reconstructor.add_disk(disk5)548 reconstructor.parse_metadata()549 reconstructor.restore_virtual_disk()550def test_windows_server_2012_parity():551 disk1 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_PARITY)552 disk2 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_PARITY)553 disk3 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_PARITY)554 disk4 = StorageSpace(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_PARITY)555 if disk1.open_disk("D:\\Windows Server 2012\\04. Parity\\Windows_Server_2012_Physical_5GB.001"):556 if disk1.parse_disk():557 pass558 else:559 return False560 else:561 return False562 if disk2.open_disk("D:\\Windows Server 2012\\04. Parity\\Windows_Server_2012_Physical_10GB.001"):563 if disk2.parse_disk():564 pass565 else:566 return False567 else:568 return False569 if disk3.open_disk("D:\\Windows Server 2012\\04. Parity\\Windows_Server_2012_Physical_15GB.001"):570 if disk3.parse_disk():571 pass572 else:573 return False574 else:575 return False576 if disk4.open_disk("D:\\Windows Server 2012\\04. Parity\\Windows_Server_2012_Physical_20GB.001"):577 if disk4.parse_disk():578 pass579 else:580 return False581 else:582 return False583 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2012, Define.RAID_LEVEL_PARITY)584 reconstructor.add_disk(disk1)585 reconstructor.add_disk(disk2)586 reconstructor.add_disk(disk3)587 reconstructor.add_disk(disk4)588 reconstructor.parse_metadata()589 reconstructor.restore_virtual_disk()590def test_windows_server_2016_simple():591 disk1 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_SIMPLE)592 disk2 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_SIMPLE)593 disk3 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_SIMPLE)594 if disk1.open_disk("D:\\Windows Server 2016\\01. Simple\\Windows_Server_2016_Physical_5GB.001"):595 if disk1.parse_disk():596 pass597 else:598 return False599 else:600 return False601 if disk2.open_disk("D:\\Windows Server 2016\\01. Simple\\Windows_Server_2016_Physical_10GB.001"):602 if disk2.parse_disk():603 pass604 else:605 return False606 else:607 return False608 if disk3.open_disk("D:\\Windows Server 2016\\01. Simple\\Windows_Server_2016_Physical_15GB.001"):609 if disk3.parse_disk():610 pass611 else:612 return False613 else:614 return False615 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_SIMPLE)616 reconstructor.add_disk(disk1)617 reconstructor.add_disk(disk2)618 reconstructor.add_disk(disk3)619 reconstructor.parse_metadata()620 reconstructor.restore_virtual_disk()621def test_windows_server_2016_2mirror():622 disk1 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2MIRROR)623 disk2 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2MIRROR)624 disk3 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2MIRROR)625 if disk1.open_disk("D:\\Windows Server 2016\\02. 2Mirror\\Windows_Server_2016_Physical_5GB.001"):626 if disk1.parse_disk():627 pass628 else:629 return False630 else:631 return False632 if disk2.open_disk("D:\\Windows Server 2016\\02. 2Mirror\\Windows_Server_2016_Physical_10GB.001"):633 if disk2.parse_disk():634 pass635 else:636 return False637 else:638 return False639 if disk3.open_disk("D:\\Windows Server 2016\\02. 2Mirror\\Windows_Server_2016_Physical_15GB.001"):640 if disk3.parse_disk():641 pass642 else:643 return False644 else:645 return False646 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2MIRROR)647 reconstructor.add_disk(disk1)648 reconstructor.add_disk(disk2)649 reconstructor.add_disk(disk3)650 reconstructor.parse_metadata()651 reconstructor.restore_virtual_disk()652def test_windows_server_2016_3mirror():653 disk1 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_3MIRROR)654 disk2 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_3MIRROR)655 disk3 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_3MIRROR)656 disk4 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_3MIRROR)657 disk5 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_3MIRROR)658 if disk1.open_disk("D:\\Windows Server 2016\\03. 3Mirror\\Windows_Server_2016_Physical_5GB.001"):659 if disk1.parse_disk():660 pass661 else:662 return False663 else:664 return False665 if disk2.open_disk("D:\\Windows Server 2016\\03. 3Mirror\\Windows_Server_2016_Physical_10GB.001"):666 if disk2.parse_disk():667 pass668 else:669 return False670 else:671 return False672 if disk3.open_disk("D:\\Windows Server 2016\\03. 3Mirror\\Windows_Server_2016_Physical_15GB.001"):673 if disk3.parse_disk():674 pass675 else:676 return False677 else:678 return False679 if disk4.open_disk("D:\\Windows Server 2016\\03. 3Mirror\\Windows_Server_2016_Physical_20GB.001"):680 if disk4.parse_disk():681 pass682 else:683 return False684 else:685 return False686 if disk5.open_disk("D:\\Windows Server 2016\\03. 3Mirror\\Windows_Server_2016_Physical_25GB.001"):687 if disk5.parse_disk():688 pass689 else:690 return False691 else:692 return False693 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_3MIRROR)694 reconstructor.add_disk(disk1)695 reconstructor.add_disk(disk2)696 reconstructor.add_disk(disk3)697 reconstructor.add_disk(disk4)698 reconstructor.add_disk(disk5)699 reconstructor.parse_metadata()700 reconstructor.restore_virtual_disk()701def test_windows_server_2016_parity():702 disk1 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_PARITY)703 disk2 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_PARITY)704 disk3 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_PARITY)705 disk4 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_PARITY)706 if disk1.open_disk("D:\\Windows Server 2016\\04. Parity\\Windows_Server_2016_Physical_5GB.001"):707 if disk1.parse_disk():708 pass709 else:710 return False711 else:712 return False713 if disk2.open_disk("D:\\Windows Server 2016\\04. Parity\\Windows_Server_2016_Physical_10GB.001"):714 if disk2.parse_disk():715 pass716 else:717 return False718 else:719 return False720 if disk3.open_disk("D:\\Windows Server 2016\\04. Parity\\Windows_Server_2016_Physical_15GB.001"):721 if disk3.parse_disk():722 pass723 else:724 return False725 else:726 return False727 if disk4.open_disk("D:\\Windows Server 2016\\04. Parity\\Windows_Server_2016_Physical_20GB.001"):728 if disk4.parse_disk():729 pass730 else:731 return False732 else:733 return False734 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_PARITY)735 reconstructor.add_disk(disk1)736 reconstructor.add_disk(disk2)737 reconstructor.add_disk(disk3)738 reconstructor.add_disk(disk4)739 reconstructor.parse_metadata()740 reconstructor.restore_virtual_disk()741def test_windows_server_2016_2parity():742 disk1 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)743 disk2 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)744 disk3 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)745 disk4 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)746 disk5 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)747 disk6 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)748 disk7 = StorageSpace(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)749 """750 if disk1.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_5GB.001"):751 if disk1.parse_disk():752 pass753 else:754 return False755 else:756 return False757 if disk2.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_10GB.001"):758 if disk2.parse_disk():759 pass760 else:761 return False762 else:763 return False764 if disk3.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_15GB.001"):765 if disk3.parse_disk():766 pass767 else:768 return False769 else:770 return False771 if disk4.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_20GB.001"):772 if disk4.parse_disk():773 pass774 else:775 return False776 else:777 return False778 if disk5.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_25GB.001"):779 if disk5.parse_disk():780 pass781 else:782 return False783 else:784 return False785 if disk6.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_30GB.001"):786 if disk6.parse_disk():787 pass788 else:789 return False790 else:791 return False792 if disk7.open_disk("D:\\Windows Server 2016\\05. DualParity\\Parity_35GB.001"):793 if disk7.parse_disk():794 pass795 else:796 return False797 else:798 return False"""799 if disk1.open_disk("D:\\Windows Server 2016\\dualParity_New\\5GB.001"):800 if disk1.parse_disk():801 pass802 else:803 return False804 else:805 return False806 if disk2.open_disk("D:\\Windows Server 2016\\dualParity_New\\10GB.001"):807 if disk2.parse_disk():808 pass809 else:810 return False811 else:812 return False813 if disk3.open_disk("D:\\Windows Server 2016\\dualParity_New\\15GB.001"):814 if disk3.parse_disk():815 pass816 else:817 return False818 else:819 return False820 if disk4.open_disk("D:\\Windows Server 2016\\dualParity_New\\20GB.001"):821 if disk4.parse_disk():822 pass823 else:824 return False825 else:826 return False827 if disk5.open_disk("D:\\Windows Server 2016\\dualParity_New\\25GB.001"):828 if disk5.parse_disk():829 pass830 else:831 return False832 else:833 return False834 if disk6.open_disk("D:\\Windows Server 2016\\dualParity_New\\30GB.001"):835 if disk6.parse_disk():836 pass837 else:838 return False839 else:840 return False841 if disk7.open_disk("D:\\Windows Server 2016\\dualParity_New\\35GB.001"):842 if disk7.parse_disk():843 pass844 else:845 return False846 else:847 return False848 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2016, Define.RAID_LEVEL_2PARITY)849 reconstructor.add_disk(disk1)850 reconstructor.add_disk(disk2)851 reconstructor.add_disk(disk3)852 reconstructor.add_disk(disk4)853 reconstructor.add_disk(disk5)854 reconstructor.add_disk(disk6)855 reconstructor.add_disk(disk7)856 reconstructor.parse_metadata()857 reconstructor.restore_virtual_disk()858def test_windows_server_2019_simple():859 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)860 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)861 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)862 if disk1.open_disk("D:\\Windows Server 2019\\01. Simple\\Windows_Server_2019_Physical_5GB.001"):863 if disk1.parse_disk():864 pass865 else:866 return False867 else:868 return False869 if disk2.open_disk("D:\\Windows Server 2019\\01. Simple\\Windows_Server_2019_Physical_10GB.001"):870 if disk2.parse_disk():871 pass872 else:873 return False874 else:875 return False876 if disk3.open_disk("D:\\Windows Server 2019\\01. Simple\\Windows_Server_2019_Physical_15GB.001"):877 if disk3.parse_disk():878 pass879 else:880 return False881 else:882 return False883 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)884 reconstructor.add_disk(disk1)885 reconstructor.add_disk(disk2)886 reconstructor.add_disk(disk3)887 reconstructor.parse_metadata()888 reconstructor.restore_virtual_disk()889def test_windows_server_2019_2mirror():890 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2MIRROR)891 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2MIRROR)892 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2MIRROR)893 if disk1.open_disk("D:\\Windows Server 2019\\02. 2Mirror\\Windows_Server_2019_Physical_5GB.001"):894 if disk1.parse_disk():895 pass896 else:897 return False898 else:899 return False900 if disk2.open_disk("D:\\Windows Server 2019\\02. 2Mirror\\Windows_Server_2019_Physical_10GB.001"):901 if disk2.parse_disk():902 pass903 else:904 return False905 else:906 return False907 if disk3.open_disk("D:\\Windows Server 2019\\02. 2Mirror\\Windows_Server_2019_Physical_15GB.001"):908 if disk3.parse_disk():909 pass910 else:911 return False912 else:913 return False914 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2MIRROR)915 reconstructor.add_disk(disk1)916 reconstructor.add_disk(disk2)917 reconstructor.add_disk(disk3)918 reconstructor.parse_metadata()919 reconstructor.restore_virtual_disk()920def test_windows_server_2019_3mirror():921 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_3MIRROR)922 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_3MIRROR)923 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_3MIRROR)924 disk4 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_3MIRROR)925 disk5 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_3MIRROR)926 if disk1.open_disk("D:\\Windows Server 2019\\03. 3Mirror\\Windows_Server_2019_Physical_5GB.001"):927 if disk1.parse_disk():928 pass929 else:930 return False931 else:932 return False933 if disk2.open_disk("D:\\Windows Server 2019\\03. 3Mirror\\Windows_Server_2019_Physical_10GB.001"):934 if disk2.parse_disk():935 pass936 else:937 return False938 else:939 return False940 if disk3.open_disk("D:\\Windows Server 2019\\03. 3Mirror\\Windows_Server_2019_Physical_15GB.001"):941 if disk3.parse_disk():942 pass943 else:944 return False945 else:946 return False947 if disk4.open_disk("D:\\Windows Server 2019\\03. 3Mirror\\Windows_Server_2019_Physical_20GB.001"):948 if disk4.parse_disk():949 pass950 else:951 return False952 else:953 return False954 if disk5.open_disk("D:\\Windows Server 2019\\03. 3Mirror\\Windows_Server_2019_Physical_25GB.001"):955 if disk5.parse_disk():956 pass957 else:958 return False959 else:960 return False961 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_3MIRROR)962 reconstructor.add_disk(disk1)963 reconstructor.add_disk(disk2)964 reconstructor.add_disk(disk3)965 reconstructor.add_disk(disk4)966 reconstructor.add_disk(disk5)967 reconstructor.parse_metadata()968 reconstructor.restore_virtual_disk()969def test_windows_server_2019_parity():970 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)971 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)972 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)973 disk4 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)974 disk5 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)975 disk6 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)976 disk7 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)977 if disk1.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_5GB.001"):978 if disk1.parse_disk():979 pass980 else:981 return False982 else:983 return False984 if disk2.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_10GB.001"):985 if disk2.parse_disk():986 pass987 else:988 return False989 else:990 return False991 if disk3.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_15GB.001"):992 if disk3.parse_disk():993 pass994 else:995 return False996 else:997 return False998 if disk4.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_20GB.001"):999 if disk4.parse_disk():1000 pass1001 else:1002 return False1003 else:1004 return False1005 if disk5.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_25GB.001"):1006 if disk5.parse_disk():1007 pass1008 else:1009 return False1010 else:1011 return False1012 if disk6.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_30GB.001"):1013 if disk6.parse_disk():1014 pass1015 else:1016 return False1017 else:1018 return False1019 if disk7.open_disk("D:\\Windows Server 2019\\04. Parity\\Windows_Server_2019_Physical_35GB.001"):1020 if disk7.parse_disk():1021 pass1022 else:1023 return False1024 else:1025 return False1026 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1027 reconstructor.add_disk(disk1)1028 reconstructor.add_disk(disk2)1029 reconstructor.add_disk(disk3)1030 reconstructor.add_disk(disk4)1031 reconstructor.add_disk(disk5)1032 reconstructor.add_disk(disk6)1033 reconstructor.add_disk(disk7)1034 reconstructor.parse_metadata()1035 reconstructor.restore_virtual_disk()1036def test_windows_server_2019_2parity():1037 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1038 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1039 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1040 disk4 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1041 disk5 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1042 disk6 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1043 disk7 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1044 if disk1.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_5GB.001"):1045 if disk1.parse_disk():1046 pass1047 else:1048 return False1049 else:1050 return False1051 if disk2.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_10GB.001"):1052 if disk2.parse_disk():1053 pass1054 else:1055 return False1056 else:1057 return False1058 if disk3.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_15GB.001"):1059 if disk3.parse_disk():1060 pass1061 else:1062 return False1063 else:1064 return False1065 if disk4.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_20GB.001"):1066 if disk4.parse_disk():1067 pass1068 else:1069 return False1070 else:1071 return False1072 if disk5.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_25GB.001"):1073 if disk5.parse_disk():1074 pass1075 else:1076 return False1077 else:1078 return False1079 if disk6.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_30GB.001"):1080 if disk6.parse_disk():1081 pass1082 else:1083 return False1084 else:1085 return False1086 if disk7.open_disk("D:\\Windows Server 2019\\05. DualParity\\Parity_35GB.001"):1087 if disk7.parse_disk():1088 pass1089 else:1090 return False1091 else:1092 return False1093 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1094 reconstructor.add_disk(disk1)1095 reconstructor.add_disk(disk2)1096 reconstructor.add_disk(disk3)1097 reconstructor.add_disk(disk4)1098 reconstructor.add_disk(disk5)1099 reconstructor.add_disk(disk6)1100 reconstructor.add_disk(disk7)1101 reconstructor.parse_metadata()1102 reconstructor.restore_virtual_disk()1103def test_windows_server_2019_challenge():1104 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1105 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1106 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1107 disk4 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1108 if disk1.open_disk("D:\\disk1_image.001"):1109 if disk1.parse_disk():1110 pass1111 else:1112 return False1113 else:1114 return False1115 if disk2.open_disk("D:\\disk2_image.001"):1116 if disk2.parse_disk():1117 pass1118 else:1119 return False1120 else:1121 return False1122 if disk3.open_disk("D:\\disk3_image.001"):1123 if disk3.parse_disk():1124 pass1125 else:1126 return False1127 else:1128 return False1129 if disk4.open_disk("D:\\disk4_image.001"):1130 if disk4.parse_disk():1131 pass1132 else:1133 return False1134 else:1135 return False1136 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1137 reconstructor.add_disk(disk1)1138 reconstructor.add_disk(disk2)1139 reconstructor.add_disk(disk3)1140 reconstructor.add_disk(disk4)1141 reconstructor.parse_metadata()1142 reconstructor.restore_virtual_disk()1143def test_windows_server_2019_simple2():1144 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1145 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1146 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1147 if disk1.open_disk("D:\\Windows Server 2019\\new_simple\\5GB.001"):1148 if disk1.parse_disk():1149 pass1150 else:1151 return False1152 else:1153 return False1154 if disk2.open_disk("D:\\Windows Server 2019\\new_simple\\10GB.001"):1155 if disk2.parse_disk():1156 pass1157 else:1158 return False1159 else:1160 return False1161 if disk3.open_disk("D:\\Windows Server 2019\\new_simple\\15GB.001"):1162 if disk3.parse_disk():1163 pass1164 else:1165 return False1166 else:1167 return False1168 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1169 reconstructor.add_disk(disk1)1170 reconstructor.add_disk(disk2)1171 reconstructor.add_disk(disk3)1172 reconstructor.parse_metadata()1173 reconstructor.restore_virtual_disk()1174def test_windows_server_2019_simple3():1175 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1176 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1177 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1178 if disk1.open_disk("E:\\06. WorkSpace\\Pycharm\\SSR\\result\\server2019_ë
¼ë¬¸í
ì¤í¸\\5GB_1.001"):1179 if disk1.parse_disk():1180 pass1181 else:1182 return False1183 else:1184 return False1185 if disk2.open_disk("E:\\06. WorkSpace\\Pycharm\\SSR\\result\\server2019_ë
¼ë¬¸í
ì¤í¸\\5GB_2.001"):1186 if disk2.parse_disk():1187 pass1188 else:1189 return False1190 else:1191 return False1192 if disk3.open_disk("E:\\06. WorkSpace\\Pycharm\\SSR\\result\\server2019_ë
¼ë¬¸í
ì¤í¸\\5GB_3.001"):1193 if disk3.parse_disk():1194 pass1195 else:1196 return False1197 else:1198 return False1199 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_SIMPLE)1200 reconstructor.add_disk(disk1)1201 reconstructor.add_disk(disk2)1202 reconstructor.add_disk(disk3)1203 reconstructor.parse_metadata()1204 reconstructor.restore_virtual_disk()1205def test_windows_server_2019_parity2():1206 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1207 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1208 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1209 disk4 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1210 disk5 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1211 disk6 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1212 disk7 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1213 if disk1.open_disk("D:\\Windows Server 2019\\new_parity\\5GB.001"):1214 if disk1.parse_disk():1215 pass1216 else:1217 return False1218 else:1219 return False1220 if disk2.open_disk("D:\\Windows Server 2019\\new_parity\\5GB_2.001"):1221 if disk2.parse_disk():1222 pass1223 else:1224 return False1225 else:1226 return False1227 if disk3.open_disk("D:\\Windows Server 2019\\new_parity\\5GB_3.001"):1228 if disk3.parse_disk():1229 pass1230 else:1231 return False1232 else:1233 return False1234 if disk4.open_disk("D:\\Windows Server 2019\\new_parity\\5GB_4.001"):1235 if disk4.parse_disk():1236 pass1237 else:1238 return False1239 else:1240 return False1241 if disk5.open_disk("D:\\Windows Server 2019\\new_parity\\5GB_5.001"):1242 if disk5.parse_disk():1243 pass1244 else:1245 return False1246 else:1247 return False1248 if disk6.open_disk("D:\\Windows Server 2019\\new_parity\\5GB_6.001"):1249 if disk6.parse_disk():1250 pass1251 else:1252 return False1253 else:1254 return False1255 if disk7.open_disk("D:\\Windows Server 2019\\new_parity\\5GB_7.001"):1256 if disk7.parse_disk():1257 pass1258 else:1259 return False1260 else:1261 return False1262 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_PARITY)1263 reconstructor.add_disk(disk1)1264 reconstructor.add_disk(disk2)1265 reconstructor.add_disk(disk3)1266 reconstructor.add_disk(disk4)1267 reconstructor.add_disk(disk5)1268 reconstructor.add_disk(disk6)1269 reconstructor.add_disk(disk7)1270 reconstructor.parse_metadata()1271 reconstructor.restore_virtual_disk()1272def test_windows_server_2019_2parity2():1273 disk1 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1274 disk2 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1275 disk3 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1276 disk4 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1277 disk5 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1278 disk6 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1279 disk7 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1280 disk8 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1281 disk9 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1282 disk10 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1283 disk11 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1284 disk12 = StorageSpace(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1285 if disk1.open_disk("D:\\Windows Server 2019\\05. 2Parity\\5GB.001"):1286 if disk1.parse_disk():1287 pass1288 else:1289 return False1290 else:1291 return False1292 if disk2.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB.001"):1293 if disk2.parse_disk():1294 pass1295 else:1296 return False1297 else:1298 return False1299 if disk3.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_2.001"):1300 if disk3.parse_disk():1301 pass1302 else:1303 return False1304 else:1305 return False1306 if disk4.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_3.001"):1307 if disk4.parse_disk():1308 pass1309 else:1310 return False1311 else:1312 return False1313 if disk5.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_4.001"):1314 if disk5.parse_disk():1315 pass1316 else:1317 return False1318 else:1319 return False1320 if disk6.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_5.001"):1321 if disk6.parse_disk():1322 pass1323 else:1324 return False1325 else:1326 return False1327 if disk7.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_6.001"):1328 if disk7.parse_disk():1329 pass1330 else:1331 return False1332 else:1333 return False1334 if disk8.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_7.001"):1335 if disk8.parse_disk():1336 pass1337 else:1338 return False1339 else:1340 return False1341 if disk9.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_8.001"):1342 if disk9.parse_disk():1343 pass1344 else:1345 return False1346 else:1347 return False1348 if disk10.open_disk("D:\\Windows Server 2019\\05. 2Parity\\10GB_9.001"):1349 if disk10.parse_disk():1350 pass1351 else:1352 return False1353 else:1354 return False1355 if disk11.open_disk("D:\\Windows Server 2019\\05. 2Parity\\15GB.001"):1356 if disk11.parse_disk():1357 pass1358 else:1359 return False1360 else:1361 return False1362 if disk12.open_disk("D:\\Windows Server 2019\\05. 2Parity\\20GB.001"):1363 if disk12.parse_disk():1364 pass1365 else:1366 return False1367 else:1368 return False1369 reconstructor = Reconstructor(Define.WINDOWS_SERVER_2019, Define.RAID_LEVEL_2PARITY)1370 reconstructor.add_disk(disk1)1371 reconstructor.add_disk(disk2)1372 reconstructor.add_disk(disk3)1373 reconstructor.add_disk(disk4)1374 reconstructor.add_disk(disk5)1375 reconstructor.add_disk(disk6)1376 reconstructor.add_disk(disk7)1377 reconstructor.add_disk(disk8)1378 reconstructor.add_disk(disk9)1379 reconstructor.add_disk(disk10)1380 reconstructor.add_disk(disk11)1381 reconstructor.add_disk(disk12)1382 reconstructor.parse_metadata()1383 reconstructor.restore_virtual_disk()1384def test_for_JOFS():1385 disk1 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)1386 disk2 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)1387 disk3 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)1388 disk4 = StorageSpace(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)1389 if disk1.open_disk("10GB.001"):1390 if disk1.parse_disk():1391 pass1392 else:1393 return False1394 else:1395 return False1396 if disk2.open_disk("20GB.001"):1397 if disk2.parse_disk():1398 pass1399 else:1400 return False1401 else:1402 return False1403 if disk3.open_disk("30GB.001"):1404 if disk3.parse_disk():1405 pass1406 else:1407 return False1408 else:1409 return False1410 if disk4.open_disk("40GB.001"):1411 if disk4.parse_disk():1412 pass1413 else:1414 return False1415 else:1416 return False1417 reconstructor = Reconstructor(Define.WINDOWS_10, Define.RAID_LEVEL_PARITY)1418 reconstructor.add_disk(disk1)1419 reconstructor.add_disk(disk2)1420 reconstructor.add_disk(disk3)1421 reconstructor.add_disk(disk4)1422 reconstructor.parse_metadata()1423 reconstructor.restore_virtual_disk()1424if __name__ == "__main__":1425 #test_windows8_simple()1426 #test_windows8_2mirror()1427 #test_windows8_3mirror()1428 #test_windows8_parity()1429 #test_windows_server_2012_simple()1430 #test_windows_server_2012_2mirror()1431 #test_windows_server_2012_3mirror()1432 #test_windows_server_2012_parity()1433 #test_windows10_simple()1434 #test_windows10_2mirror2()1435 #test_windows10_2mirror()...
test_actions_add_disk.py
Source:test_actions_add_disk.py
1# Copyright 2020 Canonical Ltd2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14from unittest import mock15from actions import add_disk16from test_utils import CharmTestCase17class AddDiskActionTests(CharmTestCase):18 def setUp(self):19 super(AddDiskActionTests, self).setUp(20 add_disk, ['hookenv', 'kv'])21 self.kv.return_value = self.kv22 @mock.patch.object(add_disk.charms_ceph.utils, 'use_bluestore')23 @mock.patch.object(add_disk.ceph_hooks, 'get_journal_devices')24 @mock.patch.object(add_disk.charms_ceph.utils, 'osdize')25 def test_add_device(self, mock_osdize, mock_get_journal_devices,26 mock_use_bluestore):27 def fake_config(key):28 return {29 'ignore-device-errors': True,30 'osd-encrypt': True,31 'bluestore': True,32 'osd-encrypt-keymanager': True,33 'autotune': False,34 }.get(key)35 self.hookenv.config.side_effect = fake_config36 mock_get_journal_devices.return_value = ''37 self.hookenv.relation_ids.return_value = ['ceph:0']38 mock_use_bluestore.return_value = True39 db = mock.MagicMock()40 self.kv.return_value = db41 db.get.side_effect = {'osd-devices': ['/dev/myosddev']}.get42 request = {'ops': []}43 add_disk.add_device(request, '/dev/myosddev')44 call = mock.call(relation_id='ceph:0',45 relation_settings={'bootstrapped-osds': 1})46 self.hookenv.relation_set.assert_has_calls([call])47 mock_osdize.assert_has_calls([mock.call('/dev/myosddev',48 None, '', True, True, True,49 True, None)])50 piter = add_disk.PartitionIter(['/dev/cache'], 100, ['/dev/myosddev'])51 mock_create_bcache = mock.MagicMock(side_effect=lambda b: '/dev/cache')52 with mock.patch.object(add_disk.PartitionIter, 'create_bcache',53 mock_create_bcache) as mock_call:54 add_disk.add_device(request, '/dev/myosddev', part_iter=piter)55 mock_call.assert_called()56 db.set.assert_called_with('osd-aliases',57 {'/dev/myosddev': '/dev/cache'})58 mock_create_bcache.side_effect = lambda b: None59 with mock.patch.object(add_disk.PartitionIter, 'create_bcache',60 mock_create_bcache) as mock_call:61 with self.assertRaises(add_disk.DeviceError):62 add_disk.add_device(request, '/dev/myosddev', part_iter=piter)63 def test_get_devices(self):64 self.hookenv.action_get.return_value = '/dev/foo bar'65 rv = add_disk.get_devices('')66 self.assertEqual(rv, ['/dev/foo'])67 self.hookenv.action_get.return_value = None68 rv = add_disk.get_devices('')69 self.assertEqual(rv, [])70 @mock.patch.object(add_disk, 'device_size')71 @mock.patch.object(add_disk, 'function_fail')72 def test_validate_psize(self, function_fail, device_size):73 caches = {'cache1': 100, 'cache2': 200}74 device_size.side_effect = lambda c: caches[c]75 function_fail.return_value = None76 with self.assertRaises(SystemExit):77 add_disk.validate_partition_size(78 60, ['a', 'b', 'c'], list(caches.keys()))79 self.assertIsNone(add_disk.validate_partition_size(80 60, ['a', 'b'], list(caches.keys())))81 def test_cache_storage(self):82 self.hookenv.storage_list.return_value = [{'location': 'a', 'key': 1},83 {'location': 'b'}]84 self.hookenv.storage_get.side_effect = lambda k, elem: elem.get(k)85 rv = add_disk.cache_storage()86 self.assertEqual(['a', 'b'], rv)87 def test_validate_osd_id(self):88 for elem in ('osd.1', '1', 0, 113):89 self.assertTrue(add_disk.validate_osd_id(elem))90 for elem in ('osd.-1', '-3', '???', -100, 3.4, {}):...
test_opencascade_boolean.py
Source:test_opencascade_boolean.py
...5 with pygmsh.occ.Geometry() as geom:6 geom.characteristic_length_min = 0.17 geom.characteristic_length_max = 0.18 rectangle = geom.add_rectangle([-1.0, -1.0, 0.0], 2.0, 2.0)9 disk_w = geom.add_disk([-1.0, 0.0, 0.0], 0.5)10 disk_e = geom.add_disk([+1.0, 0.0, 0.0], 0.5)11 geom.boolean_union([rectangle, disk_w, disk_e])12 mesh = geom.generate_mesh()13 ref = 4.78036114 assert abs(compute_volume(mesh) - ref) < 1.0e-2 * ref15 return mesh16def test_intersection():17 with pygmsh.occ.Geometry() as geom:18 angles = [math.pi * 3 / 6, math.pi * 7 / 6, math.pi * 11 / 6]19 disks = [20 geom.add_disk([math.cos(angles[0]), math.sin(angles[0]), 0.0], 1.5),21 geom.add_disk([math.cos(angles[1]), math.sin(angles[1]), 0.0], 1.5),22 geom.add_disk([math.cos(angles[2]), math.sin(angles[2]), 0.0], 1.5),23 ]24 geom.boolean_intersection(disks)25 mesh = geom.generate_mesh()26 ref = 1.029010975380791427 assert abs(compute_volume(mesh) - ref) < 1.0e-2 * ref28 return mesh29def test_difference():30 with pygmsh.occ.Geometry() as geom:31 geom.characteristic_length_min = 0.132 geom.characteristic_length_max = 0.133 rectangle = geom.add_rectangle([-1.0, -1.0, 0.0], 2.0, 2.0)34 disk_w = geom.add_disk([-1.0, 0.0, 0.0], 0.5)35 disk_e = geom.add_disk([+1.0, 0.0, 0.0], 0.5)36 geom.boolean_union([disk_w, disk_e])37 geom.boolean_difference(rectangle, geom.boolean_union([disk_w, disk_e]))38 mesh = geom.generate_mesh()39 ref = 3.219638740 assert abs(compute_volume(mesh) - ref) < 1.0e-2 * ref41 return mesh42def test_all():43 with pygmsh.occ.Geometry() as geom:44 geom.characteristic_length_min = 0.145 geom.characteristic_length_max = 0.146 rectangle = geom.add_rectangle([-1.0, -1.0, 0.0], 2.0, 2.0)47 disk1 = geom.add_disk([-1.0, 0.0, 0.0], 0.5)48 disk2 = geom.add_disk([+1.0, 0.0, 0.0], 0.5)49 union = geom.boolean_union([rectangle, disk1, disk2])50 disk3 = geom.add_disk([0.0, -1.0, 0.0], 0.5)51 disk4 = geom.add_disk([0.0, +1.0, 0.0], 0.5)52 geom.boolean_difference(union, geom.boolean_union([disk3, disk4]))53 mesh = geom.generate_mesh()54 ref = 4.055 assert abs(compute_volume(mesh) - ref) < 1.0e-2 * ref56 return mesh57if __name__ == "__main__":...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!