@@ -5,7 +5,7 @@ Describe 'PowerShell adapter resource tests' {
5
5
6
6
BeforeAll {
7
7
if ($isWindows ) {
8
- winrm quickconfig - quiet - force
8
+ # winrm quickconfig -quiet -force
9
9
}
10
10
$OldPSModulePath = $env: PSModulePath
11
11
$env: PSModulePath += [System.IO.Path ]::PathSeparator + $PSScriptRoot
@@ -16,14 +16,14 @@ Describe 'PowerShell adapter resource tests' {
16
16
17
17
It ' Discovery includes class-based and script-based resources ' - Skip:(! $IsWindows ){
18
18
19
- $r = dsc resource list * - a * PowerShell*
19
+ $r = dsc resource list * - a Microsoft.DSC / PowerShell
20
20
$LASTEXITCODE | Should - Be 0
21
21
$resources = $r | ConvertFrom-Json
22
22
($resources | ? {$_.Type -eq ' TestClassResource/TestClassResource' }).Count | Should - Be 1
23
23
($resources | ? {$_.Type -eq ' PSTestModule/TestPSRepository' }).Count | Should - Be 1
24
24
}
25
25
26
- It ' Windows PowerShell adapter supports File resource' - Skip:(! $IsWindows ){
26
+ <# It 'Windows PowerShell adapter supports File resource' -Skip:(!$IsWindows){
27
27
28
28
$r = dsc resource list --adapter Microsoft.Windows/WindowsPowerShell
29
29
$LASTEXITCODE | Should -Be 0
@@ -49,74 +49,73 @@ Describe 'PowerShell adapter resource tests' {
49
49
$LASTEXITCODE | Should -Be 0
50
50
$res = $r | ConvertFrom-Json
51
51
$res.actualState.result.properties.result | Should -Be 'test'
52
- }
52
+ }#>
53
53
54
54
It ' Get works on class-based resource' - Skip:(! $IsWindows ){
55
55
56
- $r = " {'Name':'TestClassResource1', 'Type':'TestClassResource/TestClassResource' }" | dsc resource get - r ' Microsoft.Dsc/PowerShell '
56
+ $r = " {'Name':'TestClassResource1'}" | dsc resource get - r ' TestClassResource/TestClassResource '
57
57
$LASTEXITCODE | Should - Be 0
58
58
$res = $r | ConvertFrom-Json
59
59
$res.actualState.result.properties.Prop1 | Should - BeExactly ' ValueForProp1'
60
60
}
61
61
62
62
It ' Get works on script-based resource' - Skip:(! $IsWindows ){
63
63
64
- $r = " {'Name':'TestPSRepository1','Type':'PSTestModule/TestPSRepository' }" | dsc resource get - r ' Microsoft.Dsc/PowerShell '
64
+ $r = " {'Name':'TestPSRepository1'}" | dsc resource get - r ' PSTestModule/TestPSRepository '
65
65
$LASTEXITCODE | Should - Be 0
66
66
$res = $r | ConvertFrom-Json
67
67
$res.actualState.result.properties.PublishLocation | Should - BeExactly ' https://www.powershellgallery.com/api/v2/package/'
68
68
}
69
69
70
70
It ' Get uses enum names on class-based resource' - Skip:(! $IsWindows ){
71
71
72
- $r = " {'Name':'TestClassResource1','Type':'TestClassResource/TestClassResource' }" | dsc resource get - r ' Microsoft.Dsc/PowerShell '
72
+ $r = " {'Name':'TestClassResource1'}" | dsc resource get - r ' TestClassResource/TestClassResource '
73
73
$LASTEXITCODE | Should - Be 0
74
74
$res = $r | ConvertFrom-Json
75
75
$res.actualState.result.properties.EnumProp | Should - BeExactly ' Expected'
76
76
}
77
77
78
78
It ' Get uses enum names on script-based resource' - Skip:(! $IsWindows ){
79
79
80
- $r = " {'Name':'TestPSRepository1','Type':'PSTestModule/TestPSRepository' }" | dsc resource get - r ' Microsoft.Dsc/PowerShell '
80
+ $r = " {'Name':'TestPSRepository1'}" | dsc resource get - r ' PSTestModule/TestPSRepository '
81
81
$LASTEXITCODE | Should - Be 0
82
82
$res = $r | ConvertFrom-Json
83
83
$res.actualState.result.properties.Ensure | Should - BeExactly ' Present'
84
84
}
85
85
86
- <#
87
86
It ' Test works on class-based resource' - Skip:(! $IsWindows ){
88
87
89
- $r = "{'Name':'TestClassResource1','Prop1':'ValueForProp1','Type':'TestClassResource/TestClassResource' }" | dsc resource test -r 'Microsoft.Dsc/PowerShell '
88
+ $r = " {'Name':'TestClassResource1','Prop1':'ValueForProp1'}" | dsc resource test - r ' TestClassResource/TestClassResource '
90
89
$LASTEXITCODE | Should - Be 0
91
90
$res = $r | ConvertFrom-Json
92
91
$res.actualState.result.properties.InDesiredState | Should - Be $True
93
92
}
94
93
95
94
It ' Test works on script-based resource' - Skip:(! $IsWindows ){
96
95
97
- $r = "{'Name':'TestPSRepository1','PackageManagementProvider':'NuGet','Type':'PSTestModule/TestPSRepository' }" | dsc resource test -r 'Microsoft.Dsc/PowerShell '
96
+ $r = " {'Name':'TestPSRepository1','PackageManagementProvider':'NuGet'}" | dsc resource test - r ' PSTestModule/TestPSRepository '
98
97
$LASTEXITCODE | Should - Be 0
99
98
$res = $r | ConvertFrom-Json
100
99
$res.actualState.result.properties.InDesiredState | Should - Be $True
101
100
}
102
101
103
102
It ' Set works on class-based resource' - Skip:(! $IsWindows ){
104
103
105
- $r = "{'Name':'TestClassResource1','Prop1':'ValueForProp1','Type':'TestClassResource/TestClassResource' }" | dsc resource set -r 'Microsoft.Dsc/PowerShell '
104
+ $r = " {'Name':'TestClassResource1','Prop1':'ValueForProp1'}" | dsc resource set - r ' TestClassResource/TestClassResource '
106
105
$LASTEXITCODE | Should - Be 0
107
106
$res = $r | ConvertFrom-Json
108
- $res.afterState.RebootRequired | Should -Not -BeNull
107
+ $res.afterState.result | Should -Not - BeNull
109
108
}
110
109
111
110
It ' Set works on script-based resource' - Skip:(! $IsWindows ){
112
111
113
- $r = "{'Name':'TestPSRepository1','Type':'PSTestModule/TestPSRepository' }" | dsc resource set -r 'Microsoft.Dsc/PowerShell '
112
+ $r = " {'Name':'TestPSRepository1'}" | dsc resource set - r ' PSTestModule/TestPSRepository '
114
113
$LASTEXITCODE | Should - Be 0
115
114
$res = $r | ConvertFrom-Json
116
- $res.afterState.RebootRequired | Should -Not -BeNull
115
+ $res.afterState.result.properties. RebootRequired | Should -Not - BeNull
117
116
}
118
117
119
- It 'Export works on PS class-based resource' -Skip:(!$IsWindows){
118
+ <# It 'Export works on PS class-based resource' -Skip:(!$IsWindows){
120
119
121
120
$r = dsc resource export -r TestClassResource/TestClassResource
122
121
$LASTEXITCODE | Should -Be 0
0 commit comments