Skip to content

Commit 6d15547

Browse files
committedMay 4, 2017
[skip ci] Adds node based targeting doc
1 parent 0fa4f9b commit 6d15547

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
 

‎docs/PSRemotely-Node-Based-Target.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Using Node keyword to target different types of Nodes in a solution.
2+
3+
This is a most common pattern while writing remote operations validation tests for a solution nowadays.
4+
For example take a converged infrastructure solution, this solution comprises of both compute and storage nodes deployed as part of the solution. You could have two separate files with the validations for the two types of servers in the solution, but there is a cleaner way to handle this.
5+
PSRemotely let's you organize the tests targeted to an entire solution together in one file by making use of the Node keyword.
6+
7+
Node keyword is used to target and organize your tests based on some environment specific data, it is very similar to the Node keyword in the DSC.
8+
Please see below environment configuration data where in the node configuration data there is an attribute called **type** which defines whether the node is a compute or storage node.
9+
10+
```powershell
11+
# Configuration data for a Converged Infrastructure solution. There are both compute and storage nodes here.
12+
$ConfigData = @{
13+
AllNodes = @(
14+
@{
15+
# common node information hashtable
16+
NodeName = '*'; # do not edit
17+
Domain = 'dexter.lab'
18+
},
19+
@{
20+
# Individual node information hashtable for storage node
21+
NodeName = 'StorageNode1'
22+
Type = 'Storage'
23+
},
24+
@{
25+
NodeName = 'StorageNode2'
26+
Type = 'Storage'
27+
},
28+
@{
29+
NodeName = 'ComputeNode2'
30+
Type = 'Compute'
31+
},
32+
@{
33+
NodeName = 'ComputeNode2'
34+
Type = 'Compute'
35+
},
36+
@{
37+
NodeName = 'ComputeNode3'
38+
Type = 'Compute'
39+
},
40+
@{
41+
NodeName = 'ComputeNode4'
42+
Type = 'Compute'
43+
}
44+
)
45+
}
46+
```
47+
48+
We can use two different Node blocks to organize tests targeted to the compute and storage nodes in a single file.
49+
50+
```powershell
51+
# Using the PSRemotely DSL to organize tests in a single file for the CI solution. See that configuration data hashtable can be specified to PSRemotely directly here.
52+
PSRemotely -ConfigurationData $ConfigData {
53+
54+
Node $AllNodes.Where({$PSItem.Type -eq 'Compute'}).NodeName {
55+
# Houses Ops validation for the compute nodes
56+
Describe 'Compute node tests' {
57+
# place tests here
58+
}
59+
}
60+
61+
Node $AllNodes.Where({$PSItem.Type -eq 'Storage'}).NodeName {
62+
# Houses Ops validation for the compute nodes
63+
Describe 'Storage node tests' {
64+
# place tests here
65+
}
66+
}
67+
}
68+
69+
```
70+
71+
Save the above code snippets in a file with a .PSRemotely.ps1 extension and you are all set.

‎mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pages:
1818
- Using IPv6 Address for node name : Example-Ipv6-Address.md
1919
- Using PreferNodeProperty parameter : Example-PreferNodeProperty.md
2020
- How Do I...:
21+
- Target different types of Nodes in a solution: PSRemotely-Node-Based-Target.md
2122
- Invoke PSRemotely: Invoke-PSRemotely.md
2223
- TroubleShoot : PSRemotely.TroubleShoot.md
2324
- Copy Artifacts to PSRemotely Nodes: PSRemotely.Artifacts.md

0 commit comments

Comments
 (0)