Squashed commit of the following:
commita2d724a54cMerge:a22d9e3f06157cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 16 13:14:46 2020 -0500 Merge pull request #114 from ZertoPublic/wcarroll/where-fix Wcarroll/where fix commitf06157c75eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 16 13:10:02 2020 -0500 Bump Version for Release commitd413374c09Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 16 09:43:22 2020 -0500 CHANGLOG Updates commit1513cd4f4bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 16 09:42:48 2020 -0500 Update Synopsis commit1daac508b2Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 16 09:42:23 2020 -0500 Update SiteId Lookup Method commita22d9e3416Merge:912bca006e81b4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 9 21:57:36 2020 -0500 Merge pull request #113 from ZertoPublic/wcarroll/issue112 SiteId Query to VirtualizationSites Fixes #112 commit06e81b46d6Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 9 17:09:53 2020 -0500 Update CHANGELOG for #112 commitaf33715f02Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Dec 9 16:13:50 2020 -0500 SiteId Query to VirtualizationSites Fixes #112 commit912bca0f9cMerge:50e03b34ac9516Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Oct 19 19:10:37 2020 -0400 Merge pull request #111 from ZertoPublic/export_bug_fix Export bug fix commit4ac951607bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Oct 19 18:43:13 2020 -0400 Add required Mock commitd3d01f892fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Oct 19 18:35:30 2020 -0400 Bump Version commit84b7922156Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Oct 19 18:24:08 2020 -0400 Update CHANGELOG commit0eaf89608bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Oct 19 18:22:10 2020 -0400 Clean up VPG Settings Identifier commit50e03b36f5Merge:a5a91fe4531d2dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Sep 8 08:55:07 2020 -0400 Merge pull request #110 from ZertoPublic/Release Release into Master commit4531d2d53bMerge:9dc9aa9e6e6be9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Sep 8 08:22:32 2020 -0400 Merge branch 'release_prep' into Release commite6e6be9edeAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Sep 8 08:21:10 2020 -0400 Bump Version commit5c2dd620d8Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Sep 8 08:20:29 2020 -0400 Update for Release Notes commita5a91febcfMerge:ddee165bb5dbaaAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Sep 4 10:28:45 2020 -0400 Merge pull request #109 from jonsouzerto/master Fixed issue 108 commitbb5dbaa0d4Author: jonsouzerto <57370019+jonsouzerto@users.noreply.github.com> Date: Thu Sep 3 12:50:49 2020 -0400 Update CHANGELOG.md Added fix information commite6b5777e64Author: jonsouzerto <57370019+jonsouzerto@users.noreply.github.com> Date: Thu Sep 3 12:45:35 2020 -0400 Updated recovery host key Attempting to resolve issue 108 commitddee165575Merge:682750ff027963Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Aug 28 13:48:34 2020 -0400 Merge pull request #107 from gdbarron/invoke-move-updates Invoke-ZertoMove parameter, pipeline, and restructuring updates commitf0279633ddAuthor: Brownstein <gbrownstein@deloitte.com> Date: Fri Aug 28 13:43:22 2020 -0400 add missing .IsPresent for switch value commit139e52f3e2Author: Brownstein <gbrownstein@deloitte.com> Date: Thu Aug 27 15:28:01 2020 -0400 add new parameter to test commiteea6e95988Author: Brownstein <gbrownstein@deloitte.com> Date: Thu Aug 27 15:08:28 2020 -0400 update test and help files commit0630cbb20eAuthor: Brownstein <gbrownstein@deloitte.com> Date: Fri Aug 21 21:04:15 2020 -0400 new param sets, pipeline input commit682750fc6dMerge:23e0b8a9dc9aa9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Aug 20 13:44:03 2020 -0400 Merge pull request #106 from ZertoPublic/Release Merge pull request #105 from ZertoPublic/master commit9dc9aa92d0Merge:dbde9aa23e0b8aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Aug 20 13:31:28 2020 -0400 Merge pull request #105 from ZertoPublic/master Release 1.5.0 commit23e0b8a665Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Aug 20 13:25:37 2020 -0400 Prepping for next release commitae53dcd4d2Merge:cb528dfced5671Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Aug 20 12:39:21 2020 -0400 Merge pull request #104 from ZertoPublic/wcarroll/issue103 Update target host validation commitced5671ab2Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Aug 20 12:29:40 2020 -0400 Update target host validation commitcb528df3d4Merge:dbde9aac91d53eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 09:41:09 2020 -0400 Merge pull request #102 from ZertoPublic/Add-VMToVpg Add-ZertoVpgVm and Remove-ZertoVpgVm commitc91d53ecadAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 09:34:35 2020 -0400 Update with changes commit8d8cb58558Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 08:47:17 2020 -0400 Remove-ZertoVpgVm Tests commit2dad347544Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 08:41:55 2020 -0400 Remove-ZertoVpgVm Help commit6f798fd96aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 08:22:19 2020 -0400 Update VM Filter Method commit649e7413a7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 07:46:11 2020 -0400 Fix URL typo commitaf6e81267bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Aug 5 07:45:55 2020 -0400 Add Online Help URI commitb6d8083b69Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 22:05:35 2020 -0400 Remove-ZertoVpgVm update commit9d4b4d3533Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 17:42:37 2020 -0400 Starting Remove-VpgVm commit510f0b9ed7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 12:31:37 2020 -0400 Add-ZertoVpgVm Tests commit9561936be7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 11:46:12 2020 -0400 Update Help Files commit961eafb945Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 11:44:36 2020 -0400 Update Event Documentation commitaa73534d7fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 11:42:41 2020 -0400 Create Add-ZertoVpgVm Help File commit56bbe59ea7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 11:23:37 2020 -0400 Always return the Vpg Settings Identifier commit5f786775dcAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 11:23:20 2020 -0400 Verbose Output - VM and VPG name commit14ef5048e4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 11:22:45 2020 -0400 Only process unique VM names commitd7e46bd263Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 10:48:58 2020 -0400 Check for existence of Vpg commitc64c82f8bcAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Aug 4 07:53:15 2020 -0400 Add parameter alias commita59feb2d5fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Aug 3 21:21:05 2020 -0400 Add switch for vpgName commitd9e1063654Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Aug 3 21:13:38 2020 -0400 update GitIgnore commitd9e6c74f27Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jul 31 18:02:00 2020 -0400 Add parameter aliases commitdf82bc26caAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jul 31 17:42:28 2020 -0400 Add function Add-ZertoVpgVm commitdbde9aa4c2Merge:291aae97dcb653Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 8 13:14:52 2020 -0400 Merge pull request #101 from ZertoPublic/master Merge Current Master to Release Branch commit7dcb6539a5Merge:5b4a25b3621ddeAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 8 13:10:34 2020 -0400 Merge pull request #100 from ZertoPublic/wcarroll/prep_release Prep Release Information commit3621ddef8dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 8 13:08:49 2020 -0400 Set Version Numbers commit5b4a25b66dMerge:0872f1a5a2c013Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:45:37 2020 -0400 Merge pull request #98 from ZertoPublic:wcarroll/issue95 Remove zvmLocalInfo Script Scope Variable commit5a2c01341cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:32:32 2020 -0400 Update Changlog for Issue 95 commitc477d40364Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:30:07 2020 -0400 Remove Mocks that are not required any longer commit494c45b02cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:26:56 2020 -0400 Remove tests for removed variable commit8318229cf4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:26:36 2020 -0400 Remove Removal of Variable no longer required commit7427ffe707Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:26:10 2020 -0400 Remove operation to set ZvmLocalInfo Variable commit713c94461cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jul 6 14:25:43 2020 -0400 Replace Script Scope LocalSite Info Variable commit0872f1a655Merge:136d1b2a072905Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 1 19:11:54 2020 -0400 Merge pull request #97 from ZertoPublic/wcarroll/issue96 Fixes Set-ZertoLicense ShouldProcess issue commita072905253Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 1 17:34:25 2020 -0400 Update ChangLog with Issue 96 updates commit41fddf5f13Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 1 17:09:38 2020 -0400 Set-ZertoLicense - Fix ShouldProcess error Fixes #96 commit136d1b2c76Merge:93c55bda25bf3aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jul 1 14:12:15 2020 -0400 Merge pull request #94 from NScuola/patch-1 Adding port information for pairing v7.5+ commita25bf3adfeAuthor: NScuola <15016465+NScuola@users.noreply.github.com> Date: Wed Jul 1 14:06:30 2020 -0400 Adding port information for pairing v7.5+ Adding port information to example for pairing v7.5+. commit93c55bdd07Merge:6f1e5825627992Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 23 13:13:40 2020 -0400 Merge pull request #93 from ZertoPublic/issue_90 Make New-ZertoVpg -RecoverySite parameter case-insensitive commit5627992a04Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 23 12:54:03 2020 -0400 Update CHANGELOG commit7fc7edff86Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 23 12:51:33 2020 -0400 Update PeerSite Lookup Method commit6f1e582cebMerge:6903ccc0f1b430Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 23 12:40:07 2020 -0400 Merge pull request #92 from ZertoPublic/issue_89 Set New-ZertoVpg Default Parameter Set commit0f1b4302bbAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 22 17:18:55 2020 -0400 Update CHANGELOG with latest updates commitea8d6f096dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 22 17:18:40 2020 -0400 Update Parameter with Proper Names commitddae22fb9fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 22 17:18:16 2020 -0400 Specify defaultParameterSetName commit6903ccc99bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 22 17:03:32 2020 -0400 Update CHANGELOG commit7ce6369ad7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jun 12 12:39:38 2020 -0400 Add tests for switches commit2d453ef608Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 11 16:34:04 2020 -0400 Put params in correct order commit363b6e727cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 11 16:16:38 2020 -0400 Update Param Order Syntax in Help File commitf4c1cf630aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 11 15:53:53 2020 -0400 Moved Credential to Second Position commit348fcbd28cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 11 14:19:20 2020 -0400 Update Help for AutoReconnect switch commit3000a2b013Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 8 12:50:29 2020 -0400 Initial auto reconnect commit52609bf64aMerge:c3ad8dde021a7bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 18 13:26:50 2020 -0400 Merge pull request #88 from ZertoPublic/wcarroll-patch-1 Added Time Example commite021a7bab0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 18 13:20:10 2020 -0400 Added Time Example Struggled to find a time example. Added one for future use. commitc3ad8dd415Merge:932262ef81a22cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 11 11:35:16 2020 -0400 Merge pull request #87 from ZertoPublic/Refactor-Build Refactor build commitf81a22ca80Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 11 09:24:02 2020 -0400 Update Artifact Publish task to latest commitde1a85cecdAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 19:30:50 2020 -0400 Add ReleaseNotes.md File Creation commitd3acba3967Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 15:54:59 2020 -0400 Remove Unused Publish Task commit512d5bbd74Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 15:52:59 2020 -0400 Update Publish Location commit9ad9cb7f1eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 12:20:00 2020 -0400 Update Build Path for Artifact Utilization commita55b0cd467Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:58:32 2020 -0400 Remove SourceFileTests publish commitaab22cf266Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:53:01 2020 -0400 Add Branch to Auto-Build commit906d35186fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:43:32 2020 -0400 Update Required Module Versions commitc7c3428dd5Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:43:03 2020 -0400 Update release task to use full build process commite90d2a23ccAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:42:41 2020 -0400 Update tests to only show failed commit925ecaf224Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:42:17 2020 -0400 Update default build operation commit32403ec3e3Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Jun 10 09:41:37 2020 -0400 Update build script with params commit73540faeb9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 9 22:33:48 2020 -0400 Update Build Paths commit932262e33aMerge:7befc7d1e84f5aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 9 21:27:49 2020 -0400 Merge pull request #85 from ZertoPublic/wcarroll-patch-2 Add Username Example commit1e84f5aea0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 9 15:21:11 2020 -0400 Add Username Example added example with username filter commit7befc7d21eMerge:291aae9cdad0c5Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jun 5 12:57:07 2020 -0400 Merge pull request #84 from ZertoPublic/wcarroll-patch-1 Correct example numbering issue commitcdad0c5e79Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jun 5 09:43:48 2020 -0400 Correct example numbering issue commit291aae9dcdMerge:6046103f8f0d98Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:26:23 2020 -0400 Merge pull request #83 from ZertoPublic/ReleasePrep Release prep commitf8f0d980d0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:22:12 2020 -0400 Update Unreleased to Release Number commitb72099559cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:21:56 2020 -0400 Bump Version commit6046103da0Merge:de505decccd45bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:18:15 2020 -0400 Merge pull request #82 from ZertoPublic/Fix-ZertoStartClone Fix zerto start clone commitcccd45b7fdAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:07:31 2020 -0400 Update ChangeLog commit77b7e1c376Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:05:15 2020 -0400 Fix Body Creation Method commit8f735bee62Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 17 11:04:41 2020 -0400 Correct body creation method commitde505debf9Merge:d4b4d1bbc570e9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 13 10:38:31 2020 -0400 Merge pull request #81 from ZertoPublic/Invoke-ZertoMoveCommit-Fix Fix Invoke-ZertoMoveCommit commitbc570e9005Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 20:52:55 2020 -0400 Update Changlog with MoveCommit Changes commit804a60be77Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 16:05:54 2020 -0400 Update for explicit switches commit1e678214b1Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 16:05:32 2020 -0400 Update for explicit reverse and keep params commitba0b12e83cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 16:04:27 2020 -0400 Add accepted values commitb33b07b524Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 12:19:13 2020 -0400 Set Explicit Reverse\Keep Options commitd4b4d1b4d7Merge:2887f6dfbe3f4dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 11:04:59 2020 -0400 Merge pull request #80 from ZertoPublic:Get-ZertoEvent-Fix Get zerto event fix commitfbe3f4d031Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat May 9 10:36:37 2020 -0400 Add Get-ZertoEvent Fix commit26cfb832a4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu May 7 20:49:16 2020 -0400 Update CHANGELOG.md commit865ca1dd39Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu May 7 20:21:39 2020 -0400 Update Logic to Convert VpgName to VpgIdentifier commit2887f6d450Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu May 7 13:54:14 2020 -0400 Update README.md Fix link to updated WIKI page commit5613b97eefMerge:ba2bed63a2e8f4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 13:00:52 2020 -0400 Merge pull request #79 from ZertoPublic/PrepRelease Release Update commit3a2e8f4ee7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 12:45:09 2020 -0400 Bump Version commit380ac5c841Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 12:44:58 2020 -0400 Move Recent Updates to ChangeLog commitc2a0ac9fa0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 12:44:32 2020 -0400 Update CHANGELOG for Release commitba2bed6b53Merge:8b213ed5ec0ddcAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 09:56:01 2020 -0400 Merge pull request #78 from ZertoPublic/Update-Function-Tests Update function tests commit5ec0ddce62Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 08:24:28 2020 -0400 Add general Changes to Changelog commit83f00e00eeAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed May 6 08:17:26 2020 -0400 Update the Version Pattern commit63a1ab928eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 22:13:54 2020 -0400 Update builtfiletests to ensure module is built commite6ead11891Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 21:59:14 2020 -0400 Update mandatory parameter declaration commitaecd4fd1d5Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 21:25:54 2020 -0400 Updated CHANGELOG with formatting information commit8dcee4068aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 16:30:49 2020 -0400 Update PSSA Rules for New PSSA Version commitb0d68ea224Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 16:29:56 2020 -0400 Updete to use process block for pipeline commit22b0da87b9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 14:35:29 2020 -0400 Update to latest versions of modules commitfc3c08637bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 14:32:13 2020 -0400 Module Release Notes point to GitHub commit4894084292Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 14:27:27 2020 -0400 Remove RELEASENOTES for CHANGELOG commit781368398cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 14:26:41 2020 -0400 Update release notes to point to CHANGELOG commit4271afd5b4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 14:11:49 2020 -0400 Move historical Release Notes to ChangeLog commit6c2b029014Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 5 13:47:19 2020 -0400 Update Parameter Name to work with filter commite47458b2dfAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 30 11:53:55 2020 -0400 Update ReleaseNotes to maintain history commitd38f206824Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 30 11:11:29 2020 -0400 Update ZVM Headers commited6024fe63Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 14 16:24:45 2020 -0400 Add Tests for Password Update # Conflicts: # Tests/Public/Edit-ZertoVra.Tests.ps1 commit8b213ede25Merge:8578c776620246Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 20 17:00:00 2020 -0400 Merge pull request #77 from ZertoPublic/Pester5Prep Pester 5 prep commit6620246e4cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 20 16:35:02 2020 -0400 Update Method to Grab Path https://jakubjares.com/2020/04/11/pester5-importing-ps-files/ commit71610ce9feAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 14 16:03:15 2020 -0400 Pin Pester v4 commitfb45693fb1Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat Apr 11 22:35:23 2020 -0400 Pester 5 Prep commit8578c775ddMerge:9fafe4bb186c56Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 20 16:19:54 2020 -0400 Merge pull request #76 from ZertoPublic/Refactor-Copy-ZertoVpg Refactor Copy-ZertoVpg and Add Tests commitb186c561e6Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 20 16:14:41 2020 -0400 Start of Next Releasenotes commitae6a80b48dMerge:c1b7c499fafe4bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 20 15:50:13 2020 -0400 Merge branch 'master' into Refactor-Copy-ZertoVpg commit9fafe4b58bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Apr 17 08:50:27 2020 -0400 Make PowerShell Gallery Badge Clickable commitc1b7c490ffAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 14 09:26:56 2020 -0400 Create Function Tests commit589a3b7d6eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 14 09:25:16 2020 -0400 Create Mock Data for Tests commit9913c96d65Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 14 09:26:22 2020 -0400 Refactor Function commitfe4d8cf4ddMerge:e374442e35939eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Apr 10 08:14:00 2020 -0400 Merge pull request #75 from ZertoPublic/ReleasePrep April Release commite35939e592Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 14:37:38 2020 -0400 Bump Version commitc422e26903Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 14:37:27 2020 -0400 Update Readme for release commite37444249eMerge:85e60ad616cdcfAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 13:27:35 2020 -0400 Merge pull request #74 from ZertoPublic/VirtulizationSiteRepos Add functionality for ZVM 8.0 commit616cdcf7a2Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 13:22:57 2020 -0400 Update Tests for WindowPS commite7658fcfecAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 13:22:42 2020 -0400 Update the version of Pester to latest version commita306391a14Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 12:55:41 2020 -0400 Fix Filename Case commit83e9551692Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 12:48:33 2020 -0400 Add tests for function commit7fbc550390Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 12:48:04 2020 -0400 Add Mocks for Tests commite3cba682c7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 9 10:37:36 2020 -0400 DRY Refactor commit96b3e65be2Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Apr 8 15:26:10 2020 -0400 Update RELEASENOTES.md commitd15111a883Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Apr 8 15:19:46 2020 -0400 Add new LTR API Endpoint Added new LTR endpoint and help messages to indicate that it will only work with Version 8.0 and above. Also updated help message for backup settings indicating that backup settings only work with 7.5 and below. commit90434b56a2Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 17:35:55 2020 -0400 Updated for new Repositories endpoint commit85e60adac1Merge:d55bc3e0d6bc39Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:44:00 2020 -0400 Merge pull request #73 from ZertoPublic/UpdateServiceAccountPassword Create function to Update service account password commit0d6bc39c86Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:30:42 2020 -0400 Add an additional example commitad2073f404Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:27:22 2020 -0400 Fixed submitted body formatting commite12bf9d85eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:18:37 2020 -0400 Fix script level variable commita5f3ad4de0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:05:34 2020 -0400 Update RELEASENOTES.md commit77fb3c8f67Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:05:31 2020 -0400 Fix helpmessage typo commitb2e5fe7b5cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 10:04:55 2020 -0400 Update Set-ZertoUserCredential.md commitf34f21bb85Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Apr 7 07:49:13 2020 -0400 Create Set-ZertoUserCredential.md commit536a62f792Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 6 17:15:57 2020 -0400 Create Set-ZertoUserCredential.Tests.ps1 commitdf83277c06Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Apr 6 17:15:52 2020 -0400 Create Set-ZertoUserCredential.ps1 commitd55bc3e4b3Merge:64fa03e7488e79Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat Apr 4 10:42:56 2020 -0400 Merge branch 'UpdateVraWithPassword' commit7488e7999fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat Apr 4 10:36:51 2020 -0400 Updated Release notes with current changes commitdcba2b04a9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat Apr 4 10:30:46 2020 -0400 Added Edit Password Information commitbd94bfe5dbAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat Apr 4 10:26:56 2020 -0400 Update Help Files commitfb722661a7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Apr 3 16:51:09 2020 -0400 Update Edit-ZertoVra.Tests.ps1 commit6121940563Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Apr 3 10:35:44 2020 -0400 Added ability to updated Host Password commit64fa03e4eaMerge:c94f04d8685444Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 19:57:38 2020 -0400 Merge pull request #71 from ZertoPublic/ZA-Planner Updates for Zerto Analytics commit86854442efAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:56:57 2020 -0400 Update Online Link to Help commitbc46a512cdAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:55:04 2020 -0400 Update RELEASENOTES.md commit0a84246d8eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:44:16 2020 -0400 Add parameter validation commitf299aecb9bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:44:00 2020 -0400 Add parameter validation commit646476e74eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:43:50 2020 -0400 Remove unused parameter commit285a82f280Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:43:39 2020 -0400 Fix Parameter Test commitfbe9fb2af8Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:43:28 2020 -0400 Fix Parameter Test commit1af70b8c80Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:38:35 2020 -0400 Create Tests commit0ef71c25bbAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:16:14 2020 -0400 Update Get-ZAPlannerZcasReport.md commit78e1cdb981Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:16:11 2020 -0400 Update Get-ZAPlannerWanReport.md commit1a66d4e64bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 17:09:25 2020 -0400 Update Get-ZAPlannerStatsReport.md commit2fef1dbc42Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 16:46:59 2020 -0400 Create Get-ZAProtectedVmReport.md commitb00ededc7fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 16:44:08 2020 -0400 Create Get-ZAProtectedVm.md commit8e5ced9b87Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 15:12:52 2020 -0400 Create Get-ZAProtectedVmReport.ps1 commit69fb384c89Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 15:12:43 2020 -0400 Create Get-ZAProtectedVm.ps1 commita8b9ec3a00Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 15:12:04 2020 -0400 Update Help File Formatting commit355be7c1e5Merge:3e980dcc94f04dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 12:30:58 2020 -0400 Merge branch 'master' into ZA-Planner commitc94f04de77Merge:d39777cf4807f9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 12:29:36 2020 -0400 Merge pull request #69 from ZertoPublic/MultiClusterSingleDatastore Updates to Install-ZertoVra commitf4807f94fbMerge:83879a5d39777cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 12:25:25 2020 -0400 Merge branch 'master' into MultiClusterSingleDatastore commitd39777cbb0Merge:71352ca8b43856Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 12:22:14 2020 -0400 Merge pull request #70 from ZertoPublic/AzurePipelinesUpdates Update build agents. commit8b43856558Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 12:17:55 2020 -0400 Update build agents. commit83879a51e7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 11:54:48 2020 -0400 Update RELEASENOTES.md commit2d1fb8e4dbAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 10:51:05 2020 -0400 Update Install-ZertoVra.md commite774cd861dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 10:48:19 2020 -0400 Update Copy-ZertoVpg.md commita660aa29b3Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 10:48:02 2020 -0400 Update Common Parameters formatting commit82458712f0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 10:46:40 2020 -0400 Update tests for new functionality commitbae9eb9b99Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Apr 2 10:27:20 2020 -0400 Update function to enable password installation commit2ea7092b91Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Apr 1 17:14:21 2020 -0400 Update logic to only allow install to attached devices commitde08f0eeceAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Mar 19 17:08:08 2020 -0400 Ensure the right DSId is mapped to the target host. commit3e980dc195Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Mar 19 16:25:28 2020 -0400 Add Online Help URI commiteccc5f27f3Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Mar 19 09:21:05 2020 -0400 Update Get-ZAPlannerNetworkPerformanceReport.md commite516a24e38Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Mar 19 09:19:48 2020 -0400 Update Get-ZAPlannerJournalSizeReport.md commit07f92583f8Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Mar 18 13:57:12 2020 -0400 Update Single Site URL commitc2f554dca1Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Mar 18 13:54:58 2020 -0400 Update Get-ZAPlannerSite.md commit8bd865d83dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 22:45:51 2020 -0400 Create Template Help Files commit02e50d9cd6Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 17:33:36 2020 -0400 Create Get-ZAPlannerZcasReport.ps1 commit7fc0a5f579Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 17:33:31 2020 -0400 Create Get-ZAPlannerWanReport.ps1 commitce5a64c683Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 17:33:27 2020 -0400 Create Get-ZAPlannerNetworkPerformanceReport.ps1 commit1317a6c039Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 17:33:24 2020 -0400 Create Get-ZAPlannerJournalSizeReport.ps1 commit169e628c7bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 14:57:19 2020 -0400 Remove Debugging Output commitd35d9d7cf4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 14:40:22 2020 -0400 Create Get-ZAPlannerStatsReport.ps1 commita891a4914dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Mar 8 14:39:34 2020 -0400 Create Get-ZAPlannerSite.ps1 commit71352cae7bMerge:fad3ca0b0edd90Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 17:22:53 2020 -0500 Merge pull request #68 from ZertoPublic/IZRR-to-public Move RestRequest functions into Public commitb0edd9026fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 14:08:12 2020 -0500 Update RELEASENOTES.md commit7cde687d70Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 13:42:58 2020 -0500 Create Documentation for Newly Public Functions commit569d9e264cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 13:42:39 2020 -0500 Update ZertoRestRequest and associated Tests commit40331c26f9Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 13:42:20 2020 -0500 Update ZARestRequest and associated tests. commit526093afc6Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 13:31:59 2020 -0500 Fix the Tests extension commitdc4dd1ad05Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 10:40:21 2020 -0500 Move IZRR function to public commit779ee1415eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 10:38:41 2020 -0500 Move IZRR to public commit13592df6aaAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 10:33:12 2020 -0500 Move ZARestRequest to Public Function commitfad3ca0e27Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 10:01:17 2020 -0500 Update RELEASENOTES.md commit52782aa1e5Merge:cc9e53abc02e79Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Mar 6 09:11:10 2020 -0500 Merge pull request #67 from ZertoPublic/Refactor-GetVpg Refactor Get-ZertoVpg commitbc02e796d6Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Mar 5 21:43:52 2020 -0500 Refactor for DRY commit4c32bbe057Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Mar 5 21:43:32 2020 -0500 Update to PwSh Version 7 commitcc9e53ac44Merge:ecab25037165e1Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Mar 2 10:30:12 2020 -0500 Merge branch 'fix-typos' commit37165e18a7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Mar 2 10:00:45 2020 -0500 Typo Correction Update commit772848beefAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Mar 2 09:53:55 2020 -0500 Updated help file to reflect typo correction commit18185612bbAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Mar 2 09:51:23 2020 -0500 Fixed recovery switch typo commitecab2500c7Merge:1e80bb0fde7f67Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Mar 2 09:46:34 2020 -0500 Merge pull request #65 from ZertoPublic/checkpoint-refactor Checkpoint refactor commitfde7f67e45Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Mar 2 09:41:09 2020 -0500 Update RELEASENOTES.md commite19f9b34f5Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Feb 28 08:15:53 2020 -0500 Update function to allow pipeline operations commita36a7cb37aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Feb 28 08:15:15 2020 -0500 Cleanup documentation commit1e80bb06fbMerge:02f1c894c98b75Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 22 11:01:27 2019 -0500 Merge pull request #63 from ZertoPublic/ExportNicUpdate Update Export and Import VpgNicSetting functions commit4c98b75134Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 22 10:48:07 2019 -0500 Update RELEASENOTES.md commita7efc7c717Merge:801553102f1c89Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 22 10:37:44 2019 -0500 Merge branch 'master' into ExportNicUpdate commit02f1c89d86Merge:579ba7a5b9243aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 22 10:35:35 2019 -0500 Merge pull request #62 from ZertoPublic/RecoveryReport Remove -VpgIdentifier Parameter from Get-ZertoRecoveryReport function commit5b9243a02fAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 22 10:16:27 2019 -0500 Updated releasenotes with changes commit1962dda15cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 22 10:07:17 2019 -0500 Remove vpgIdentifier Parameter vpgIdentifier Parameter as added as a parameter by mistake. The API does not accecpt this as a filter. commit801553178eAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Dec 20 22:56:20 2019 -0500 Update Online Help Link commit6c92dff447Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Dec 20 22:56:04 2019 -0500 Update Description with new logic commit003396998cAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Dec 20 21:09:12 2019 -0500 Eliminate Blank Output commit05783a1f37Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Dec 19 18:49:13 2019 -0500 Update Import Logic commit270470f858Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Dec 18 13:06:11 2019 -0500 Update Nic Object Logic commit579ba7a063Merge:abadc862cb3516Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 1 17:15:24 2019 -0500 Merge pull request #59 from ZertoPublic/PrepRelease Prep release commit2cb35165a9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Dec 1 17:09:57 2019 -0500 Update README commit82cf4cb732Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Dec 1 17:05:53 2019 -0500 Bump Version for Release commit9d21eb6409Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Dec 1 17:05:40 2019 -0500 Format Release Notes commitabadc86ae8Merge:7cad7eaf094263Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun Dec 1 17:01:53 2019 -0500 Merge pull request #58 from ZertoPublic/FoT-Fix Fixes Failover Test function commitf094263882Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 28 10:55:59 2019 -0500 Update RELEASENOTES.md commitc47614727aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 28 10:41:26 2019 -0500 Fix Verbose Typo commit7cad7eaf75Merge:5b8a89ed6862f7Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Nov 8 08:32:13 2019 -0500 Merge pull request #56 from ZertoPublic/CopyVpgBugFix Fix Bug when Adding Additional VMs commitd6862f75d1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 7 22:35:40 2019 -0500 Fix Bug when Adding Additional VMs commit5b8a89e1a3Merge:5c76c4cd6562deAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Nov 7 21:45:27 2019 -0500 Merge pull request #55 from ZertoPublic/CloneVPG Implement Clone VPG Function commitd6562de9bfAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 7 21:37:03 2019 -0500 Update for Copy-ZertoVpg commitcdae203993Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 7 17:44:06 2019 -0500 Fix Documentation Formatting commit213b6029e4Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 7 17:43:40 2019 -0500 Create Documentation commit11ab03be0aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 7 17:43:29 2019 -0500 Create Tests commit5f978d7b1aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Nov 7 17:43:18 2019 -0500 Fix AddVM Logic commit5c76c4c58cMerge:8a1593c8b3a3b3Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Nov 4 16:20:49 2019 -0500 Merge pull request #53 from ZertoPublic/wcarroll-patch-1 Update Connect-ZertoServer.md commit8b3a3b3b0bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Nov 4 16:20:31 2019 -0500 Update Connect-ZertoServer.md commit63d56cf862Merge:10785df5984bc9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Oct 25 14:10:09 2019 -0400 Merge branch 'CloneVPG' of https://github.com/wcarroll/ZertoApiWrapper into CloneVPG commit10785df8a9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Oct 12 22:26:13 2019 -0400 Create Copy-ZertoVpg Function commit8a1593cebaMerge:528bc661ca3d67Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Oct 25 14:03:26 2019 -0400 Merge pull request #52 from ZertoPublic/EvacuateHost Implement Evacuate VRA Function commit1ca3d6704bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Oct 25 13:49:59 2019 -0400 Update Release Notes for Evacuate Function commitb4a7df970cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 24 13:51:26 2019 -0400 Correct VraIdentifier Property commit3d8acf03f6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 24 13:50:52 2019 -0400 Update Tests to include set counts commit07de073bf1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 24 07:25:38 2019 -0400 Create Invoke-ZertoEvacuateVra.Tests.ps1 commit7641d28307Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Oct 23 10:00:42 2019 -0400 Add parameter validation commit30422d0421Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Oct 23 09:52:09 2019 -0400 Create Invoke-ZertoEvacuateVra.md commit4a0885f731Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Oct 22 13:35:49 2019 -0400 Fix Help Message Typo commit28d66806a5Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Oct 22 13:31:10 2019 -0400 Add ExternalHelp Def commit42b923cef5Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Oct 22 13:26:10 2019 -0400 Create EvacuateVra Function commit5984bc93c9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Oct 12 22:26:13 2019 -0400 Create Copy-ZertoVpg Function commit528bc66bcdMerge:9d34086e706470Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Oct 8 12:45:15 2019 -0400 Merge pull request #49 from ZertoPublic/New-Token Add Function to Obtain a Pairing Token commite706470395Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Oct 8 12:37:11 2019 -0400 Add `New-ZertoPairingToken` to Release notes. commit29a79bbb92Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Oct 8 12:31:34 2019 -0400 Correct extension case. commitf907acd14aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Oct 7 11:23:24 2019 -0400 Create New-ZertoPairingToken.md commit90a17045afAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Oct 7 11:23:19 2019 -0400 Create PairingToken.Json commite1ba8412ffAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Oct 7 11:23:13 2019 -0400 Create New-ZertoPairingToken.Tests.ps1 commit0a90d51735Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Oct 7 11:23:10 2019 -0400 Create New-ZertoPairingToken.ps1 commit9d34086e40Merge:6cc2e8d842c7ceAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Oct 4 17:01:37 2019 -0400 Merge pull request #48 from ZertoPublic/75Update Update to add token parameter to Add-ZertoPeerSite commit842c7ceeecAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 3 16:54:56 2019 -0400 Added release notes for this update. commitd78fc28b1cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 3 14:33:17 2019 -0400 Add ShouldProcess support to help file. commit28fb42d56aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 3 14:33:01 2019 -0400 Update documentation for token parameter and example. commit0657607f3aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 3 14:32:36 2019 -0400 Update Tests to New format and add token parameter tests commit32f6a6eebcAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Oct 3 14:32:05 2019 -0400 Update function to use new token parameter commit6cc2e8d61dAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Wed Sep 4 15:45:17 2019 -0400 Correct Example Number Typo commitb9598e7e0bAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Aug 1 14:11:59 2019 -0400 Add Aug Release in recent updates. commita9ea273d55Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Aug 1 11:51:04 2019 -0400 Bump Version for Release commitf5c81a0766Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Aug 1 11:50:46 2019 -0400 Update RELEASENOTES.md commit3a8e742aadMerge:a4e39617b07fb0Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jul 30 10:22:36 2019 -0400 Merge pull request #44 from ZertoPublic/NewVpgBugFix Update method to add VMs to Object commit7b07fb0fd7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 29 08:50:25 2019 -0400 Update method to add VMs to Object commita4e3961bd7Merge:46951b7551eac5Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jul 26 11:13:41 2019 -0400 Merge pull request #42 from ZertoPublic/UpdateTests Update Testing Methods commit551eac5d5aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Jul 26 11:06:07 2019 -0400 Update release notes for testing changes commit916fbb6c4cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 13:13:38 2019 -0400 Add Parameter Validation Tests commit5c2e16d5c6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 13:13:24 2019 -0400 Add Parameter Validation commit8b0def7c50Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 12:59:23 2019 -0400 Update Parameter Tests commit73884ef022Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 12:57:01 2019 -0400 Update Parameter Tests commitfd1619351eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 12:51:13 2019 -0400 Update Parameter Tests commit4e7d30ef33Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 12:30:30 2019 -0400 Add NullOrEmpty validation test commit2769489939Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 23 12:27:11 2019 -0400 Create Parameter Tests commitbaf6aa50eeAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 21:55:28 2019 -0400 Add Parameter Tests commitc96836c000Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 21:46:31 2019 -0400 Add Parameter Tests commit51a1e0fb03Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 21:27:14 2019 -0400 Add Parameter Tests commitc6b37c24a6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 21:22:24 2019 -0400 Add Parameter Tests commit1d6c2289e8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 21:20:45 2019 -0400 Add Parameter Tests commitad6b154d85Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 20:52:34 2019 -0400 Add Parameter Tests commit28fabd592cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 20:09:03 2019 -0400 Add Parameter Tests commite751202010Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 20:03:52 2019 -0400 Add Parameter Tests commitb5a637fe60Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 19:59:02 2019 -0400 Add Parameter Tests commitb294f3e6adAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 19:54:39 2019 -0400 Add Parameter Tests commit1be09bd734Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 19:52:54 2019 -0400 Add Parameter Tests commite07b99613eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 22 17:08:17 2019 -0400 Add Parameter Tests commit6a924067c9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:57:25 2019 -0400 Add Parameter Tests commitd2eddea4bcAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:51:01 2019 -0400 Add Parameter Tests commit5e12656a4aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:44:35 2019 -0400 Add Parameter Tests commit96803e1ad5Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:42:12 2019 -0400 Add Parameter Tests commit79542e8f7fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:41:05 2019 -0400 Add Parameter Tests commitc8da651200Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:37:32 2019 -0400 Add Parameter Tests commitc578ec428eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:35:26 2019 -0400 Add Parameter Tests commit6bc6f902fdAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:33:19 2019 -0400 Add Parameter Tests commitfc3a2a0193Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:31:53 2019 -0400 Add Parameter Tests commitaaa505c790Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:30:22 2019 -0400 Add Parameter Tests commit7fe361dba7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:26:24 2019 -0400 Add Parameter Tests commit356572a1f8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:24:07 2019 -0400 Add Parameter Tests commit878622d3e2Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:20:31 2019 -0400 Add Parameter Tests commitc83462d03cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 20:08:54 2019 -0400 Add Parameter Tests commitba1e1c309eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 19:48:04 2019 -0400 Add Parameter Tests commit21bc81b0ecAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 18:24:34 2019 -0400 Add Parameter Tests commit8267474d8aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 18:24:16 2019 -0400 Update Mandatory Setting for DatastoreId commitfee7cd9723Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 18:16:25 2019 -0400 Add Parameter Validation Tests commitefea494475Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 12:23:27 2019 -0400 Update Parameter Counts commit9be00e68b1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 12:17:33 2019 -0400 Update to new test format commit928d6ef4a1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 12:09:15 2019 -0400 Update tests to new format commite1720dd4f7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 11:56:03 2019 -0400 Update test description commit202c865fe8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 11:54:28 2019 -0400 Update tests to new format commit6df14f7a8dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 11:49:08 2019 -0400 Parameter Count Test commit5213614299Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 11:36:46 2019 -0400 Add Parameter count test commita39f2638d1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 21 11:36:30 2019 -0400 Update to new test format commit37016076fdAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 20:56:23 2019 -0400 Update to the new format commitc05a527982Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 20:14:58 2019 -0400 Update tests to new format commitff54a92f92Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 20:10:06 2019 -0400 Fix function call var commitb82912605eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 20:07:02 2019 -0400 Update tests to new format commit3e3a433843Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 20:03:06 2019 -0400 Update tests to new format commit047e701f55Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 20:01:02 2019 -0400 Update tests to new format commit6b1486b74dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 19:58:48 2019 -0400 Update Tests to new format commit213329801aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 19:42:48 2019 -0400 Update Tests to New Format commit55fb683dc3Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 19:18:46 2019 -0400 Update Tests to TestCases commit075a78436dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 18:35:13 2019 -0400 Add Mock Data Files commita6d81aca44Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 13:49:37 2019 -0400 Refactor Tests commit9f2a6c42cdAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 13:49:03 2019 -0400 Change error to Throw commita78f827804Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 13:48:25 2019 -0400 Add Dhcp VRA Mock commita526045662Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 13:01:32 2019 -0400 Update Map Function Call commit6a6b073adaAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 13:00:28 2019 -0400 Redirect Invoke Output to Null commitb11c497eadAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 12:59:12 2019 -0400 Update Exclude Rules commit344e7836f9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 12:57:27 2019 -0400 Update .gitignore commit1e64d9d7f3Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 12:57:21 2019 -0400 Renamed Function commit9ab97f2786Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 11:39:05 2019 -0400 Update Test Template for both source and built tests commit997ab90035Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jul 20 11:37:22 2019 -0400 Add Mock File for Single VRA Information commit86ac714c22Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Jul 19 14:23:16 2019 -0400 Use TestCases commit0c4643a76eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Jul 19 14:22:56 2019 -0400 Change ThrowError to Throw commit1cfc07260fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Jul 19 14:22:39 2019 -0400 Remove unused BeforAll Block commit82dbe7ae48Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Jul 19 13:47:53 2019 -0400 Update Invoke-ZARestRequest.Tests.ps1 commit670fbdbba8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri Jul 19 11:54:11 2019 -0400 Change ThrowError to Throw commit2e6a37bd5fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jul 18 21:25:20 2019 -0400 Update Invoke-ZertoRestRequest.Tests.ps1 commit1c17ca3e96Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jul 18 21:25:18 2019 -0400 Update Invoke-ZertoRestRequest.ps1 commit6b05af2db4Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 16 14:52:22 2019 -0400 Update Invoke-ZARestRequest.Tests.ps1 commit40326da05fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 16 14:16:06 2019 -0400 Update to ThrowErrors when required vars missing commitdb91acb770Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 16 14:11:01 2019 -0400 remove global variables when complete commit562d1210e6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 15 15:31:44 2019 -0400 Update Tests for Mutlirun commitd7ee3eab12Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 15 15:30:54 2019 -0400 Updating Formatting commit19b645bcccAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 15 11:48:47 2019 -0400 Exclude Common Parameters in Filter String commite6c5effe7cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 15 11:48:13 2019 -0400 Specify InputObject Type commit235434fe20Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 14 20:36:32 2019 -0400 Update function to global variable commitdd144d3c47Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 14 20:35:47 2019 -0400 Update to use New-Map helper function commit4fee466cc8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 14 20:34:53 2019 -0400 Add Mocks for New-Map commitf1afbe6748Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jul 14 20:34:26 2019 -0400 Create private helper function New-Map commit5eae4857cfAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jul 11 18:14:32 2019 -0400 Updating tests for multiuse commite930f996d6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jul 11 18:05:53 2019 -0400 Add mock files for testing commit9a010244b4Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jul 11 07:55:47 2019 -0400 Update to paths commit7339366f7dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jul 10 21:19:48 2019 -0400 Update Build Pipeline for Additional Tests commit7f5fb6c1acAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jul 10 21:10:13 2019 -0400 Update Build Process Versions and Steps commit46951b76baAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Fri Jul 26 08:33:41 2019 -0400 Add missing formatting variable to the Get-ZAVpg function (#41) * Add missing formatting variable * Update ReleaseNotes commit06b6bb09d7Merge:b2c3548ddb639aAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jul 9 14:34:40 2019 -0400 Merge pull request #39 from ZertoPublic/NicExportImport Bulk NIC Information Export and Import commitddb639ad6bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 9 13:29:31 2019 -0400 Update RELEASENOTES.md commit4d7d1391ffAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 9 13:12:22 2019 -0400 Create function and required supporting docs Import-ZertoVmNicSetting commitcb991b3d0cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 9 12:38:02 2019 -0400 Correct On-line Help Link URI commit80c82b99e0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jul 9 11:48:21 2019 -0400 Update to use Export-CSV commit90cf88b5cbAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 8 13:38:48 2019 -0400 Update ZertoApiWrapper.build.ps1 commitef1584032eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 8 13:22:18 2019 -0400 Create function and required associated docs Export-ZertoVmNicSetting commit1fd92008acAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 8 12:55:31 2019 -0400 Update Remove-ZertoVpgSettingsIdentifier.md commit0a2e6974f0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jul 8 11:59:50 2019 -0400 Create Function and related files Remove-ZertoVpgSettingsIdentifier commitb2c3548d01Merge:148b33c0b1f2c4Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue Jun 25 15:32:27 2019 -0400 Merge pull request #37 from ZertoPublic/ZATokenCheck Add a Token Check to the Invoke-ZARestRequest Private Function commit0b1f2c4d1bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jun 25 14:02:07 2019 -0400 Update psd1 to export all functions This will not happen in built releases, but just for in-house testing scenarios. commitb7d4664d6bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jun 25 14:00:40 2019 -0400 Correct Last Action Variable Name commit44ed5767eaAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Tue Jun 25 08:30:54 2019 -0400 Update Expired Token Error Message commit83649fb72aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 24 12:47:50 2019 -0400 Add information to release notes. commit9d579a5785Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 24 12:42:23 2019 -0400 Update VSCode settings commitad8f06c6e1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 24 12:42:10 2019 -0400 Add Logic for token tests commit148b33c1e3Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 19 17:03:23 2019 -0400 Add Issue and PR Templates commita8025f4be1Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 17 09:18:04 2019 -0400 Fix Install CodeBlock commit9c16c2c6e2Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 17 09:14:10 2019 -0400 Fix CodeBlock Formatting commitf91d16f11aMerge:5f5d449e94c2b6Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon Jun 17 09:11:11 2019 -0400 Merge pull request #34 from ZertoPublic/ZertoAnalytics Implements Zerto Analytics Functionality. commite94c2b66e1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 17 09:07:45 2019 -0400 Ignore Plural Nouns In PSSA commitc08df4c1a0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 17 08:58:23 2019 -0400 Update for Release commit82df93143bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 17:54:53 2019 -0400 Cleaning InvokeBuild Script commit59a0112f2cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 17:54:36 2019 -0400 Update RELEASENOTES.md commitc70e0a6701Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 17:54:32 2019 -0400 Update README.md commit598b9027a6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 11:38:36 2019 -0400 Add Interval Parameter commit8edfb97b1fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 10:07:13 2019 -0400 Create function and related docs Get-ZANetworkVpgAveragePerformance commit1ad528c114Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 09:54:33 2019 -0400 Create function and associated docs Get-ZANetwrokVpgAverageIOPS commita0cc4214caAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 09:54:07 2019 -0400 Add parameter validation commit2ed0169a00Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 09:40:00 2019 -0400 Create function and associated docs. Get-ZANetworkVpgSummary commitb0763e965eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 09:39:36 2019 -0400 Create Function and Required Docs Get-ZANetworkVpgStat commit5447d1b443Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 09:06:52 2019 -0400 Create Function and associated docs Get-ZANetworkSiteAverageIOPS commitee4419687aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 09:06:29 2019 -0400 Fix Spelling Error commitdce6d688b7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 08:53:48 2019 -0400 Create function and required docs Get-ZANetworkSiteAveragePerformance commitaaed38ee35Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 08:53:29 2019 -0400 Fix filename typo commitd3dbc71a64Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 07:58:57 2019 -0400 Create function and associated docs Get-ZANetworkSiteStat commitff809b733fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 10 07:58:33 2019 -0400 Correct spelling errors and Add Examples commit9a2e1c63adAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:18:36 2019 -0400 Create Function and Required Docs Get-ZANetworkSiteSummary commitfb7fd5abb8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:18:09 2019 -0400 Update Parameter Information commite33b45a274Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:06:24 2019 -0400 Correct mis-named variable commitd31b4ce995Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:05:47 2019 -0400 Update Mis-named variable commitc6a53688ecAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:04:57 2019 -0400 Correct Parameter Variable Name commit1da569fa6aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:03:31 2019 -0400 Correct Parameter in Help File commit58e948dfbcAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:03:02 2019 -0400 Update Help Parameters commit27c44056a5Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 16:02:16 2019 -0400 Create Function and Associated Docs Get-ZASitePair commit7a80131e95Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 15:31:09 2019 -0400 Create Function and required docs Get-ZAJournalSiteHistorySummary commit8b6f4999b2Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 15:27:02 2019 -0400 Create Function and Required Docs Get-ZAJournalSiteSizeStat commita74bc14e30Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 15:26:28 2019 -0400 Function Rename commit108cb12439Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 15:26:14 2019 -0400 Function Rename commitd2b559ec83Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 15:25:36 2019 -0400 Function Rename commit5bd2d83cc8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 15:07:40 2019 -0400 Create function and associated docs Get-ZAJournalHistorySiteStat commiteb528e3432Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 14:58:04 2019 -0400 Create Function and Required Docs Get-ZAJournalAverageSize commitaeeaf73da0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 14:57:38 2019 -0400 Correct Parameter Error commit1110fcc56aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 14:51:38 2019 -0400 Create Function and required docs Get-JournalAverageSize commitca2620d9b5Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 14:51:16 2019 -0400 Create function and required docs Get-ZAJournalAverageSiteHistory commitd46869353bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 14:50:54 2019 -0400 Create Function and Required Docs Get-ZAJournalAverageHistory commit0fda0c1e78Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:49:45 2019 -0400 Create Function and Docs Get-ZAJournalStatusProportion commit0226fdd432Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:49:09 2019 -0400 Fix Function Name Typos in Docs commitb934e28657Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:41:55 2019 -0400 Create Get-ZAJournalHistoryStat and Docs commitced0066244Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:41:42 2019 -0400 Create Get-ZAJournalBreach and Docs commit6ab9a2dae6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:32:50 2019 -0400 Create Get-ZAJournalStorage Stat and Docs commitbb6de17e7cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:25:07 2019 -0400 Create Get-ZAJournalSummary and Docs commit89bfe61a1bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:18:11 2019 -0400 Add Parameter Validation commit72cbe0eb29Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:02:25 2019 -0400 Create Get-ZARPOAverage and Required Docs commit80bad68238Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 12:02:06 2019 -0400 Update Related Links description commite80fab4eacAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 11:52:21 2019 -0400 Fix Function Name Typo commitf3d07003b4Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 11:17:07 2019 -0400 Create Get-ZARPOAccountAverage and Docs commit675c43b35eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 10:12:00 2019 -0400 Create Get-ZARPOStatusProportion and Docs commitb22345dc63Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 10:02:50 2019 -0400 Create Get-ZARPOBreach and required docs. commit1c9a5bb6cbAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 09:59:05 2019 -0400 Fix Get-ZARPOStat issues with tests and docs commit9262f1b42dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 09:50:35 2019 -0400 Create Get-ZARPOStat and required docs commitf7fff2248eAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun Jun 9 08:56:04 2019 -0400 Create Get-ZARPOSummary and Docs commit358d680c72Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jun 8 16:11:04 2019 -0400 Remove AlertAggregation Remove AlertAggregation, Will add aggregation into Alert down the road. commitf0fb1d4fc6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jun 8 16:09:10 2019 -0400 Add required External Help Line commit35b03a963fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jun 8 16:08:57 2019 -0400 Update Help File commitc83eb2d8a7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sat Jun 8 16:08:25 2019 -0400 Create Get-ZAVolume and required files commita475eee47aMerge:1008c2c1f03febAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 17:55:01 2019 -0400 Resolving Merge Conflicts commit1f03feb1c6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 14:29:22 2019 -0400 Create Get-ZADatastore function & supporting docs commitc88d175fd0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 13:59:41 2019 -0400 Correct Help Message Typo commit0e148bdb1bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 13:59:13 2019 -0400 Create Get-ZATask files and content commit4fc6c9ebcdAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 13:36:04 2019 -0400 Create Get-ZAEvent Files commit7ec6d846c0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 12:30:01 2019 -0400 Create External Help File for Get-ZAzOrg Function commitf2d2e00f12Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 12:28:07 2019 -0400 Create Get-ZAVpg External Help File commit2c891795b2Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:57:05 2019 -0400 Add Online Parameter URL commit9799feaeeaAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:50:09 2019 -0400 Formatting Update commitcddd25ded1Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:49:49 2019 -0400 Formatting Update commitebc86c5e71Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:48:49 2019 -0400 Update Function to set variable to mandatory commita3fd87f933Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:46:49 2019 -0400 Create Get-ZASiteTopology Markdown Help File commit6d66a1c35bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:44:04 2019 -0400 Create Get-ZASite Markdown help file commit8b09b702d6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:42:01 2019 -0400 Create Get-ZAMonitoring Markdown Help file commit0fbc6d2242Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:35:41 2019 -0400 Create Get-ZALicense Markdown Help File commitf0f45a383fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:34:27 2019 -0400 Create Get-ZAAlert Markdown Help File commitd8084b2fb3Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:31:55 2019 -0400 Formatting Update commit5990d57285Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:31:44 2019 -0400 Fix variable Typo commit8581c037d7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:20:29 2019 -0400 Add task to update the Markdown help files with new commands. commitba4f0fc82aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Thu Jun 6 11:20:01 2019 -0400 Create Connect-ZertoAnalytics.md commit70261242dbAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 15:55:28 2019 -0400 Update Invoke-ZertoFailoverCommit.md commitbc9e485346Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 15:41:31 2019 -0400 Update Invoke-ZertoFailoverCommit.md Add SupportShouldProcess commit8d5111a24aAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:20:13 2019 -0400 Create Get-ZAzOrg Function and Tests commit87857303a0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:19:34 2019 -0400 Create Get-ZAVpg Function and Tests commit97aa9f1ba8Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:18:57 2019 -0400 Create Get-ZASiteTopology Function and Tests commit5018404641Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:18:16 2019 -0400 Create Get-ZASite Function and Tests commite43e911c7bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:17:41 2019 -0400 Create Get-ZAAlertAggregation Function and Tests commit15435c9261Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:16:43 2019 -0400 Create Get-ZAAlert Function and Tests commit848daf3c49Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:13:31 2019 -0400 Create ZAMonitoring Function and Tests commitb424605735Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:12:36 2019 -0400 Create Get-ZALicense.Tests.ps1 commit5f24cc8c73Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:08:45 2019 -0400 Make into an advanced function. commitc78ad3e696Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:08:06 2019 -0400 Create Connect-ZertoAnalytics.Tests.ps1 commitab39ba70a2Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:07:58 2019 -0400 Create Invoke-ZARestRequest.Tests.ps1 commit934f026644Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:07:37 2019 -0400 Add External Help File commit183bbc7d13Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 3 07:11:33 2019 -0400 Create Get-ZALicense.ps1 commit6a32ed6e14Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 3 07:11:20 2019 -0400 Create Connect-ZertoAnalytics.ps1 commit79fe7de886Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 3 07:11:15 2019 -0400 Create Invoke-ZARestRequest.ps1 commit5f5d4497beMerge:1c630ed8365083Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 6 10:51:24 2019 -0400 Merge pull request #33 from ZertoPublic/add-code-of-conduct-1 Create CODE_OF_CONDUCT.md commit8365083814Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Thu Jun 6 10:32:00 2019 -0400 Create CODE_OF_CONDUCT.md commit1008c2c670Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 15:41:31 2019 -0400 Update Invoke-ZertoFailoverCommit.md Add SupportShouldProcess commitfd2d175defAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:20:13 2019 -0400 Create Get-ZAzOrg Function and Tests commit1b331105b9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:19:34 2019 -0400 Create Get-ZAVpg Function and Tests commit0f35782f66Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:18:57 2019 -0400 Create Get-ZASiteTopology Function and Tests commitbcc5c49b71Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:18:16 2019 -0400 Create Get-ZASite Function and Tests commitee7770e1e9Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:17:41 2019 -0400 Create Get-ZAAlertAggregation Function and Tests commit58a3500dddAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:16:43 2019 -0400 Create Get-ZAAlert Function and Tests commit50354f10cfAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:13:31 2019 -0400 Create ZAMonitoring Function and Tests commit04b8b9837bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:12:36 2019 -0400 Create Get-ZALicense.Tests.ps1 commitce5a37ceb6Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:08:45 2019 -0400 Make into an advanced function. commit947fbe6468Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:08:06 2019 -0400 Create Connect-ZertoAnalytics.Tests.ps1 commit1ef5d63cf7Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:07:58 2019 -0400 Create Invoke-ZARestRequest.Tests.ps1 commit14424c6b51Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Wed Jun 5 14:07:37 2019 -0400 Add External Help File commitb22481e3b0Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 3 07:11:33 2019 -0400 Create Get-ZALicense.ps1 commita1a4a78820Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 3 07:11:20 2019 -0400 Create Connect-ZertoAnalytics.ps1 commitca5d357d2fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Mon Jun 3 07:11:15 2019 -0400 Create Invoke-ZARestRequest.ps1 commit1c630edc8eMerge:23ad2405713fcdAuthor: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sat Jun 1 22:51:50 2019 -0400 Merge pull request #32 from ZertoPublic/PowerShellBackPort PowerShell back port commit5713fcd02cAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri May 31 17:03:26 2019 -0400 Getting Ready for Release to PSGallery commitb18da2e79bAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri May 31 17:03:10 2019 -0400 Refelect 5.1 Update commit6b73f0bcceAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri May 31 10:32:12 2019 -0400 Update GitHub URLs to Reflect ZertoPublic Project commit8763be768dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri May 31 10:01:50 2019 -0400 Update AzPipelines to run PowerShell 5.1 Tests commitfa043df02fAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri May 31 09:39:54 2019 -0400 Request Logic to support Windows PowerShell Added logic needed to support Windows PowerShell including a Certificate Bypass. May move this into a function later to cllean the module a bit. commit51064c5d64Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Fri May 31 09:38:48 2019 -0400 Update Minimum PowerShellVersion to 5.1.0 commit23ad240a52Merge:dae010c2761276Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Tue May 21 09:35:27 2019 -0500 Merge pull request #31 from ZertoPublic/MoreTests Update Get-ZertoLocalSite.Tests.ps1 commitdae010c262Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Mon May 20 08:46:32 2019 -0500 Update README.md Update Build Status to New Project Location commit27612761b4Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 17:52:32 2019 -0500 Update Get-ZertoLocalSite.Tests.ps1 commit8533cb98bdMerge:f2ab95928c3511Author: Wes Carroll <wcarroll@users.noreply.github.com> Date: Sun May 19 17:33:03 2019 -0500 Merge pull request #30 from wcarroll/Hackathon Hackathon commit28c35115ebAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 17:01:36 2019 -0500 Update Get-ZertoDatastore.Tests.ps1 commit2465305ddfAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 16:52:44 2019 -0500 Update Get-ZertoAlert.Tests.ps1 commit4de751bc3dAuthor: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 16:52:36 2019 -0500 Typo Fix commit98aedca373Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 16:24:39 2019 -0500 Update Parameter Tests commitf2ab959b93Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 15:35:15 2019 -0500 Add Parameter Tests commit17275b1191Author: Wes Carroll <wcarroll@oceanbeachlife.com> Date: Sun May 19 15:34:55 2019 -0500 Move Move Logic to Process Block
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# How to contribute
|
||||
|
||||
Contributions to ZertoApiWrapper are highly encouraged and desired.
|
||||
Below are some guidelines that will help make the process as smooth as possible.
|
||||
|
||||
## Getting Started
|
||||
|
||||
- Make sure you have a [GitHub account](https://github.com/signup/free)
|
||||
- Submit a new issue, assuming one does not already exist.
|
||||
- Clearly describe the issue including steps to reproduce when it is a bug.
|
||||
- Make sure you fill in the earliest version that you know has the issue.
|
||||
- Fork the repository on GitHub
|
||||
|
||||
## Suggesting Enhancements
|
||||
|
||||
I want to know what you think is missing from ZertoApiWrapper and how it can be made better.
|
||||
|
||||
- When submitting an issue for an enhancement, please be as clear as possible about why you think the enhancement is needed and what the benefit of it would be.
|
||||
|
||||
## Making Changes
|
||||
|
||||
- From your fork of the repository, create a topic branch where work on your change will take place.
|
||||
- To quickly create a topic branch based on master; `git checkout -b my_contribution master`.
|
||||
Please avoid working directly on the `master` branch.
|
||||
- Make commits of logical units.
|
||||
- Check for unnecessary whitespace with `git diff --check` before committing.
|
||||
- Please follow the prevailing code conventions in the repository.
|
||||
Differences in style make the code harder to understand for everyone.
|
||||
- Make sure your commit messages are in the proper format.
|
||||
|
||||
```
|
||||
Add more cowbell to Get-Something.ps1
|
||||
|
||||
The functionality of Get-Something would be greatly improved if there was a little
|
||||
more 'pizzazz' added to it. I propose a cowbell. Adding more cowbell has been
|
||||
shown in studies to both increase one's mojo, and cement one's status
|
||||
as a rock legend.
|
||||
```
|
||||
|
||||
- Make sure you have added all the necessary Pester tests for your changes.
|
||||
- Run _all_ Pester tests in the module to assure nothing else was accidentally broken.
|
||||
|
||||
## Documentation
|
||||
|
||||
I am infallible and as such my documenation needs no corectoin.
|
||||
In the highly unlikely event that that is _not_ the case, commits to update or add documentation are highly apprecaited.
|
||||
|
||||
## Submitting Changes
|
||||
|
||||
- Push your changes to a topic branch in your fork of the repository.
|
||||
- Submit a pull request to the main repository.
|
||||
- Once the pull request has been reviewed and accepted, it will be merged with the master branch.
|
||||
- Celebrate
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [General GitHub documentation](https://help.github.com/)
|
||||
- [GitHub forking documentation](https://guides.github.com/activities/forking/)
|
||||
- [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
|
||||
- [GitHub Flow guide](https://guides.github.com/introduction/flow/)
|
||||
- [GitHub's guide to contributing to open source projects](https://guides.github.com/activities/contributing-to-open-source/)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- If you're describing a bug, tell us what should happen -->
|
||||
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||
<!--- or ideas how to implement the addition or change -->
|
||||
|
||||
## Steps to Reproduce (for bugs)
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Module version used:
|
||||
* Operating System and PowerShell version:
|
||||
* Zerto Virtual Manager Version:
|
||||
@@ -0,0 +1,37 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
## Related Issue
|
||||
<!--- This project only accepts pull requests related to open issues -->
|
||||
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
|
||||
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
|
||||
<!--- Please link to the issue here: -->
|
||||
|
||||
## Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Screenshots (if appropriate):
|
||||
|
||||
## Types of changes
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||
|
||||
## Checklist:
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
- [ ] My code follows the code style of this project.
|
||||
- [ ] My change requires a change to the documentation.
|
||||
- [ ] I have updated the documentation accordingly.
|
||||
- [ ] I have read the **CONTRIBUTING** document.
|
||||
- [ ] I have added tests to cover my changes.
|
||||
- [ ] All new and existing tests passed.
|
||||
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
|
||||
*.zip
|
||||
temp/*
|
||||
Tests/Public/TestResults.xml
|
||||
Tests/TestResults.xml
|
||||
BuiltTestResults.xml
|
||||
SourceTestResults.xml
|
||||
publish/*
|
||||
CodeCoverage.xml
|
||||
scratch
|
||||
.DS_Store
|
||||
|
||||
Vendored
+6
-1
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"terminal.integrated.shell.windows": "c:/Program Files/PowerShell/6/pwsh.exe"
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.tabSize": 4,
|
||||
"powershell.codeFormatting.preset": "OTBS",
|
||||
"terminal.integrated.shell.windows": "c:/Program Files/PowerShell/7/pwsh.exe",
|
||||
"powershell.codeFormatting.addWhitespaceAroundPipe": true
|
||||
}
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.5.3]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/112) where `New-ZertoVpg` would fail when specifying the local site as the target site.
|
||||
* Updated the method where a Site Identifer is obtained during the `New-ZertoVpg` execution that would occasionally fail on some versions of PowerShell.
|
||||
|
||||
#### Updated
|
||||
|
||||
* Updated `New-ZertoVpg` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md) to more clearly specify the return value and the requirement to pass it into the `Save-ZertoVpgSetting` function to commit the VPG.
|
||||
|
||||
## [1.5.2]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an issue when attempting to export more than 100 VPGs with the `Export-ZertoVpg` function that would cause an error.
|
||||
|
||||
## [1.5.1]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/108) with `New-ZertoVpg` where when specifying a single host as a recovery target, the host identifier was not properly assigned. - Thanks @jonsouzerto!
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/86) with `Invoke-ZertoMoveVpg` where parameters should have been mandatory in certain workflows. - Thanks @gdbarron!
|
||||
|
||||
## [1.5.0]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### New
|
||||
|
||||
* Added `Add-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md) for more information.
|
||||
* Added `Remove-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpgVm.md) for more information.
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/103) with `Add-ZertoPeerSite` where there was an incorrect settings validator on the `-targetHost` parameter where it would not accept a hostname.
|
||||
|
||||
## [1.4.3]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Updated
|
||||
|
||||
* Updated `Connect-ZertoServer` with a `-AutoReconnect` switch to allow the auto reconnection of a session that has timed-out.
|
||||
* Updated `New-ZertoVpg` to have a Default Parameter Set of `recoveryHostDatastore` should no parameters be passed when calling the function.
|
||||
* Updated `New-ZertoVpg -recoverySite` parameter to be case-insensitive
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/96) with `Set-ZertoLicense` so that ShouldProcess functions properly.
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/95) when attempting to connect to an unlicensed site.
|
||||
|
||||
## [1.4.2]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Updated `Get-ZertoEvent` to translate a vpg name parameter to a vpgIdentifier per the API documentation
|
||||
* Updated `Invoke-ZertoMoveCommit` to ensure that when one of the parameter switches is defined, all required parameters are sent to avoid conflicts with parameters passed with the `Invoke-ZertoMove` command.
|
||||
* Updated `Start-ZertoCloneVpg` to fix an issue where an error would be thrown if an operation specified a subset of VMs to be cloned.
|
||||
|
||||
## [1.4.1]
|
||||
|
||||
### General
|
||||
|
||||
* Removed RELEASENOTES and converted to a CHANGELOG format.
|
||||
* Updated the build process to follow Semantic Versioning.
|
||||
* Updated the build process to use the latest Pester Version (4.10.1)
|
||||
* Updated the build process to use the latest PS Script Analyzer Version (1.19.0)
|
||||
* Updated the Tests Files to use a more modern method of grabbing the PSScriptPath
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
* Refactored `Copy-ZertoVpg` functionality to leverage identifier and name maps and eliminate `where-object` searches.
|
||||
* Updated `Get-ZertoEvent` parameter to fall in line with the filter parameter name in the API documentation. Moved the old parameter name to an alias to ensure that existing functionality continues to work.
|
||||
|
||||
## [1.4.0.20200410]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/60) in the `Get-ZertoRecoveryReport` function where the `-VpgIdentifier` parameter was not working. This parameter is not accepted by the API as a valid filter and is ignored. This parameter has been removed from the function.
|
||||
* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/61) where the `Export-ZertoVpgNicSetting` function would not properly execute when run against a VM with no NICs attached.
|
||||
* In reviewing the `Export-ZertoVpgNicSetting`, a review of the `Import-ZertoVpgNicSetting` was completed and it was determined to update the import logic based on various test cases. Along with this, it is now possible to reset the NIC settings to the default state with the `Import-ZertoVpgNicSetting` command. Please review the [Import-ZertoVpgNicSetting help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md) to review the updated options and import logic.
|
||||
* Refactored the `Checkpoint-ZertoVpg` command to allow pipeline input (ByValue and ByProperty) for the VpgName parameter.
|
||||
* Corrected a parameter typo in the `Get-ZertoVpgSetting` function. The misspelt parameter was added as an alias to ensure any existing scripts using the parameter continue to function.
|
||||
* Refactored the `Get-ZertoVpg` command to remove repetitive commands and variables that are no longer required.
|
||||
* Moved `Invoke-ZertoRestRequest` and `Invoke-ZARestRequest` to be public functions. As there become more and more scenarios where there are not prebuilt functions to accomplish complex specialized tasks, it became apparent that these functions could be leveraged to make the experience and workflow easier.
|
||||
* Updated the `Install-ZertoVra` logic to ensure that the target datastore is available on the target host. There isn't currently any method to validate the target network, but if that becomes available in a later version of the API, the function will be updated.
|
||||
* Updated the `Install-ZertoVra` function to allow for installation of the VRA using the host password method. Please review the [Install-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) documentation for syntax and examples.
|
||||
* Updated the `Edit-ZertoVra` function to allow for modification of the associated ESX host password if the need arises. Please review the [Edit-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md) documentation for syntax and examples.
|
||||
* Added a new function, `Set-ZertoUserCredential`, to allow the updating of the username and password used to connect the Zerto Virtual Manager to the paired hypervisor. Please see the [Set-ZertoUserCredential](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md) help for additional information.
|
||||
* With the release of [Zerto 8.0](https://www.zerto.com/zerto-8-0-general-availability/) some additional API endpoints have become available.
|
||||
* Updated `Get-ZertoVirtualizationSite` to add the `-repository` parameter to enable returning information for LTR repositories.
|
||||
* Updated `Get-ZertoVpgSetting` to add the `-ltr` parameter to enable returning information for current LTR settings for the selected VPG.
|
||||
|
||||
### Zerto Analytics
|
||||
|
||||
* Added several functions for the newly added [Zerto Analytics](https://analytics.zerto.com) Planner.
|
||||
* `Get-ZAPlannerSite` Help can be found here: [Get-ZAPlannerSite](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md)
|
||||
* `Get-ZAPlannerStatsReport` Help can be found here: [Get-ZAPlannerStatsReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md)
|
||||
* `Get-ZAPlannerJournalSizeReport` Help can be found here: [Get-ZAPlannerJournalSizeReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md)
|
||||
* `Get-ZAPlannerNetworkPerformanceReport` Help can be found here: [Get-ZAPlannerNetworkPerformanceReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md)
|
||||
* `Get-ZAPlannerWanReport` Help can be found here: [Get-ZAPlannerWanReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md)
|
||||
* `Get-ZAPlannerZcasReport` Help can be found here: [Get-ZAPlannerZcasReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md)
|
||||
* Created `Get-ZAProtectedVm` and `Get-ZAProtectedVmReport` functions to leverage the newly released Zerto Analytics APIs for this data. Help files can be found here: [Get-ZAProtectedVm](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md) and [Get-ZAProtectedVmReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md)
|
||||
|
||||
## [1.3.0.20191201]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
* [Zerto version 7.5 has been released.](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Release%20Notes.pdf) As part of this release Zerto has added API functionality that requires the following updates.
|
||||
* A token is now required to pair two sites together. The need is discussed in [Issue 46](https://github.com/ZertoPublic/ZertoApiWrapper/issues/46). To implement this change a `-token` parameter has been added to the `Add-ZertoPeerSite` function.
|
||||
* A new function has been added; `New-ZertoPairingToken`. This function will allow users to generate a pairing authentication token from the target ZVM to be used in the pairing process. [Issue 47](https://github.com/ZertoPublic/ZertoApiWrapper/issues/47) covers additional details.
|
||||
* A new function has been added; `Invoke-ZertoEvacuateVra`. This function will allow users to evacuate a target VRA by specifying a Host Name, VRA Name, or VRA Identifier. All VMs currently replicating to the specified location will be migrated to different targets. [Issue 51](https://github.com/ZertoPublic/ZertoApiWrapper/issues/51)
|
||||
* A function has been added; `Copy-ZertoVpg`. This function will allow users to copy the settings of a single VPG and add new VMs to it. There is currently no customization beyond specifying the VMs to be placed in the newly created VPG. Should additional edits \ updates be required, they should be done post creation. [Issue 54](https://github.com/ZertoPublic/ZertoApiWrapper/issues/54)
|
||||
* Fixed [issue 57](https://github.com/ZertoPublic/ZertoApiWrapper/issues/57) where a `Start-ZertoFailoverTest` would throw an error complaining about validating the body parameter. This has been fixed and tested against Zerto Virtual Manager 7.5 Update 1 with Windows PowerShell 5.1 and PowerShell Core 6.2.
|
||||
|
||||
## [1.2.0.20190801]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
* Added two functions to aid in bulk updating of NIC information for protected VMs. ([Issue 38](https://github.com/ZertoPublic/ZertoApiWrapper/issues/38))
|
||||
* [Export-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md)
|
||||
* [Import-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVmNicSettings.md)
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/43) where a VPG being created with a single VM member would not be parsed by the API correctly using PowerShell 5.1
|
||||
|
||||
### Zerto Analytics
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/36) where the Zerto Analytics Rest Request function was not checking for the token before attempting a connection.
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/40) where the `Get-ZAVpg` method would return a 404 error when a `-vpgIdentifier` parameter was specified.
|
||||
|
||||
### General Updates
|
||||
|
||||
* Updated the way that tests are invoked and parsed to ensure that both source and built module files are tested. This will ensure that what is being shipped passes all tests along with testing of the source files.
|
||||
* Added additional parameter validation tests to several of the functions. On-going effort to complete stand alone unit testing of each function.
|
||||
|
||||
## [Initial Release]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
* Updated `Invoke-ZertoRestRequest` to work in Powershell 5.1 as well as Powershell core
|
||||
|
||||
### Zerto Analytics
|
||||
|
||||
* Implemented Zerto Analytics Functionality. Please see [Getting Started with Zerto Analytics](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
|
||||
@@ -0,0 +1,76 @@
|
||||
# Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at technicalmarketing@zerto.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
@@ -1,11 +1,11 @@
|
||||
# ZertoApiWrapper
|
||||
|
||||
PowerShell Core wrapper for Zerto Virtual Manager API
|
||||
PowerShell wrapper for Zerto Virtual Manager API
|
||||
|
||||
## Current Build Status
|
||||
|
||||
[](https://app.codacy.com/app/wcarroll/ZertoApiWrapper?utm_source=github.com&utm_medium=referral&utm_content=wcarroll/ZertoApiWrapper&utm_campaign=Badge_Grade_Settings)
|
||||
[](https://dev.azure.com/wescarroll/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master)
|
||||
[](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master)
|
||||
[](https://www.powershellgallery.com/packages/ZertoApiWrapper)
|
||||
|
||||
## Legal Disclaimer
|
||||
|
||||
@@ -15,54 +15,30 @@ In no event shall Zerto, its authors or anyone else involved in the creation, pr
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This code is still under development!! USE AT YOUR OWN RISK AND ONLY IF YOU KNOW WHAT YOU ARE DOING!!
|
||||
This code is still under development! Please use carefully and if you encounter any issues or have an idea, please submit an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues). Along the same lines, should you be proficient in PowerShell, please feel free to submit any [Pull Requests](https://github.com/ZertoPublic/ZertoApiWrapper/pulls) with enhancements and bug fixes.
|
||||
|
||||
## Installing the Module
|
||||
|
||||
This module can be installed directly from the [PowerShell Gallery](https://www.powershellgallery.com/packages/ZertoApiWrapper) with the following command.
|
||||
|
||||
```PowerShell
|
||||
PS> Install-Module -name ZertoApiWrapper
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
Place the folder and contents on your hard drive in a location known to you. From there run the following command to import the module into your session:
|
||||
|
||||
```PowerShell
|
||||
PS C:\>Import-Module <path>\ZertoApiWrapper\ZertoApiWrapper\ZertoApiWrapper.psm1 -force
|
||||
```
|
||||
|
||||
This will import the module into your current session and make the function available to you use and test.
|
||||
|
||||
### Connecting to a ZVM
|
||||
|
||||
Before any of the functions will work, you will need to connect to a Zerto Virtual Manager server. To do this you will use the `Connect-ZertoServer` function passing in a Server Name or IP address of the Zerto Virtual Manager. If you are using a non-standard port, you will need to provide that as well with the `-zertoPort` parameter. You will also need to supply credentials to authenticate against the Zerto Virtual Manager. If credentials are not provided, the user will be prompted for a username and password.
|
||||
|
||||
```PowerShell
|
||||
PS C:\>$credential = Get-Credential
|
||||
PS C:\>Connect-ZertoServer -zertoServer "192.168.222.20" -credential $credential
|
||||
```
|
||||
|
||||
After successful execution, a few Module level variables are set that are not currently exposed. These variables keep track of the Zerto Server connection information such as Server Name and Port information along with the authentication headers. A "Last Action" variable is also set to keep track of when the last call was made to the API to determine if the authentication information has expired or not. Should this command be run again with a different server, the old information will be overwritten and all commands from that point will be executed against the new server information.
|
||||
|
||||
### Using the Module
|
||||
|
||||
A help system is currently under development. While each command has a help page, it may not be fully fleshed out yet. To see all possible functions you can use the following command after the module has been imported:
|
||||
|
||||
```PowerShell
|
||||
PS C:\>Get-Command -module ZertoApiWrapper
|
||||
```
|
||||
|
||||
Once you have found the command that you want to know about you can call `Get-Help <Command>` to take a look at the help page, or if you want to see syntax, `Get-Command <Command> -syntax`.
|
||||
|
||||
### Ending the Session
|
||||
|
||||
If you are using this as part of a larger script, I highly suggest explicitly ending your session with the `Disconnect-ZertoSession` command. This will delete the token authorization from the Zerto Virtual Manager as well as clear all Module scoped variables.
|
||||
* [Getting Started with Zerto Virtual Manager and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Virtual-Manager)
|
||||
* [Getting Started with Zerto Analytics and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
|
||||
|
||||
## Recent Updates
|
||||
|
||||
- March 15th, 2019: Implement Export and Import Functionality. Please See [Export-ZertoVpg Help](https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Export-ZertoVpg.md) and [Import-ZertoVpg Help](https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Import-ZertoVpg.md) for assistance. No current pre-seed support.
|
||||
- March 11th, 2019: Create basic VPG completed. Please see [New-ZertoVpg Help](https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md)
|
||||
All recent updates can now be tracked via the [Change Log](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/CHANGELOG.md).
|
||||
|
||||
## TODO
|
||||
|
||||
- Complete Help Markdown Files
|
||||
- JFLR Functionality
|
||||
- Create VPG (Per-VM modification and Backup Settings)
|
||||
- Edit VPG
|
||||
- Delete Zerto License
|
||||
- Flesh out Pester Tests
|
||||
- Complete Automated Build Process
|
||||
* JFLR Functionality
|
||||
* Create VPG (Per-VM modification and Backup Settings)
|
||||
* Edit VPG
|
||||
* Delete Zerto License
|
||||
* Flesh out Pester Tests
|
||||
* Complete Automated Build Process
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
|
||||
* New Feature 1
|
||||
* New Feature 2
|
||||
* New SubFeature 1
|
||||
* What is happening???
|
||||
@@ -0,0 +1,70 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "have a mandatory parameter for the Input Object" {
|
||||
Get-Command $global:function | Should -HaveParameter InputObject -Mandatory -Type PSCustomObject
|
||||
}
|
||||
|
||||
It "Input Object should not accecpt a Null or Empty value" {
|
||||
$myObj = [PSCustomObject]@{ }
|
||||
{ Get-Map -InputObject $myObj -Key "Key" -Value "Value" } | Should Throw
|
||||
{ Get-Map -InputObject $null -Key "Key" -Value "Value" } | Should Throw
|
||||
{ Get-Map -InputObject "" -Key "Key" -Value "Value" } | Should Throw
|
||||
}
|
||||
|
||||
It "have a mandatory string parameter for the Map Key" {
|
||||
Get-Command $global:function | Should -HaveParameter Key -Mandatory -Type String
|
||||
}
|
||||
|
||||
It "The Map variable should not accecpt a Null or Empty value" {
|
||||
$myObj = [PSCustomObject]@{one = 1; two = 2 }
|
||||
{ Get-Map -InputObject $myObj -Key "" -Value "Value" } | Should Throw
|
||||
{ Get-Map -InputObject $null -Key $null -Value "Value" } | Should Throw
|
||||
{ Get-Map -InputObject $myObj -Key 1 -Value "Value" } | Should Throw
|
||||
}
|
||||
|
||||
It "The Value variable should not accecpt a Null or Empty value" {
|
||||
$myObj = [PSCustomObject]@{one = 1; two = 2 }
|
||||
{ Get-Map -InputObject $myObj -Key "Key" -Value "" } | Should Throw
|
||||
{ Get-Map -InputObject $myObj -Key "Key" -Value $null } | Should Throw
|
||||
{ Get-Map -InputObject $myObj -Key "Key" -Value 1 } | Should Throw
|
||||
}
|
||||
|
||||
It "have a mandatory string parameter for the Map Value" {
|
||||
Get-Command $global:function | Should -HaveParameter Value -Mandatory -Type String
|
||||
}
|
||||
|
||||
It "should have an Output type of Hashtable" {
|
||||
(Get-Command $global:function).OutputType.Name | Should -Match "Hashtable"
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Function Tests" {
|
||||
$myObj = Get-Content "$global:here/Mocks/ProtectedVMs.json" | ConvertFrom-Json
|
||||
BeforeEach {
|
||||
$MyMap = Get-Map -InputObject $MyObj -Key "vmIdentifier" -Value "vmName"
|
||||
}
|
||||
It "Returned object should be a hashtable" {
|
||||
$myMap | Should -BeOfType Hashtable
|
||||
}
|
||||
|
||||
It "should return a hashtable with 3 entries" {
|
||||
$myMap.count | Should -Be 3
|
||||
}
|
||||
|
||||
It "should be properly mapped" {
|
||||
$myMap["vmid.12"] | Should -Be "ExchangeMailbox"
|
||||
$myMap["vmid.13"] | Should -Be "ExchangeApplication"
|
||||
$myMap["vmid.14"] | Should -Be "ExchangeWeb"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
@@ -1,30 +1,74 @@
|
||||
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||
$file = Get-ChildItem "$filePath\$fileName"
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
. $file.FullName
|
||||
$singleBoolItemTest = @{"BoolItem" = $True}
|
||||
$oneItemTest = @{"OneItem" = "Test"}
|
||||
$twoItemTest = @{"OneItem" = "Test"; "SecondItem" = "Yours"}
|
||||
$boolItemTest = @{"OneItem" = "Test"; "BoolItem" = $true}
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Describe $file.BaseName -Tag Unit {
|
||||
it "file should exist" {
|
||||
$file.Fullname | should exist
|
||||
}
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "has a mandatory hashtable parameter for the filterTable" {
|
||||
Get-Command $global:function | Should -HaveParameter filterTable -Mandatory -Type Hashtable
|
||||
}
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file.Fullname -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
It "FilterTable should not accecpt a Null or Empty parameter" {
|
||||
{ Get-ZertoApiFilter -filtertable (@{ }) } | Should Throw
|
||||
{ Get-ZertoApiFilter -filtertable "" } | Should Throw
|
||||
{ Get-ZertoApiFilter -filtertable $null } | Should Throw
|
||||
}
|
||||
|
||||
it "converts bool to text" {
|
||||
Get-ZertoApiFilter -filtertable $singleBoolItemTest | should -Be "?BoolItem=True"
|
||||
It "should have an Output type of String" {
|
||||
(Get-Command $global:function).OutputType.Name | Should -Match "String"
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Function Unit Tests" {
|
||||
BeforeAll {
|
||||
$singleBoolItemTest = @{"BoolItem" = $True }
|
||||
$oneItemTest = @{ OneItem = "Test" }
|
||||
$twoItemTest = @{
|
||||
OneItem = "Test"
|
||||
SecondItem = "Yours"
|
||||
}
|
||||
$commonParamTest = @{
|
||||
Debug = $True
|
||||
ErrorAction = "Stop"
|
||||
ErrorVariable = "ErrVar"
|
||||
InformationAction = "Continue"
|
||||
InformationVariable = "InfoVar"
|
||||
OutVariable = "OutVar"
|
||||
OutBuffer = "OutBuff"
|
||||
PipelineVariable = "PipeVar"
|
||||
Verbose = $false
|
||||
WarningAction = "SilentlyContinue"
|
||||
WarningVariable = "WarnVar"
|
||||
WhatIf = $True
|
||||
Confirm = $false
|
||||
OneItem = "Test"
|
||||
}
|
||||
}
|
||||
|
||||
It "converts bool to text" {
|
||||
Get-ZertoApiFilter -filtertable $singleBoolItemTest | Should -Be "?BoolItem=True"
|
||||
}
|
||||
|
||||
It "one item test" {
|
||||
Get-ZertoApiFilter -filtertable $oneItemTest | Should -Be "?OneItem=Test"
|
||||
}
|
||||
|
||||
It "should ignore CommonParameters" {
|
||||
Get-ZertoApiFilter -filtertable $commonParamTest | Should -Be "?OneItem=Test"
|
||||
}
|
||||
|
||||
It "should process a filter table with more than one item" {
|
||||
$returnString = Get-ZertoApiFilter -filtertable $twoItemTest
|
||||
$returnString | Should -match "^\?"
|
||||
$returnString | Should -match "&"
|
||||
$returnString | Should -match "OneItem=Test"
|
||||
$returnString | Should -match "SecondItem=Yours"
|
||||
}
|
||||
}
|
||||
}
|
||||
it "one item test" {
|
||||
Get-ZertoApiFilter -filtertable $oneItemTest | should be "?OneItem=Test"
|
||||
}
|
||||
#TODO:: Figure out multi-item tests
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||
$file = Get-ChildItem "$filePath\$fileName"
|
||||
. $file.FullName
|
||||
|
||||
Describe $file.BaseName -Tag Unit {
|
||||
it "file should exist" {
|
||||
$file.FullName | should exist
|
||||
}
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file.FullName -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"VMname": "ExchangeMailbox",
|
||||
"VMIdentifier": "vmid.12"
|
||||
},
|
||||
{
|
||||
"VMName": "ExchangeApplication",
|
||||
"VmIdentifier": "vmid.13"
|
||||
},
|
||||
{
|
||||
"VMName": "ExchangeWeb",
|
||||
"VmIdentifier": "vmid.14"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,76 +1,94 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
|
||||
It "Is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
it "Has a mandatory string parameter for the target host" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter TargetHost -Mandatory -Type String
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
it "Will not take a non-ip address as a 'TargetHost'" {
|
||||
{Add-ZertoPeerSite -targetHost 'MyZVMHost' -targetPort '9081'} | should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.266' -targetPort '9081'} | should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1' -targetPort '9081'} | should -Throw
|
||||
{Add-ZertoPeerSite -targetHost $null -targetPort '9081'} | should -Throw
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'targetHost'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'targetPort'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'token'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
it "Has a non-mandatory string parameter for the target port with default value of 9081" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter TargetPort -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter TargetPort -Type Int32
|
||||
Get-Command $file.BaseName | Should -HaveParameter TargetPort -DefaultValue 9081
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it "Will not take a non-int as a port" {
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 'string'} | should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $true} | should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $null} | should -Throw
|
||||
It "targetPort Parameter should have a default value of 9081" {
|
||||
Get-Command $global:function | Should -HaveParameter targetPort -DefaultValue 9081
|
||||
}
|
||||
|
||||
It "Will fail if the specified port is outside of the range 1024 - 65535" {
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 1023} | Should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 65536} | Should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 0} | Should -Throw
|
||||
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort -1} | Should -Throw
|
||||
It "targetPort Parameter should have a Min value of 1024" {
|
||||
(Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1024
|
||||
}
|
||||
|
||||
it "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter WhatIf
|
||||
Get-Command $file.BaseName | Should -HaveParameter Confirm
|
||||
$file | Should -FileContentMatch 'SupportsShouldProcess'
|
||||
$file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
It "targetPort Parameter should have a Max value of 65535" {
|
||||
(Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 65535
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper Invoke-ZertoRestRequest {
|
||||
return "9a49f42e-2bbd-4bf8-b571-77908a2e5e98.928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
Context "Add-ZertoPeerSite::Functional Unit Tests" {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
|
||||
return (Get-Content "$global:here\Mocks\TaskId.txt")
|
||||
}
|
||||
|
||||
it "Returns a string value" {
|
||||
It "Returns a string value when no Token Passed" {
|
||||
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081'
|
||||
$results | should -Not -BeNullOrEmpty
|
||||
$results | should -BeOfType "String"
|
||||
$results | Should -BeExactly "9a49f42e-2bbd-4bf8-b571-77908a2e5e98.928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
$results | Should -Not -BeNullOrEmpty
|
||||
$results | Should -BeOfType "String"
|
||||
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest
|
||||
It "Returns a string value when a Token is passed" {
|
||||
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -token "NotARealTokenString"
|
||||
$results | Should -Not -BeNullOrEmpty
|
||||
$results | Should -BeOfType "String"
|
||||
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
|
||||
It "Does not return a taskId if '-whatif' is used" {
|
||||
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -WhatIf
|
||||
$results | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgSettingsIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add-ZertoPeerSite::Functional Unit Tests" {
|
||||
}
|
||||
}
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -1,66 +1,63 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
|
||||
return "3b687246-ac63-40da-9a59-b99863769eb0.928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
return (Get-Content "$global:here\Mocks\TaskId.txt")
|
||||
}
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName get-zertovpg {
|
||||
return @{vpgIdentifier = "dddf2fa8-79e2-4e4f-a83b-f66676afea64"}
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName get-zertovpg -ParameterFilter { $VpgName -eq "MyVpg" } {
|
||||
return (Get-Content "$global:here\Mocks\VPGInfo.json" -Raw | ConvertFrom-Json)
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
it "Has a parameter for the VpgName that is Mandatory" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory -Type String
|
||||
Context "$($global:function)::Parameter Unit Tests" {
|
||||
It "Has a parameter for the VpgName that is Mandatory" {
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory -Type 'String[]'
|
||||
}
|
||||
|
||||
it "Has a parameter for the CheckpointName that is Mandatory" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter CheckpointName -Mandatory -Type String
|
||||
It "Has a parameter for the CheckpointName that is Mandatory" {
|
||||
Get-Command $global:function | Should -HaveParameter CheckpointName -Mandatory -Type String
|
||||
}
|
||||
|
||||
it "Throws and error when an empty or null checkpointName is specified" {
|
||||
{Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName ""} | Should -Throw
|
||||
{Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName $null} | Should -Throw
|
||||
It "Throws and error when an empty or null checkpointName is specified" {
|
||||
{ Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName "" } | Should -Throw
|
||||
{ Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName $null } | Should -Throw
|
||||
}
|
||||
|
||||
it "Throws an error when an empty or null vpgName is specified" {
|
||||
{Checkpoint-ZertoVpg -vpgName "" -checkpointName "MyCheckPoint"} | Should -Throw
|
||||
{Checkpoint-ZertoVpg -vpgName $null -checkpointName "MyCheckPoint"} | Should -Throw
|
||||
It "Throws an error when an empty or null vpgName is specified" {
|
||||
{ Checkpoint-ZertoVpg -vpgName "" -checkpointName "MyCheckPoint" } | Should -Throw
|
||||
{ Checkpoint-ZertoVpg -vpgName $null -checkpointName "MyCheckPoint" } | Should -Throw
|
||||
}
|
||||
|
||||
it "Does not support 'SupportsShouldProcess'" {
|
||||
Get-Command $file.BaseName | Should -Not -HaveParameter WhatIf
|
||||
Get-Command $file.BaseName | Should -Not -HaveParameter Confirm
|
||||
$file | Should -Not -FileContentMatch 'SupportsShouldProcess'
|
||||
$file | Should -Not -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
It "Does not support 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -Not -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -Not -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -not -match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -not -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
Context "$($global:function)::Function Unit Tests" {
|
||||
|
||||
it "should return a not null or empty string" {
|
||||
It "should return a not null or empty string" {
|
||||
$results = Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName "My Checkpoint Name"
|
||||
$results | should -not -BeNullOrEmpty
|
||||
$results | should -BeOfType "String"
|
||||
$results | should -BeExactly "3b687246-ac63-40da-9a59-b99863769eb0.928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
$results | Should -not -BeNullOrEmpty
|
||||
$results | Should -BeOfType "String"
|
||||
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
It "does not return anything when a invalid VPG is defined" {
|
||||
$results = Checkpoint-ZertoVpg -vpgName "DoesNotExist" -checkpointName "My Checkpoint Name"
|
||||
$results | Should -Be "Cannot find VPG named DoesNotExist. Please check the name and try again."
|
||||
}
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -Exactly 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$($global:function)::Parameter Unit Tests" {
|
||||
It "Has a parameter for the Required Credentials that is Mandatory" {
|
||||
Get-Command $global:function | Should -HaveParameter credential -Mandatory -Type PSCredential
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($global:function)::Function Unit Tests" {
|
||||
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
Mock -CommandName Invoke-ZARestRequest {
|
||||
return (Get-Content "$global:here\Mocks\ZAToken.json"-Raw | ConvertFrom-Json)
|
||||
}
|
||||
|
||||
$password = 'NotARealPassword' | ConvertTo-SecureString -AsPlainText -Force
|
||||
$cred = New-Object pscredential('NotARealUser', $password)
|
||||
|
||||
$results = Connect-ZertoAnalytics -credential $cred
|
||||
|
||||
It "Creates a Script Level Hashtable Variable for the ZertoAnalytics Headers" {
|
||||
$script:zaHeaders | Should -BeOfType Hashtable
|
||||
}
|
||||
|
||||
It "the ZertoAnalytics Headers variable contains 2 items" {
|
||||
$script:zaHeaders.keys | Should -HaveCount 2
|
||||
}
|
||||
|
||||
It "the ZertoAnalytics Headers variable has an 'Accept' key" {
|
||||
$script:zaHeaders.keys | Should -Contain 'Accept'
|
||||
}
|
||||
|
||||
It "thh ZertoAnalytics headers variable 'Accept' key should be JSON" {
|
||||
$script:zaHeaders['Accept'] | Should -match 'application/json'
|
||||
}
|
||||
|
||||
It "the ZertoAnalytics Headers variable has an 'Authorization' key" {
|
||||
$script:zaHeaders.keys | Should -Contain 'Authorization'
|
||||
}
|
||||
|
||||
It "the ZertoAnalytics Headers variable 'Authorization' key should start with 'Bearer'" {
|
||||
$script:zaHeaders['Authorization'] | Should -Match '^Bearer '
|
||||
}
|
||||
|
||||
It "Creates a Script Level Variable for the LastActionTime" {
|
||||
$script:zaLastActionTime | Should -BeOfType Long
|
||||
}
|
||||
|
||||
It "LastActionTime Variable should be in the past" {
|
||||
$script:zaLastActionTime | Should -BeLessThan (Get-Date).Ticks
|
||||
}
|
||||
|
||||
It "Returns Header Information" {
|
||||
$results | Should -not -BeNullOrEmpty
|
||||
$results['Authorization'] | Should -MatchExactly 'Bearer N074r34l70k3n'
|
||||
$results['Accept'] | Should -Match 'application/json'
|
||||
}
|
||||
}
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZARestRequest -Exactly 1
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
@@ -1,203 +1,142 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$userName = "zerto\build"
|
||||
$password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force
|
||||
$credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password)
|
||||
$Server = "192.168.1.100"
|
||||
$zertoPort = "7669"
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag Unit {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
Context "$($global:function)::Parameter Unit Tests" {
|
||||
|
||||
it "server vairable has a mandatory String parameter" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter zertoserver -Mandatory -Type String
|
||||
It "server vairable has a mandatory String parameter" {
|
||||
Get-Command $global:function | Should -HaveParameter zertoserver -Mandatory -Type String
|
||||
}
|
||||
|
||||
it "server variable does not accecpt an empty or null input" {
|
||||
{Connect-ZertoServer -zertoServer $null -credential $credential} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer "" -credential $credential} | Should -Throw
|
||||
It "server variable does not accecpt an empty or null input" {
|
||||
{ Connect-ZertoServer -zertoServer $null -credential $credential } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer "" -credential $credential } | Should -Throw
|
||||
}
|
||||
|
||||
it "port variable has a non-mandatory String parameter" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter zertoPort -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter zertoPort -Type String
|
||||
Get-Command $file.BaseName | Should -HaveParameter zertoPort -DefaultValue "9669"
|
||||
It "port variable has a non-mandatory String parameter" {
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -Not -Mandatory
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -Type String
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -DefaultValue "9669"
|
||||
}
|
||||
|
||||
it "port variable does not accecpt an empty or null input" {
|
||||
{Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "" -credential $credential} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort $null -credential $credential} | Should -Throw
|
||||
It "port variable does not accecpt an empty or null input" {
|
||||
{ Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "" -credential $credential } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort $null -credential $credential } | Should -Throw
|
||||
}
|
||||
|
||||
it "port variable should fall between 1024 and 65535" {
|
||||
{Connect-ZertoServer -zertoServer $Server -zertoPort 1023 -credential $credential} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer $Server -zertoPort 65536 -credential $credential} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer $Server -zertoPort 0 -credential $credential} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer $Server -zertoPort -1 -credential $credential} | Should -Throw
|
||||
It "port variable should fall between 1024 and 65535" {
|
||||
{ Connect-ZertoServer -zertoServer $Server -zertoPort 1023 -credential $credential } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer $Server -zertoPort 65536 -credential $credential } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer $Server -zertoPort 0 -credential $credential } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer $Server -zertoPort -1 -credential $credential } | Should -Throw
|
||||
}
|
||||
|
||||
it "has a mandatory PSCredential parameter for the credential vairable" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter credential -Mandatory -Type PSCredential
|
||||
It "has a mandatory PSCredential parameter for the credential vairable" {
|
||||
Get-Command $global:function | Should -HaveParameter credential -Mandatory -Type PSCredential
|
||||
}
|
||||
|
||||
it "should require a PSCredentialObject for the credentials" {
|
||||
{Connect-ZertoServer -zertoServer -credential "MyUsername"} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer -credential 1234} | Should -Throw
|
||||
{Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString'})} | Should -Throw
|
||||
It "should require a PSCredentialObject for the credentials" {
|
||||
{ Connect-ZertoServer -zertoServer -credential "MyUsername" } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer -credential 1234 } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString' }) } | Should -Throw
|
||||
}
|
||||
|
||||
It "has a switch parameter to return the headers" {
|
||||
Get-Command $global:function | Should -HaveParameter returnHeaders
|
||||
Get-Command $global:function | Should -HaveParameter returnHeaders -Type Switch
|
||||
}
|
||||
|
||||
It "has a switch parameter to auto reauthorize the session" {
|
||||
Get-Command $global:function | Should -HaveParameter autoReconnect
|
||||
Get-Command $global:function | Should -HaveParameter autoReconnect -Type Switch
|
||||
}
|
||||
}
|
||||
|
||||
InModuleScope ZertoApiWrapper {
|
||||
Context "$($file.BaseName)::InModuleScope Function Unit Tests" {
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
|
||||
# Attempted to Mock this per the Mock Below and it blew up. Auth Headers Returns a Dictionary
|
||||
# and does not index the same way when imported from a JSON file. Need addtional investigation.
|
||||
$xZertoSession = @("e34da0b0-4bc2-4cda-b316-0384e35bdca5")
|
||||
$Headers = @{'x-zerto-session' = $xZertoSession }
|
||||
$results = @{'Headers' = $Headers }
|
||||
return $results
|
||||
}
|
||||
|
||||
$server = '192.168.1.100'
|
||||
$userName = "zerto\build"
|
||||
$password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force
|
||||
$credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password)
|
||||
Context "$($global:function)::InModuleScope Function Unit Tests" {
|
||||
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
|
||||
$xZertoSession = @("7ecf544d-e7ed-4108-86f3-fb355c51cdfa")
|
||||
$Headers = @{'x-zerto-session' = $xZertoSession}
|
||||
$results = @{'Headers' = $Headers}
|
||||
return $results
|
||||
BeforeAll {
|
||||
$server = '192.168.1.100'
|
||||
$password = ConvertTo-SecureString -String "NotARealPassword" -AsPlainText -Force
|
||||
$credential = New-Object pscredential('NotARealUser', $password)
|
||||
$now = $(Get-Date).ticks
|
||||
Connect-ZertoServer -zertoServer $server -credential $credential
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite {
|
||||
$results = @{
|
||||
BandwidthThrottlingInMBs = -1
|
||||
ContactEmail = "vSphere-Site01@zerto.com"
|
||||
ContactName = "vSphere-Site01@zerto.com"
|
||||
ContactPhone = "066-6666666"
|
||||
IpAddress = "192.168.200.1"
|
||||
IsReplicationToSelfEnabled = $True
|
||||
Link = @{
|
||||
href = "https://192.168.24.1:7669/v1/localsite"
|
||||
identifier = "928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
rel = $null
|
||||
type = "LocalSiteApi"
|
||||
}
|
||||
Location = "vSphere-Site01"
|
||||
SiteName = "vSphere-Site01 at Zerto"
|
||||
SiteType = "VCenter"
|
||||
UtcOffsetInMinutes = -240
|
||||
Version = "7.0.0"
|
||||
SiteIdentifier = "928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
}
|
||||
return $results
|
||||
}
|
||||
|
||||
$now = $(Get-Date).ticks
|
||||
Connect-ZertoServer -zertoServer $server -credential $credential
|
||||
|
||||
it "Module Scope zvmServer variable tests" {
|
||||
It "Module Scope zvmServer variable tests" {
|
||||
$script:zvmServer | Should -Not -BeNullOrEmpty
|
||||
$script:zvmServer | Should -Be $server
|
||||
}
|
||||
|
||||
it "Module Scope zvmPort variable tests" {
|
||||
It "Module Scope zvmPort variable tests" {
|
||||
$script:zvmPort | Should -Not -BeNullOrEmpty
|
||||
$script:zvmPort | Should -Be '9669'
|
||||
}
|
||||
|
||||
it "Module Scope zvmLastAction variable tests" {
|
||||
It "Module Scope zvmLastAction variable tests" {
|
||||
$script:zvmLastAction | Should -Not -BeNullOrEmpty
|
||||
$script:zvmLastAction | Should -BeGreaterOrEqual $now
|
||||
}
|
||||
|
||||
it "Module Scope zvmHeaders variable tests" {
|
||||
It "Module Scope zvmHeaders variable tests" {
|
||||
$script:zvmHeaders | Should -Not -BeNullOrEmpty
|
||||
$script:zvmHeaders | Should -BeOfType Hashtable
|
||||
$script:zvmHeaders.keys.count | Should -BeExactly 2
|
||||
$script:zvmHeaders | Should -BeOfType PSCustomObject
|
||||
$script:zvmHeaders.keys.count | Should -BeExactly 3
|
||||
$script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue
|
||||
$script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue
|
||||
$script:zvmHeaders['x-zerto-session'] | Should -BeOfType String
|
||||
$script:zvmHeaders['Accept'] | Should -BeOfType String
|
||||
}
|
||||
|
||||
it "Module Scope zvmLocalInfo variable tests" {
|
||||
$script:zvmLocalInfo | Should -Not -BeNullOrEmpty
|
||||
$script:zvmLocalInfo | Should -BeOfType Hashtable
|
||||
$script:zvmLocalInfo['SiteIdentifier'] | Should -BeOfType String
|
||||
$script:zvmLocalInfo.ContainsKey('SiteIdentifier') | Should -BeTrue
|
||||
$script:zvmLocalInfo['SiteIdentifier'] | Should -BeOfType String
|
||||
}
|
||||
|
||||
$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
|
||||
it "returns a Hashtable with 2 keys" {
|
||||
It "returns a Hashtable with 2 keys" {
|
||||
$headers | Should -BeOfType Hashtable
|
||||
$headers.keys.count | should be 2
|
||||
$headers.keys.count | Should -Be 3
|
||||
}
|
||||
|
||||
it "return value has a key called 'x-zerto-session'" {
|
||||
$headers.ContainsKey('x-zerto-session') | should be $true
|
||||
It "return value has a key called 'x-zerto-session'" {
|
||||
$headers.ContainsKey('x-zerto-session') | Should -Be $true
|
||||
}
|
||||
|
||||
it "return key 'x-zerto-session' value should be a string" {
|
||||
$headers['x-zerto-session'] | should -BeOfType "String"
|
||||
$headers['x-zerto-session'] | Should -BeExactly "7ecf544d-e7ed-4108-86f3-fb355c51cdfa"
|
||||
It "return key 'x-zerto-session' value should be a string" {
|
||||
$headers['x-zerto-session'] | Should -BeOfType "String"
|
||||
$headers['x-zerto-session'] | Should -BeExactly "e34da0b0-4bc2-4cda-b316-0384e35bdca5"
|
||||
}
|
||||
|
||||
it "return value has a key called 'accept'" {
|
||||
$headers.ContainsKey('accept') | should be $true
|
||||
It "return value has a key called 'accept'" {
|
||||
$headers.ContainsKey('accept') | Should -Be $true
|
||||
}
|
||||
|
||||
it "return key 'accept' value should be 'application/json'" {
|
||||
$headers['accept'] | should be 'application/json'
|
||||
It "return key 'accept' value should be 'application/json'" {
|
||||
$headers['accept'] | Should -Be 'application/json'
|
||||
}
|
||||
|
||||
it "should not require a port to be specified" {
|
||||
It "should not require a port to be specified" {
|
||||
Connect-ZertoServer -zertoServer $Server -credential $credential
|
||||
}
|
||||
|
||||
it "returns null when -ReturnHeaders is not used" {
|
||||
It "returns null when -ReturnHeaders is not used" {
|
||||
Connect-ZertoServer -zertoServer $Server -credential $credential | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4
|
||||
}
|
||||
}
|
||||
}
|
||||
<#
|
||||
Describe "Connect-ZertoServer" -Tag Integration {
|
||||
it "file should exist" {
|
||||
"$filePath\$fileName" | should exist
|
||||
}
|
||||
it "has a function called Connect-ZertoServer" {
|
||||
get-command Connect-ZertoServer | should be $true
|
||||
}
|
||||
$headers = Connect-ZertoServer -zertoServer $Server -zertoPort $zertoPort -credential $credential -returnHeaders
|
||||
it "returns a Hashtable with 2 keys" {
|
||||
$headers.keys.count | should be 2
|
||||
}
|
||||
it "return value has a key called 'x-zerto-session'" {
|
||||
$headers.ContainsKey('x-zerto-session') | should be $true
|
||||
}
|
||||
it "return key 'x-zerto-session' value should be a string" {
|
||||
$headers['x-zerto-session'].gettype().name | should be "String"
|
||||
}
|
||||
it "return value has a key called 'accept'" {
|
||||
$headers.ContainsKey('accept') | should be $true
|
||||
}
|
||||
it "return key 'accept' value should be 'application/json'" {
|
||||
$headers['accept'] | should be 'application/json'
|
||||
}
|
||||
Disconnect-ZertoServer
|
||||
}
|
||||
#>
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$($global:function)::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'SourceVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'NewVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'VMs'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($global:function)::Function Unit Tests" {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -ParameterFilter {
|
||||
$vpgName -eq "MyVpg"
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\GetVpg.json" -Raw | ConvertFrom-Json)
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -ParameterFilter {
|
||||
$vpgName -eq "NotAVpg"
|
||||
} {
|
||||
return $null
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoUnprotectedVm {
|
||||
return (Get-Content "$global:here\Mocks\UnprotectedVms.json" -Raw | ConvertFrom-Json)
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoProtectedVm {
|
||||
return (Get-Content "$global:here\Mocks\ProtectedVms.json" -Raw | ConvertFrom-Json)
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq "vpgSettings/copyVpgSettings"
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VpgId.txt")
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq "vpgSettings/9607f923-00a7-477b-8b04-26a386214455/vms"
|
||||
} {
|
||||
return $null
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq "vpgSettings/9607f923-00a7-477b-8b04-26a386214455"
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\CopyVpgSettings.json" -Raw | ConvertFrom-Json)
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Save-ZertoVpgSetting {
|
||||
return (Get-Content "$global:here\Mocks\TaskId.txt")
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-Map -ParameterFilter {
|
||||
$null -ne $InputObject[0].VpgName
|
||||
} {
|
||||
@{
|
||||
"WindowsBox" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-90"
|
||||
"CentOS-Test" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-88"
|
||||
"Application01" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-35"
|
||||
"sql01-test" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-73"
|
||||
"jenkins" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-75"
|
||||
}
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-Map -ParameterFilter {
|
||||
$null -eq $InputObject[0].VpgName
|
||||
} {
|
||||
@{
|
||||
"Win2019Template" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-79"
|
||||
"Ubuntu01" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-34"
|
||||
"WinTemplate" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-25"
|
||||
"sql01-prod" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87"
|
||||
"nczvm.nc.lab" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-30"
|
||||
}
|
||||
} -Verifiable
|
||||
|
||||
It "Should throw an error when no VPG is found" {
|
||||
{ Copy-ZertoVpg -SourceVpgName "NotAVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01' } | Should Throw "Unable to find a VPG with the name:"
|
||||
}
|
||||
|
||||
It "Returns a TaskIdentifier when called correctly" {
|
||||
Copy-ZertoVpg -SourceVpgName "MyVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01' | Should -Be "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
|
||||
It "Should warn when VM is not found" {
|
||||
$results = Copy-ZertoVpg -SourceVpgName "MyVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01', 'DoesNotExist' 3>&1
|
||||
$results[0].ToString() | Should -Match 'Unable to find VM with Name DoesNotExist. Skipping.'
|
||||
|
||||
}
|
||||
|
||||
Assert-VerifiableMock
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
@@ -1,37 +1,40 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
|
||||
$null
|
||||
}
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Remove-Variable {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
}
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
it "Does not take any parameters" {
|
||||
(get-command disconnect-zertoserver).parameters.count | Should -BeExactly 11
|
||||
Context "$($global:function)::Parameter Unit Tests" {
|
||||
It "Does not take any parameters" {
|
||||
(Get-Command disconnect-zertoserver).parameters.count | Should -BeExactly 11
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
it "Does not return anything" {
|
||||
Disconnect-ZertoServer | Should -BeNullOrEmpty
|
||||
Context "$($global:function)::Function Unit Tests" {
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
|
||||
# Attempted to Mock this per the Mock Below and it blew up. Auth Headers Returns a Dictionary
|
||||
# and does not index the same way when imported from a JSON file. Need addtional investigation.
|
||||
$xZertoSession = @("e34da0b0-4bc2-4cda-b316-0384e35bdca5")
|
||||
$Headers = @{'x-zerto-session' = $xZertoSession }
|
||||
$results = @{'Headers' = $Headers }
|
||||
return $results
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite {
|
||||
return (Get-Content -Path "$global:here\Mocks\LocalSiteInfo.json" -Raw | ConvertFrom-Json)
|
||||
}
|
||||
|
||||
BeforeAll {
|
||||
Connect-ZertoServer
|
||||
}
|
||||
|
||||
It "Does not return anything" {
|
||||
Disconnect-ZertoServer | Should -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
|
||||
@@ -1,187 +1,103 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path) -Replace "Tests", "ZertoApiWrapper"
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper Invoke-ZertoRestRequest {
|
||||
return "8dcfdc8e-e5d2-4ba4-9885-f9eb57d92b14.928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
Get-Content $global:here\Mocks\TaskId.txt
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper Get-ZertoVra {
|
||||
$vraInformation = @{
|
||||
DatastoreClusterIdentifier = $null
|
||||
DatastoreClusterName = $null
|
||||
DatastoreIdentifier = "840f99fb-4689-2f8b-ea10-2a47a5bb00cc.Prod_Datastore"
|
||||
DatastoreName = "Prod_Datastore"
|
||||
HostIdentifier = "840f99fb-4689-2f8b-ea10-2a47a5bb00cc.znest82esxus-1"
|
||||
HostVersion = 6.5
|
||||
IpAddress = 192.168.1.100
|
||||
Link = @{
|
||||
href = "https://192.168.1.200:7669/v1/vras/2609816293328110468"
|
||||
identifier = "269816293328110468"
|
||||
rel = $null
|
||||
type = "VraApi"
|
||||
}
|
||||
MemoryInGB = 3
|
||||
NetworkIdentifier = "840f99fb-4689-2f8b-ea10-2a47a5bb00cc.network-1"
|
||||
NetworkName = "Test Network"
|
||||
Progress = 0
|
||||
ProtectedCounters = @{
|
||||
Vms = 0
|
||||
Volumes = 0
|
||||
Vpgs = 0
|
||||
}
|
||||
RecoveryCounters = @{
|
||||
Vms = 0
|
||||
Volumes = 0
|
||||
Vpgs = 0
|
||||
}
|
||||
SelfProtectedVpgs = 0
|
||||
Status = 0
|
||||
VraAlerts = @{
|
||||
VraAlertStatus = 0
|
||||
}
|
||||
VraGroup = "default_group"
|
||||
VraIdentifier = 269816293328110468
|
||||
VraIdentifierStr = "269816293328110468"
|
||||
VraName = "VRA-znest82esxus-1"
|
||||
VraNetworkDataApi = @{
|
||||
DefaultGateway = "192.168.1.1"
|
||||
SubnetMask = "255.255.255.0"
|
||||
VraIpAddress = "192.168.1.100"
|
||||
VraIpConfigurationTypeApi = "Dhcp"
|
||||
}
|
||||
VraVersion = 7.0
|
||||
}
|
||||
return $vraInformation
|
||||
Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -in @("MyVraIdentifier", "PasswordVraIdentifier") } {
|
||||
Get-Content $global:here\Mocks\GetSingleVra.json -Raw | ConvertFrom-Json
|
||||
}
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -eq "DoesNotExist" } {
|
||||
$null
|
||||
}
|
||||
|
||||
Context "$($File.BaseName)::Parameter Unit Tests" {
|
||||
Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -eq "DhcpVraIdentifier" } {
|
||||
Get-Content $global:here\Mocks\GetDhcpVra.json -Raw | ConvertFrom-Json
|
||||
}
|
||||
|
||||
It "has a mandatory String variable for the vraIdentifier" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vraIdentifier -Mandatory -Type String
|
||||
{Edit-ZertoVra}
|
||||
Context "$($global:function)::Parameter Unit Tests" {
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vraIdentifier'; Type = 'String'; Mandatory = $true }
|
||||
@{ParameterName = 'groupName'; Type = 'String'; Mandatory = $false }
|
||||
@{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $false }
|
||||
@{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $false }
|
||||
@{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $false }
|
||||
@{ParameterName = 'HostRootPassword'; Type = 'securestring'; Mandatory = $false }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "has a non-mandatory String variable for the Bandwidth Group" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter groupName -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter groupName -Type String
|
||||
$StringTestCases = @(
|
||||
@{ ParameterName = 'vraIdentifier' }
|
||||
@{ ParameterName = 'groupName' }
|
||||
)
|
||||
|
||||
It "<ParameterName> validates against null or empty values" -TestCases $StringTestCases {
|
||||
param($ParameterName)
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
it "has a non-mandatory String variable for the staticIp Address" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Type String
|
||||
$IpAddrTestCases = @(
|
||||
@{ParameterName = 'vraIpAddress' }
|
||||
@{ParameterName = 'defaultGateway' }
|
||||
@{ParameterName = 'subnetMask' }
|
||||
)
|
||||
|
||||
It "<ParameterName> validates string for a valid IP Address" -TestCases $IpAddrTestCases {
|
||||
param($ParameterName)
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
|
||||
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
|
||||
}
|
||||
|
||||
it "has a non-mandatory String variable for the default gateway" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Type String
|
||||
}
|
||||
|
||||
it "has a non-mandatory String variable for the subnetmask" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter subnetMask -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter subnetMask -Type String
|
||||
}
|
||||
|
||||
it "supports WhatIf" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter WhatIf -Not -Mandatory
|
||||
}
|
||||
|
||||
$cases = `
|
||||
@{vraIpAddress = "192.168.1.256"}, `
|
||||
@{vraIpAddress = "192.168.1"}, `
|
||||
@{vraIpAddress = "String"}, `
|
||||
@{vraIpAddress = 192.168.1}, `
|
||||
@{vraIpAddress = 192.168.1.246}, `
|
||||
@{vraIpAddress = 32}, `
|
||||
@{vraIpAddress = ""}, `
|
||||
@{vraIpAddress = $null}
|
||||
It "IpAddress field require valid IP addresses as a String" -TestCases $cases {
|
||||
param ( $vraIpAddress )
|
||||
{Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -vraIpaddress $vraIpAddress} | Should -Throw
|
||||
}
|
||||
|
||||
$cases = `
|
||||
@{subnetMask = "192.168.1.256"}, `
|
||||
@{subnetMask = "192.168.1"}, `
|
||||
@{subnetMask = "String"}, `
|
||||
@{subnetMask = 192.168.1}, `
|
||||
@{subnetMask = 192.168.1.246}, `
|
||||
@{subnetMask = 32}, `
|
||||
@{subnetMask = ""}, `
|
||||
@{subnetMask = $null}
|
||||
It "subnetMask field require valid IP addresses as a String" -TestCases $cases {
|
||||
param ( $vraIpAddress )
|
||||
{Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -subnetMask $subnetMask} | Should -Throw
|
||||
}
|
||||
|
||||
$cases = `
|
||||
@{defaultGateway = "192.168.1.256"}, `
|
||||
@{defaultGateway = "192.168.1"}, `
|
||||
@{defaultGateway = "String"}, `
|
||||
@{defaultGateway = 192.168.1}, `
|
||||
@{defaultGateway = 192.168.1.246}, `
|
||||
@{defaultGateway = 32}, `
|
||||
@{defaultGateway = ""}, `
|
||||
@{defaultGateway = $null}
|
||||
It "defaultGateway field require valid IP addresses as a String" -TestCases $cases {
|
||||
param ( $vraIpAddress )
|
||||
{Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -defaultGateway $defaultGateway} | Should -Throw
|
||||
}
|
||||
|
||||
$cases = `
|
||||
@{vraIdentifier = ""; paramName = "vraIdentifier"; paramValue = ""}, `
|
||||
@{vraIdentifier = $null; paramName = "vraIdentifier"; paramValue = ""}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "groupName"; paramValue = ""}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "groupName"; paramValue = $null}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "vraIpAddress"; paramValue = ""}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "vraIpAddress"; paramValue = $null}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "subnetMask"; paramValue = ""}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "subnetMask"; paramValue = $null}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "defaultGateway"; paramValue = ""}, `
|
||||
@{vraIdentifier = "MyVraIdentifier"; paramName = "defaultGateway"; paramValue = $null}
|
||||
|
||||
It "<paramName> does not take empty or null" -TestCases $cases {
|
||||
param($vraIdentifier, $paramValue, $paramName )
|
||||
if ([String]::IsNullOrEmpty($vraIdentifier)) {
|
||||
{Edit-ZertoVra -vraIdentifier $vraIdentifier} | Should -Throw
|
||||
} else {
|
||||
{Edit-ZertoVra -vraIdentifier $vraIdentifier -$paramName $paramValue} | should -Throw
|
||||
}
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
(Get-Command $global:function).ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
(Get-Command $global:function).ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($File.BaseName)::Function Unit Tests" {
|
||||
Context "$($global:function)::Function Unit Tests" {
|
||||
|
||||
It "Returns a string" {
|
||||
It "Returns a task id string" {
|
||||
$results = Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -groupName "MyGroup"
|
||||
$results | should not benullorempty
|
||||
$results | should -BeOfType "String"
|
||||
$results | Should -BeExactly "8dcfdc8e-e5d2-4ba4-9885-f9eb57d92b14.928a122b-1763-4664-ad37-cc00bb883f2f"
|
||||
$results | Should not benullorempty
|
||||
$results | Should -BeOfType "String"
|
||||
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
|
||||
it "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter WhatIf
|
||||
Get-Command $file.BaseName | Should -HaveParameter Confirm
|
||||
$file | Should -FileContentMatch 'SupportsShouldProcess'
|
||||
$file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
It "Throws an error when the VPG does not exist" {
|
||||
{ Edit-ZertoVra -vraIdentifier "DoesNotExist" -groupName "MyNewGroup" } | Should Throw "VRA with Identifier:"
|
||||
}
|
||||
|
||||
It "Runs when passed static IP information" {
|
||||
Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -vraIpAddress "192.168.1.250" -defaultGateway "192.168.1.254" -subnetMask "255.255.255.0"
|
||||
}
|
||||
|
||||
It "Processes a VRA with a DHCP address" {
|
||||
Edit-ZertoVra -vraIdentifier "DhcpVraIdentifier" -groupName "MyNewGroup" | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
|
||||
It "Runs with root password provided" {
|
||||
$SecurePassword = 'NotARealPassword' | ConvertTo-SecureString -AsPlainText -Force
|
||||
Edit-ZertoVra -vraIdentifier "PasswordVraIdentifier" -HostRootPassword $SecurePassword | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
|
||||
}
|
||||
|
||||
}
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra
|
||||
}
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -Exactly 5
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'OutputFile'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> has <Validation> validation set" -TestCases $ParameterTestCases {
|
||||
param($ParameterName)
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Function Unit Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
@@ -1,53 +1,39 @@
|
||||
#Requires -Modules Pester
|
||||
#Region - Test Setup
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
#EndRegion
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
it "has a mantatory string parameter for the output path" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter outputPath -Type String -Mandatory
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'OutputPath'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'allVpgs'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type, with correct validation" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
it "has a non-mandatory string array parameter for vpgName(s) to export" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Type String[] -Mandatory
|
||||
}
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
it "has a non-mandatory switch parameter to export all vpgs" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter allVpgs -Type Switch -Mandatory
|
||||
}
|
||||
|
||||
it "No defined vpgName or AllVpg switch should throw an error" {
|
||||
{Export-ZertoVpg -outputPath "."} | Should -Throw
|
||||
}
|
||||
|
||||
it "Output path does not take null or empty string" {
|
||||
{Export-ZertoVpg -outputPath "" -allVpgs} | Should -Throw
|
||||
{Export-ZertoVpg -outputPath $null -allVpgs} | Should -Throw
|
||||
}
|
||||
|
||||
it "Vpg Name parameter does not take null or empty string" {
|
||||
{Export-ZertoVpg -outputPath "." -vpgName = ""} | Should -Throw
|
||||
{Export-ZertoVpg -outputPath "." -vpgName = $null} | Should -Throw
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
Context "$($global:function)::Function Unit Tests" {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg {
|
||||
$returnObj = @{
|
||||
VpgName = "HRIS"
|
||||
@@ -60,6 +46,10 @@ Describe $file.BaseName -Tag 'Unit' {
|
||||
return "1024d377-afb8-4880-82f0-96eeff413ffd"
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Remove-ZertoVpgSettingsIdentifier {
|
||||
return $null
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpgSetting {
|
||||
$returnObj = @{
|
||||
Backup = $null
|
||||
@@ -213,11 +203,11 @@ Describe $file.BaseName -Tag 'Unit' {
|
||||
|
||||
$outputPath = "TestDrive:"
|
||||
|
||||
it "Output path should exist" {
|
||||
It "Output path should exist" {
|
||||
$outputPath | Should -Exist
|
||||
}
|
||||
|
||||
it "Exported JSON file should exist after function called" {
|
||||
It "Exported JSON file should exist after function called" {
|
||||
$vpgName = "HRIS"
|
||||
Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName
|
||||
$outputFile = "{0}\{1}.json" -f $outputPath, $vpgName
|
||||
@@ -225,11 +215,11 @@ Describe $file.BaseName -Tag 'Unit' {
|
||||
$outputFile | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
it "Only one file should be present in the TestDrive" {
|
||||
It "Only one file should be present in the TestDrive" {
|
||||
(Get-ChildItem $outputPath).Count | Should -BeExactly 1
|
||||
}
|
||||
|
||||
it "Should be valid JSON" {
|
||||
It "Should be valid JSON" {
|
||||
$vpgName = "HRIS"
|
||||
Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName
|
||||
$outputFile = "{0}\{1}.json" -f $outputPath, $vpgName
|
||||
@@ -247,3 +237,6 @@ Describe $file.BaseName -Tag 'Unit' {
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpgSetting
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'limitTo'; Type = 'int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'alertIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "LimitTo Parameter should have a Min value of 1" {
|
||||
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1
|
||||
}
|
||||
|
||||
It "LimitTo Parameter should have a Max value of 1000000" {
|
||||
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'datastoreIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'clusterIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,77 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'limitTo'; Type = 'int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'category'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "LimitTo Parameter should have a Min value of 1" {
|
||||
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1
|
||||
}
|
||||
|
||||
It "LimitTo Parameter should have a Max value of 1000000" {
|
||||
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000
|
||||
}
|
||||
|
||||
It "Category parameter should only have 2 options" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 2
|
||||
}
|
||||
|
||||
It "Category parameter should take 'events'" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'events'
|
||||
}
|
||||
|
||||
It "Category parameter should take 'alertsHistory'" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'alertsHistory'
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,59 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,19 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 11 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 11
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,24 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
It "$global:function has a non-mandatory string parameter for the zOrgIdentifier" {
|
||||
Get-Command $global:function | Should -HaveParameter zOrgIdentifier -Type String
|
||||
Get-Command $global:function | Should -HaveParameter zOrgIdentifier -not -Mandatory
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,60 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 17 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 17
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,60 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 17 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 17
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,51 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,51 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,49 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,49 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,57 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 17 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 17
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
|
||||
@{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,57 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 17 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 17
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
|
||||
@{ParameterName = 'interval'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,42 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,57 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 17 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 17
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
|
||||
@{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,56 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,56 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,41 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'AllVms'; Type = 'Switch'; Mandatory = $false; Validation = $Null }
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'Volumes'; Type = 'Switch'; Mandatory = $false; Validation = $Null }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,39 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,58 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'Interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 60" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 2678400" {
|
||||
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,28 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
It "zOrgIdentifier Parameter should be present and of 'String' Type" {
|
||||
Get-Command $global:function | Should -HaveParameter zOrgIdentifier -Type String -Mandatory:$false
|
||||
}
|
||||
|
||||
It "zOrgIdentifier has the NotNullOrEmpty Validator" {
|
||||
(Get-Command $global:function).Parameters['zOrgIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,44 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,42 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,57 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'limitTo'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'taskIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Min value of 1" {
|
||||
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1
|
||||
}
|
||||
|
||||
It "Interval Parameter should have a Max value of 1000000" {
|
||||
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,45 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'clusterIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'datastoreIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,43 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 13 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 13
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -0,0 +1,19 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 11 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 11
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -1,29 +1,51 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'alertId'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'entities'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'helpIdentifiers'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'levels'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'level'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'helpIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'isDismissed'; Type = 'bool'; Mandatory = $false; Validation = $null }
|
||||
)
|
||||
|
||||
it "Has a mandatory string parameter for the Alert identifier" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter alertId -Mandatory -Type String[]
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "has a non-mandatory string parameter for the datacenterIdentifier" {
|
||||
Get-Command $global:function | Should -HaveParameter datastoreIdentifier
|
||||
Get-Command $global:function | Should -HaveParameter datastoreIdentifier -Type String[]
|
||||
}
|
||||
|
||||
It "datastoreIdentifier parameter does not take null or empty values" {
|
||||
(Get-Command $global:function).Parameters['datastoreIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.count | Should -Be 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,120 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 28 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 28
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpg'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'entityType'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'userName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'category'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'eventCategory'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'alertIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'eventId'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'categories'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'entities'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'types'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "entityType parameter only accecpts 4 different values" {
|
||||
(Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 4
|
||||
}
|
||||
|
||||
It "entityType parameter accecpts 'VPG' as a Value" {
|
||||
(Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'VPG'
|
||||
}
|
||||
|
||||
It "entityType parameter accecpts 'VRA' as a Value" {
|
||||
(Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'VRA'
|
||||
}
|
||||
|
||||
It "entityType parameter accecpts 'Unknown' as a Value" {
|
||||
(Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Unknown'
|
||||
}
|
||||
|
||||
It "entityType parameter accecpts 'Site' as a Value" {
|
||||
(Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Site'
|
||||
}
|
||||
|
||||
It "category parameter only accecpts 3 different values" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 3
|
||||
}
|
||||
|
||||
It "category parameter accecpts 'All' as a Value" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'All'
|
||||
}
|
||||
|
||||
It "category parameter accecpts 'events' as a Value" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'events'
|
||||
}
|
||||
|
||||
It "category parameter accecpts 'alerts' as a Value" {
|
||||
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'alerts'
|
||||
}
|
||||
|
||||
It "eventCategory parameter only accecpts 3 different values" {
|
||||
(Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 3
|
||||
}
|
||||
|
||||
It "eventCategory parameter accecpts 'All' as a Value" {
|
||||
(Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'All'
|
||||
}
|
||||
|
||||
It "eventCategory parameter accecpts 'events' as a Value" {
|
||||
(Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'events'
|
||||
}
|
||||
|
||||
It "eventCategory parameter accecpts 'alerts' as a Value" {
|
||||
(Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'alerts'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 11 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 11
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
It "Has a non-mandatory switch parameter for the pairing Statuses" {
|
||||
Get-Command $global:function | Should -HaveParameter pairingstatuses
|
||||
Get-Command $global:function | Should -HaveParameter pairingstatuses -Type switch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,53 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 18 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 18
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'pairingStatuses'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'peerName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'paringStatus'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'location'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'hostName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'port'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,261 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 23 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 23
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'hostIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'folders'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
@{ParameterName = 'hostClusters'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
@{ParameterName = 'hosts'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
@{ParameterName = 'networks'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
@{ParameterName = 'resourcePools'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
@{ParameterName = 'vms'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
@{ParameterName = 'repositories'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting of <Validation>" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Validation)
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
Switch ($Validation) {
|
||||
|
||||
'NotNullOrEmpty' {
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
$Null {
|
||||
$Type -match 'Switch' | Should -BeTrue -Because "Only Switch Parameters should not have validation"
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -BeFalse -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
It "$($global:function) does not have 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -not -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -not -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -not -match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -not -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-NoParams.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/devices'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-devices.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-devices-hostid.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/hosts'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-hosts.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/hosts/4567'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-hosts-hostid.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-SiteId.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/datastores'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-datastores.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/datastoreclusters'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-datastoreClusters.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/networks'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-Networks.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/folders'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-Folders.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/hostclusters'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-hostClusters.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/resourcepools'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-ResourcePools.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/vms'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-VMs.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/repositories'
|
||||
} {
|
||||
return (Get-Content "$global:here\Mocks\VirtualSite-repositories.json" -Raw) | ConvertFrom-Json
|
||||
} -Verifiable
|
||||
|
||||
It "Should return all known sites when called without parameters" {
|
||||
$results = Get-ZertoVirtualizationSite
|
||||
$results.Count | Should -BeExactly 2
|
||||
}
|
||||
|
||||
It "Should return a single site when a siteIdentifier is provided" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234'
|
||||
$results.VirtualizationSiteName | Should -BeExactly 'cavc.nc.lab'
|
||||
$results.siteIdentifier | Should -BeExactly '8e1c9f53-4973-4a4a-b2dd-1ebb293614d8'
|
||||
}
|
||||
|
||||
It "Should return a list of devices with the '-devices' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices
|
||||
$results.Count | Should -BeExactly 5
|
||||
}
|
||||
|
||||
It "Should return a list of devices with the '-devices' switch and hostIdentifier provided" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices -hostIdentifier '4567'
|
||||
$results.Count | Should -BeExactly 5
|
||||
}
|
||||
|
||||
It "Should return a list of hosts with the '-hosts' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts
|
||||
$results.Count | Should -BeExactly 3
|
||||
}
|
||||
|
||||
It "Should return a single host with the '-hosts' switch and hostIdentifier provided" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts -hostIdentifier '4567'
|
||||
$results.VirtualizationHostName | Should -BeExactly "caesx3.nc.lab"
|
||||
$results.hostIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.host-18"
|
||||
}
|
||||
|
||||
It "Should return a list of datastores with the '-datastores' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastores
|
||||
$results.Count | Should -BeExactly 8
|
||||
}
|
||||
|
||||
It "Should return a list of datastores with the '-datastoreClusters' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastoreClusters
|
||||
$results.DatastoreClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.group-p44"
|
||||
$results.DatastoreClusterName | Should -BeExactly "CA_DS_Cluster"
|
||||
}
|
||||
|
||||
It "Should return a list of Networks with the '-networks' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -networks
|
||||
$results.NetworkIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.network-20"
|
||||
$results.VirtualizationNetworkName | Should -BeExactly "VM Network"
|
||||
}
|
||||
|
||||
It "Should return a list of folders with the '-folders' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -folders
|
||||
$results.Count | Should -BeExactly 3
|
||||
}
|
||||
|
||||
It "Should return a list of Host Clusters with the '-hostClusters' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hostClusters
|
||||
$results.ClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7"
|
||||
$results.VirtualizationClusterName | Should -BeExactly "CA Cluster"
|
||||
}
|
||||
|
||||
It "Should return a list of Resource Pools with the '-resourcePools' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -resourcePools
|
||||
$results.ResourcePoolIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8"
|
||||
$results.ResourcePoolName | Should -BeExactly "Resources"
|
||||
}
|
||||
|
||||
It "Should return a list of VMs with the '-VMs' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -vms
|
||||
$results.Count | Should -BeExactly 4
|
||||
}
|
||||
|
||||
It "Should return a list of LTR Repositories with the '-repositories' switch" {
|
||||
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -repositories
|
||||
$results.ConnectionType | Should -BeExactly "ServerMessageBlock"
|
||||
$results.RepositoryIdentifier | Should -BeExactly "120355ce-fcd0-4820-a971-787d0470793b"
|
||||
$results.RepositoryName | Should -BeExactly "Synology"
|
||||
$results.StorageType | Should -BeExactly "NetworkShare"
|
||||
$results.Path | Should -not -be $null
|
||||
}
|
||||
|
||||
Assert-VerifiableMock
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/devices'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/hosts'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/hosts/4567'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/datastores'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/datastoreclusters'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/networks'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/folders'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/hostclusters'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/resourcepools'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/vms'
|
||||
} -Exactly 1
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
|
||||
$uri -eq 'virtualizationsites/1234/repositories'
|
||||
} -Exactly 1
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 11 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
It "Has a mandatory string array parameter for the settings file to import" {
|
||||
Get-Command $global:function | Should -HaveParameter InputFile
|
||||
Get-Command $global:function | Should -HaveParameter InputFile -Mandatory
|
||||
Get-Command $global:function | Should -HaveParameter InputFile -Type String
|
||||
}
|
||||
|
||||
It "Will not accecpt a Null or Empty string for the settings file" {
|
||||
$attrs = (Get-Command $global:function).Parameters['InputFile'].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -1,39 +1,30 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
It "Has a mandatory string array parameter for the settings file to import" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter settingsFile
|
||||
Get-Command $file.BaseName | Should -HaveParameter settingsFile -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter settingsFile -Type String[]
|
||||
Get-Command $global:function | Should -HaveParameter settingsFile
|
||||
Get-Command $global:function | Should -HaveParameter settingsFile -Mandatory
|
||||
Get-Command $global:function | Should -HaveParameter settingsFile -Type String[]
|
||||
}
|
||||
|
||||
It "Will not accecpt a Null or Empty string for the settings file" {
|
||||
{Import-ZertoVpg -settingsFile $null} | Should -Throw
|
||||
{Import-ZertoVpg -settingsFile ""} | Should -Throw
|
||||
{Import-ZertoVpg -settingsFile @()} | Should -Throw
|
||||
$attrs = (Get-Command $global:function).Parameters['settingsFile'].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,108 +1,57 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 24 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 24
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'hostName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'datastoreName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'networkName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'Dhcp'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
|
||||
@{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
|
||||
@{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
|
||||
@{ParameterName = 'UseRootCredential'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'HostRootPassword'; Type = 'SecureString'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'IpAddr' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
|
||||
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
It "Has a mandatory string host name parameter" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter hostName
|
||||
Get-Command $file.BaseName | Should -HaveParameter hostName -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter hostName -Type String
|
||||
}
|
||||
|
||||
It "Will not accecpt a Null or Empty string for the host name" {
|
||||
{Install-ZertoVra -hostName $null -datastoreName "DS01" -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty"
|
||||
{Install-ZertoVra -hostName "" -datastoreName "DS01" -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty"
|
||||
}
|
||||
|
||||
It "Has a mandatory string datastore parameter" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter datastoreName
|
||||
Get-Command $file.BaseName | Should -HaveParameter datastoreName -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter datastoreName -Type String
|
||||
}
|
||||
|
||||
It "Will not accecpt a Null or Empty string for the datastore" {
|
||||
{Install-ZertoVra -hostName "MyfirstHost" -datastoreName $null -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty"
|
||||
{Install-ZertoVra -hostName "MyfirstHost" -datastoreName "" -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty"
|
||||
}
|
||||
|
||||
It "Has a mandatory string network parameter" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter networkName
|
||||
Get-Command $file.BaseName | Should -HaveParameter networkName -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter networkName -Type String
|
||||
}
|
||||
|
||||
It "Will not accecpt a Null or Empty string for the datastore" {
|
||||
{Install-ZertoVra -hostName "MyfirstHost" -datastoreName "DS01" -networkName $null -Dhcp } | Should -Throw "The argument is null or empty"
|
||||
{Install-ZertoVra -hostName "MyfirstHost" -datastoreName "DS01" -networkName "" -Dhcp } | Should -Throw "The argument is null or empty"
|
||||
}
|
||||
|
||||
it "Has a switch parameter for setting DHCP" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter Dhcp
|
||||
Get-Command $file.BaseName | Should -HaveParameter Dhcp -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter Dhcp -Type 'Switch'
|
||||
|
||||
}
|
||||
|
||||
it "Has a mandatory string parameter for the static IP address" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vraIpAddress
|
||||
Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Type String
|
||||
}
|
||||
|
||||
it "Has a mandatory string parameter for the subnet mask" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter subnetMask
|
||||
Get-Command $file.BaseName | Should -HaveParameter subnetMask -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter subnetMask -Type String
|
||||
}
|
||||
|
||||
it "Has a mandatory string parameter for the default gateway" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter defaultGateway
|
||||
Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Type String
|
||||
}
|
||||
|
||||
$cases = `
|
||||
@{invalidIpAddress = "192.168.1.256"}, `
|
||||
@{invalidIpAddress = "192.168.1"}, `
|
||||
@{invalidIpAddress = "String"}, `
|
||||
@{invalidIpAddress = 192.168.1.246}, `
|
||||
@{invalidIpAddress = 32}, `
|
||||
@{invalidIpAddress = ""}, `
|
||||
@{invalidIpAddress = $null}
|
||||
It "IpAddress field require valid IP addresses as a String: <invalidIpAddress>" -TestCases $cases {
|
||||
param ( $invalidIpAddress )
|
||||
{Install-ZertoVra -hostName "MyFirstHost" -datastoreName "DS01" -networkName "MyNetwork" -vraIpAddress $invalidIpAddress -subnetMask "255.255.255.0" -defaultGateway "192.168.1.254"} | Should -Throw
|
||||
}
|
||||
|
||||
It "Default Gateway field require valid IP addresses as a String: <invalidIpAddress>" -TestCases $cases {
|
||||
param ( $invalidIpAddress )
|
||||
{Install-ZertoVra -hostName "MyFirstHost" -datastoreName "DS01" -networkName "MyNetwork" -vraIpAddress '192.168.1.100' -subnetMask "255.255.255.0" -defaultGateway $invalidIpAddress} | Should -Throw
|
||||
}
|
||||
|
||||
It "Subnet Mask field require valid IP addresses as a String: <invalidIpAddress>" -TestCases $cases {
|
||||
param ( $invalidIpAddress )
|
||||
{Install-ZertoVra -hostName "MyFirstHost" -datastoreName "DS01" -networkName "MyNetwork" -vraIpAddress '192.168.1.100' -subnetMask $invalidIpAddress -defaultGateway "192.168.1.254"} | Should -Throw
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
#TODO
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
$testCases = @(
|
||||
@{ParameterName = 'uri'; Type = 'String'; Mandatory = $true; TestName = 'URI' }
|
||||
@{ParameterName = 'method'; Type = 'String'; Mandatory = $false; TestName = 'Method' }
|
||||
@{ParameterName = 'body'; Type = 'String'; Mandatory = $false; TestName = 'Body' }
|
||||
)
|
||||
|
||||
It "Parameter present and Type test for: <TestName> " -TestCases $testCases {
|
||||
param($parameterName, $type, $Mandatory)
|
||||
Get-Command $global:function | Should -HaveParameter $parameterName -Type $type
|
||||
if ($Mandatory) {
|
||||
Get-Command $global:function | Should -HaveParameter $parameterName -Mandatory
|
||||
} else {
|
||||
Get-Command $global:function | Should -HaveParameter $parameterName -Not -Mandatory
|
||||
}
|
||||
}
|
||||
|
||||
It "Method parameter default is 'GET'" {
|
||||
Get-Command $global:function | Should -HaveParameter Method -DefaultValue "GET"
|
||||
}
|
||||
|
||||
$NotNullOrEmptyTests = @(
|
||||
@{ParameterName = 'uri'; TestName = 'Uri' }
|
||||
@{ParameterName = 'body'; TestName = 'Body' }
|
||||
)
|
||||
|
||||
It "<TestName> parameter does not accecpt a null or empty value" -TestCases $NotNullOrEmptyTests {
|
||||
param($parameterName)
|
||||
$parameterInfo = ( Get-Command Invoke-ZARestRequest ).Parameters[$parameterName]
|
||||
$parameterInfo.Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
It "method parametert only accecpts 'GET' 'DELETE' 'PUT' 'POST' values" {
|
||||
$parameterInfo = ( Get-Command Invoke-ZARestRequest ).Parameters['method']
|
||||
$parameterInfo.Attributes.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
$validateSet = $parameterInfo.Attributes.Where{ $_ -is [ValidateSet] }
|
||||
$validateSet.ValidValues -contains 'GET' | Should -BeTrue
|
||||
$validateSet.ValidValues -contains 'PUT' | Should -BeTrue
|
||||
$validateSet.ValidValues -contains 'POST' | Should -BeTrue
|
||||
$validateSet.ValidValues -contains 'DELETE' | Should -BeTrue
|
||||
$validateSet.ValidValues.Count | Should -Be 4
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Function Unit Tests" {
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-RestMethod {
|
||||
"Ran Command"
|
||||
}
|
||||
|
||||
BeforeEach {
|
||||
Set-Variable -Name zaHeaders -Scope Script -Value (@{ "Accept" = "application/json" })
|
||||
Set-Variable -Name zaLastActionTime -Scope Script -Value $(Get-Date).Ticks
|
||||
}
|
||||
|
||||
It "runs when called" {
|
||||
Invoke-ZARestRequest -uri "myuri" | Should -Be "Ran Command"
|
||||
}
|
||||
|
||||
It "throws when the last action was over 60 minutes ago" {
|
||||
$script:zaLastActionTime = (Get-Date).AddMinutes(-61).Ticks
|
||||
{ Invoke-ZARestRequest -uri "myuri" } | Should Throw "Authorization Token has Expired."
|
||||
}
|
||||
|
||||
It "throws when the zaHeaders variable does not exits" {
|
||||
Remove-Variable -Name zaHeaders -Scope Script
|
||||
{ Invoke-ZARestRequest -uri "myuri" } | Should Throw "Zerto Analytics Connection does not Exist."
|
||||
}
|
||||
|
||||
It "throws when the zaLastActionTime variable does not exist" {
|
||||
Remove-Variable -Name zaLastActionTime -Scope Script
|
||||
{ Invoke-ZARestRequest -uri "myuri" } | Should Throw "Zerto Analytics Connection does not Exist."
|
||||
}
|
||||
|
||||
Assert-MockCalled -CommandName Invoke-RestMethod -ModuleName ZertoApiWrapper -Exactly 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name function -Scope Global
|
||||
Remove-Variable -Name here -Scope Global
|
||||
@@ -0,0 +1,54 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'hostName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty'; ParameterSet = @('hostName') }
|
||||
@{ParameterName = 'vraName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraName') }
|
||||
@{ParameterName = 'vraIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraIdentifier') }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter is part of the correct ParameterSet(s)" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $ParameterSet)
|
||||
$commandParameterSets = (Get-Command $global:function).Parameters[$ParameterName].ParameterSets
|
||||
foreach ($Set in $ParameterSet) {
|
||||
$commandParameterSets.ContainsKey($Set) | Should -BeTrue
|
||||
}
|
||||
$commandParameterSets.Count | Should -Be $ParameterSet.Count
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -1,77 +1,101 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
it "has a mandatory string parameter for the vpgName" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Type string
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 20 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 20
|
||||
}
|
||||
|
||||
it "has a non-mandatory string parameter for the checkpoint" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter checkpointIdentifier
|
||||
Get-Command $file.BaseName | Should -HaveParameter checkpointIdentifier -Type string
|
||||
Get-Command $file.BaseName | Should -HaveParameter checkpointIdentifier -Not -Mandatory
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'checkpointIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'shutdownPolicy'; Type = 'Int'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'timeToWaitBeforeShutdownInSec'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'reverseProtection'; Type = 'bool'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'vmName'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
it "has a non-mandatory string parameter for the commit policy" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter commitPolicy
|
||||
Get-Command $file.BaseName | Should -HaveParameter commitPolicy -Type string
|
||||
Get-Command $file.BaseName | Should -HaveParameter commitPolicy -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter commitPolicy -DefaultValue "Rollback"
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'ShouldProcess' {
|
||||
$scriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
$scriptBlock | Should -match 'SupportsShouldProcess'
|
||||
$scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it "has a non-mandatory int parameter for the shutdown policy" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy
|
||||
Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy -Type int
|
||||
Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy -DefaultValue 0
|
||||
It "Commit Policy Default Value is 'RollBack'" {
|
||||
Get-Command $global:function | Should -HaveParameter commitPolicy -DefaultValue "Rollback"
|
||||
}
|
||||
|
||||
it "has a non-mandatory int parameter for the time to wait before force shutdown" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec
|
||||
Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec -Type int
|
||||
Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec -Not -Mandatory
|
||||
Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec -DefaultValue 3600
|
||||
It "Commit Policy Only Accecpts 'RollBack', 'Commit', or 'None'" {
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -HaveCount 3
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'RollBack'
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Commit'
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'None'
|
||||
}
|
||||
|
||||
it "has a non-mandatory bool parameter for the reverse protection policy" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Type bool
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Not -Mandatory
|
||||
It "Shutdown Policy Default Value is '0'" {
|
||||
Get-Command $global:function | Should -HaveParameter shutdownPolicy -DefaultValue 0
|
||||
}
|
||||
|
||||
it "has a non-mandatory array string parameter for the named VMs to be failed over" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vmName
|
||||
Get-Command $file.BaseName | Should -HaveParameter vmName -Type string[]
|
||||
Get-Command $file.BaseName | Should -HaveParameter vmName -Not -Mandatory
|
||||
It "Shutdown Policy Only Accecpts 'RollBack', 'Commit', or 'None'" {
|
||||
(Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -HaveCount 3
|
||||
(Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 0
|
||||
(Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 1
|
||||
(Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 2
|
||||
}
|
||||
|
||||
it "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter WhatIf
|
||||
Get-Command $file.BaseName | Should -HaveParameter Confirm
|
||||
$file | Should -FileContentMatch 'SupportsShouldProcess'
|
||||
$file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
It "Time to wait before shutdown in sec should have a default value of 3600" {
|
||||
Get-Command $global:function | Should -HaveParameter timeToWaitBeforeShutdownInSec -DefaultValue 3600
|
||||
}
|
||||
|
||||
It "Time to wait before shutdown in sec should have a minimum value of 300 and max value of 86400" {
|
||||
(Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300
|
||||
(Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
#TODO
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,44 +1,56 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
|
||||
it "Supports 'ShouldProcess'" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter WhatIf
|
||||
Get-Command $file.BaseName | Should -HaveParameter Confirm
|
||||
$file | Should -FileContentMatch 'SupportsShouldProcess'
|
||||
$file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
it "has a mandatory string parameter for the vpgName" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Type string[]
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'reverseProtection'; Type = 'switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
it "has a switch parameter for reverse protection" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Type switch
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'ShouldProcess' {
|
||||
$scriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
$scriptBlock | Should -match 'SupportsShouldProcess'
|
||||
$scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
#TODO
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
It "has a mandatory string parameter for the vpgName" {
|
||||
Get-Command $global:function | Should -HaveParameter vpgName
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Type string[]
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory
|
||||
}
|
||||
}
|
||||
}
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 12 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 12
|
||||
}
|
||||
|
||||
It "has a mandatory string parameter for the vpgName" {
|
||||
Get-Command $global:function | Should -HaveParameter vpgName
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Type string[]
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,83 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 21 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 21
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'Guid[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'commitPolicyTimeout'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'forceShutdown'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'ContinueOnPreScriptFailure'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Set' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'ShouldProcess' {
|
||||
$scriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
$scriptBlock | Should -match 'SupportsShouldProcess'
|
||||
$scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Commit Policy Only Accecpts 'RollBack', 'Commit', or 'None'" {
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -HaveCount 3
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'RollBack'
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Commit'
|
||||
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'None'
|
||||
}
|
||||
|
||||
It "Commit Policy Timeout should have a minimum value of 300 and max value of 86400" {
|
||||
(Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300
|
||||
(Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,56 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'reverseProtection'; Type = 'switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'ShouldProcess' {
|
||||
$scriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
$scriptBlock | Should -match 'SupportsShouldProcess'
|
||||
$scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
|
||||
$null {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.TypeId.Count | Should -Be 2
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 14 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 14
|
||||
}
|
||||
|
||||
It "has a mandatory string parameter for the vpgName" {
|
||||
Get-Command $global:function | Should -HaveParameter vpgName
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Type string[]
|
||||
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory
|
||||
}
|
||||
}
|
||||
}
|
||||
Context "$global:function::Parameter Functional Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user