Skip to content

Commit

Permalink
local develop merge into master
Browse files Browse the repository at this point in the history
- updated docs
# Conflicts:
#	README.md
#	docs/Quick-Start.-Installation-and-Example.md
  • Loading branch information
DexterPOSH committed Mar 15, 2017
1 parent 31a487c commit e36b812
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 21 deletions.
2 changes: 1 addition & 1 deletion PSRemotely/private/RemoteSession.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function CreateSessions
else {
#$sessionInfo = CreateSessionInfo -Session (New-PSSession -ComputerName $Node.NodeName -Name $sessionName -SessionOption $PSSessionOption)
}
$PSSessionOption = New-PSSessionOption -ApplicationArguments $argumentList -NoMachineProfile
$PSSessionOption = New-PSSessionOption -NoMachineProfile # remove passing argument list here, can not pass complex data types
[ValidateNotNullOrEmpty()]$session = New-PSSession @PSSessionParams -SessionOption $PSSessionOption
[ValidateNotNullOrEmpty()]$sessionInfo = CreateSessionInfo -Session $session -Credential $credential
}
Expand Down
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In a nutshell it let's you execute Pester tests against a remote machine. PSRemo

Note - In the code & documentation the term 'Remotely' and 'PSRemotely' refer to the same.

It supports copying of the modules and artefacts to the remote node before the Pester tests are run.
It supports copying of the modules and artifacts to the remote node before the Pester tests are run.

