You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 30, 2019. It is now read-only.
$TestMetric=ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"
7
+
8
+
It "Should Return Something" {
9
+
$TestMetric| Should Not BeNullOrEmpty
10
+
}
11
+
It "Should Provide myServer.networkinterface.realtekpciegbefamilycontroller.bytesreceived-sec as Output" {
12
+
$TestMetric| Should MatchExactly "myServer.networkinterface.realtekpciegbefamilycontroller.bytesreceived-sec"
13
+
}
14
+
It "Should Not Contain Left Parentheses" {
15
+
$TestMetric| Should Not Match "\("
16
+
}
17
+
It "Should Not Contain Right Parentheses" {
18
+
$TestMetric| Should Not Match "\)"
19
+
}
20
+
It "Should Not Contain Forward Slash" {
21
+
$TestMetric| Should Not Match "\/"
22
+
}
23
+
It "Should Not Contain Back Slash" {
24
+
$TestMetric| Should Not Match "\\"
25
+
}
26
+
It "Should Contain a Period" {
27
+
$TestMetric| Should Match "\."
28
+
}
29
+
}
30
+
Context "Metric Transformation - Using MetricReplacementHash" {
31
+
32
+
$MockHashTable= [ordered]@{
33
+
"^\\\\"="";
34
+
"\\\\"="";
35
+
"\/"="-";
36
+
":"=".";
37
+
"\\"=".";
38
+
"\("=".";
39
+
"\)"="";
40
+
"\]"="";
41
+
"\["="";
42
+
"\%"="";
43
+
"\s+"="";
44
+
"\.\."=".";
45
+
"_"=""
46
+
}
47
+
48
+
It "Should Return Something" {
49
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should Not BeNullOrEmpty
50
+
}
51
+
It "Should Provide myServer.networkinterface.realtekpciegbefamilycontroller.bytesreceived-sec as Output" {
52
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should MatchExactly "myServer.networkinterface.realtekpciegbefamilycontroller.bytesreceived-sec"
53
+
}
54
+
It "Should Not Contain Left Parentheses" {
55
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should Not Match "\("
56
+
}
57
+
It "Should Not Contain Right Parentheses" {
58
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should Not Match "\)"
59
+
}
60
+
It "Should Not Contain Forward Slash" {
61
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should Not Match "\/"
62
+
}
63
+
It "Should Not Contain Back Slash" {
64
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should Not Match "\\"
65
+
}
66
+
It "Should Contain a Period" {
67
+
ConvertTo-GraphiteMetric-MetricToClean "\\myServer\network interface(realtek pcie gbe family controller)\bytes received/sec"-MetricReplacementHash $MockHashTable| Should Match "\."
$TestMetric=ConvertTo-GraphiteMetric-MetricToClean "\\$($env:COMPUTERNAME)\physicaldisk(1 e:)\avg. disk write queue length"-RemoveUnderscores -NicePhysicalDisks -HostName "my.new.hostname"
95
+
96
+
It "Should Return Something" {
97
+
$TestMetric| Should Not BeNullOrEmpty
98
+
}
99
+
It "Should Return my.new.hostname.physicaldisk.e-drive.diskwritequeuelength as Output" {
100
+
$TestMetric| Should MatchExactly "my.new.hostname.physicaldisk.e-drive.diskwritequeuelength"
101
+
}
102
+
103
+
$TestMetric=ConvertTo-GraphiteMetric-MetricToClean "\\$($env:COMPUTERNAME)\physicaldisk(1 e:)\avg. disk write queue length"-RemoveUnderscores -NicePhysicalDisks -HostName "host_with_underscores"
104
+
105
+
It "Should Return host_with_underscores.physicaldisk.e-drive.diskwritequeuelength as Output when RemoveUnderscores is enabled and host has underscores" {
106
+
$TestMetric| Should MatchExactly "host_with_underscores.physicaldisk.e-drive.diskwritequeuelength"
0 commit comments