@@ -180,9 +180,9 @@ resources:
180
180
$LASTEXITCODE | Should - Be 0
181
181
}
182
182
183
- It ' resource tracing shows up' {
183
+ It ' resource tracing shows up' - Skip:( ! $IsWindows ) {
184
184
# Assumption here is that DSC/PowerShellGroup provider is visible
185
- dsc - l trace resource list 2> $TestDrive / tracing.txt
185
+ dsc - l trace resource list * - a * PowerShell * 2> $TestDrive / tracing.txt
186
186
" $TestDrive /tracing.txt" | Should - FileContentMatchExactly ' PSModulePath'
187
187
$LASTEXITCODE | Should - Be 0
188
188
}
@@ -215,4 +215,60 @@ resources:
215
215
$err.Length | Should -Not - Be 0
216
216
$LASTEXITCODE | Should - Be 4
217
217
}
218
+
219
+ It ' verify `dsc resource list` and `dsc resource list *`' {
220
+ # return all native resources, providers, but not adapter-based resources;
221
+ # results for `dsc resource list` and `dsc resource list *` should be the same
222
+ $a = dsc resource list -f json
223
+ $b = dsc resource list ' *' -f json
224
+ $a.Count | Should - Be $b.Count
225
+ 0 .. ($a.Count - 1 ) | % {
226
+ $a_obj = $a [$_ ] | ConvertFrom-Json
227
+ $b_obj = $b [$_ ] | ConvertFrom-Json
228
+ $a_obj.type | Should - Be $b_obj.type
229
+ # adapter-based resources should Not be in the results
230
+ $a_obj.requireAdapter | Should - BeNullOrEmpty
231
+ $b_obj.requireAdapter | Should - BeNullOrEmpty
232
+ }
233
+ }
234
+
235
+ It ' verify `dsc resource list resource_filter`' {
236
+ # same as previous but also apply resource_filter filter
237
+ $a = dsc resource list ' Test*' -f json
238
+ 0 .. ($a.Count - 1 ) | % {
239
+ $a_obj = $a [$_ ] | ConvertFrom-Json
240
+ $a_obj.type.StartsWith (" Test" ) | Should - Be $true
241
+ # adapter-based resources should Not be in the results
242
+ $a_obj.requireAdapter | Should - BeNullOrEmpty
243
+ }
244
+ }
245
+
246
+ It ' verify `dsc resource list * -a *`' {
247
+ # return all adapter-based resources
248
+ $a = dsc resource list ' *' - a ' *' -f json
249
+ 0 .. ($a.Count - 1 ) | % {
250
+ $a_obj = $a [$_ ] | ConvertFrom-Json
251
+ $a_obj.requireAdapter | Should -Not - BeNullOrEmpty
252
+ $a_obj.kind | Should - Be " Resource"
253
+ }
254
+ }
255
+
256
+ It ' verify `dsc resource list * adapter_filter`' {
257
+ # return all resources of adapters that match adapter_filter filter
258
+ $a = dsc resource list ' *' - a Test* -f json | ConvertFrom-Json
259
+ foreach ($r in $a ) {
260
+ $r.requireAdapter.StartsWith (" Test" ) | Should - Be $true
261
+ $r.kind | Should - Be " Resource"
262
+ }
263
+ }
264
+
265
+ It ' verify `dsc resource list resource_filter adapter_filter`' {
266
+ # same as previous but also apply resource_filter filter to resource types
267
+ $a = dsc resource list * TestResource2 - a * TestGroup -f json | ConvertFrom-Json
268
+ $a.Count | Should - Be 1
269
+ $r = $a [0 ]
270
+ $r.requireAdapter | Should -Not - BeNullOrEmpty
271
+ $r.requireAdapter.StartsWith (" Test" ) | Should - Be $true
272
+ $r.kind | Should - Be " Resource"
273
+ }
218
274
}
0 commit comments