Description
======================
Expand Down Expand Up @@ -47,15 +47,15 @@ Describe 'Bits Service test' {
}
}
```
If you want to target the very same tests on the remote node named say Node1,Node2 & Node3 from your current workstation, you can use PSRemotely.
If you want to target the very same tests on the remote node named say AD,WDS & DHCP from your current workstation (part of the same domain), you can use PSRemotely.


Usage with PSRemotely:

```powershell
PSRemotely {
Node AD {
Node AD, WDS, DHCP {
Describe 'Bits Service test' {
Expand All @@ -82,6 +82,19 @@ Output of the above is a JSON object, if the tests pass then an empty JSON objec
otherwise the Error record thrown by Pester is returned :

```json
{
"Status": true,
"NodeName": "WDS",
"Tests": [
{
"TestResult": [

],
"Result": true,
"Name": "Bits Service test"
}
]
}
{
"Status": true,
"NodeName": "AD",
Expand All @@ -95,6 +108,19 @@ otherwise the Error record thrown by Pester is returned :
}
]
}
{
"Status": true,
"NodeName": "DHCP",
"Tests": [
{
"TestResult": [

],
"Result": true,
"Name": "Bits Service test"
}
]
}
```


Expand Down
2 changes: 1 addition & 1 deletion docs/Example-Basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ So you take the investments in your tests and let PS Remotely do the underlying
Once you have the tests file reeady, below is how you invoke the PS Remotely framework :

```powershell
Invoke-Remotely -Script <Path_to_Tests.ps1>
Invoke-Remotely -Script <Path_to_PSRemotely.ps1>
```

Output of the above is a JSON object for the Node on which the tests were run. The property Status is true if all the tests (Describe blocks) passed on the remote node.
Expand Down
14 changes: 9 additions & 5 deletions docs/PSRemotely-Configuration-Files.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
PSRemotely at the moment have only one configuration file to work with:

* PSRemotely configurations: Remotely.json file
## PSRemotely configuration file - PSRemotely.json (placed under PSRemotely Root folder)

Below is how the PSRemotely.json file looks like.
```json
{
"RemotelyNodePath": "C:\\Temp\\Remotely",
Expand All @@ -11,16 +12,19 @@ PSRemotely at the moment have only one configuration file to work with:
"ModuleVersion": "3.3.14"
}
],
"ArtefactsRequired":[
"artifactsRequired":[
"DeploymentManifest.xml"
]
}
```

* RemotelyNodePath - Specfies the path used on the Remotely node to dump the tests file and store Pester Nunit test results.
Each property in the PSRemotely.json file is a configuration used by the PSRemotely framework.
Below is the explanation on how these fields are used :

* modulesRequired - An array of modules required on the Remotely node (stored locally under the /lib folder),
* RemotelyNodePath - Specfies the path used on the remote node to dump the tests file and store Pester Nunit test results.

* modulesRequired - An array of modules required on the remote node (stored locally under the /lib folder),
copied to the RemotelyNodePath location. These modules are copied and imported on the PSSession before the tests are invoked.

* ArtefactsRequired - An array of files which are copied each time to the Remotely nodes (stored locally under the /lib/artefacts folder),
* artifactsRequired - An array of files which are copied each time to the remote nodes (stored locally under the /lib/artifacts folder),
after PS Remotely is invoked.
3 changes: 2 additions & 1 deletion docs/PSRemotely-PoshSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Save-Module -name PoshSpec -RequiredVersion 2.1.12 -Path .\PSRemotely\Lib -Verbo
```

The above will create the folder structure like below, under the lib folder (which PSRemotely works with)

+ PSRemotely
+ lib
+ PoshSpec
Expand All @@ -60,5 +61,5 @@ PSRemotely -Verbose {
}
```
Note - Using PoshSpec tests and targeting localhost (remote nodes work) using PSRemotely does not work, haven't got around
Note - Using PoshSpec style tests to target operations validation against the localhost fails (remote nodes do work), haven't got around
to check why that is the case but that is something uncovered while writing this doc.
9 changes: 5 additions & 4 deletions docs/PSRemotely-Remotely-Variable.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# PSRemotely global scope variable

PSRemotely module when imported creates a global scope variable which stores the following:
- NodeMap *Collection of each node's status*
- Session Hashtable *Hashtable which maintains PSSession for the nodes along with the credentials used (if any)*
- RemotelyNodePath *The local path location to be used on the nodes by PSRemotely (read from Remotely.json)*
- ModulesRequired *Array of ModulesRequired (read from Remotely.json)*

1. NodeMap *Collection of each node's status*
2. Session Hashtable *Hashtable which maintains PSSession for the nodes along with the credentials used (if any)*
3. RemotelyNodePath *The local path location to be used on the nodes by PSRemotely (read from Remotely.json)*
4. ModulesRequired *Array of ModulesRequired (read from Remotely.json)*

Each time you invoke PSRemotely to run validation tests targeted to the remote nodes, the required information
is updated in the PSRemotely global variable.
Expand Down
9 changes: 5 additions & 4 deletions docs/PSRemotely-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

PSRemotely is a very simple module. Below is how it works.
It works in three stages :
- BootStrap
- CopyTests
- InvokeTests

1. BootStrap
2. CopyTests
3. InvokeTests

If you have a test file say Server1.PSRemotely.ps1, see below :

Expand All @@ -31,7 +32,7 @@ Remotely {
## BootStrap Stage

PSRemotely starts by looking at the names of the servers supplied to it with the *Node* keyword or it looks at the DSC style configuration data.
In the background it does a bunch of stuff referred to as 'bootstrapping'. During the bootstrapping phase for a node below happens:
In the background it does a bunch of stuff referred to as 'bootstrapping'. During the bootstrapping phase for a node, below happens in the background:

1. Create a PSSession to the remote nodes (supplying credentials is supported).
It will also store the Node's PSSession, Credential information in a hashtable.
Expand Down
4 changes: 2 additions & 2 deletions docs/Quick-Start.-Installation-and-Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
Get-Command -Module PSRemotely
# Get help for the module and a command
Get-Help Invoke-PSRemotely -full # *.tests.ps1 based operation validation
Get-Help Invoke-PSRemotely -full # *.PSRemotely.ps1 based operation validation
```

### PSRemotely Example

All you need is a *.Tests.ps1 file that tell PSRemotely about your remote operation validation. Here's a quick example.
All you need is a *.PSRemotely.ps1 file that tell PSRemotely about your remote operation validation. Here's a quick example.


Here's my sample.PSRemotely.ps1 file
Expand Down

0 comments on commit e36b812

Please sign in to comment.