@@ -2816,7 +2816,7 @@ Describe 'SqlServerDsc.Common\Restart-ReportingServicesService' -Tag 'RestartRep
28162816 }
28172817 }
28182818
2819- Context ' When restarting a Report Services default instance ' {
2819+ Context ' When restarting a Report Services service name is supplied ' {
28202820 BeforeAll {
28212821 $mockServiceName = ' ReportServer'
28222822 $mockDependedServiceName = ' DependentService'
@@ -2831,94 +2831,17 @@ Describe 'SqlServerDsc.Common\Restart-ReportingServicesService' -Tag 'RestartRep
28312831 }
28322832
28332833 It ' Should restart the service and dependent service' {
2834- $null = Restart-ReportingServicesService - InstanceName ' MSSQLSERVER'
2835-
2836- Should - Invoke - CommandName Get-Service - ParameterFilter {
2837- $Name -eq $mockServiceName
2838- } - Scope It - Exactly - Times 1
2839- Should - Invoke - CommandName Stop-Service - Scope It - Exactly - Times 1
2840- Should - Invoke - CommandName Start-Service - Scope It - Exactly - Times 2
2841- }
2842- }
2843-
2844- Context ' When restarting a SQL Server 2017 (or newer) Report Services' {
2845- BeforeAll {
2846- $mockServiceName = ' SQLServerReportingServices'
2847- $mockDependedServiceName = ' DependentService'
2848-
2849- $mockDynamicServiceName = $mockServiceName
2850- $mockDynamicDependedServiceName = $mockDependedServiceName
2851- $mockDynamicServiceDisplayName = ' Reporting Services'
2852-
2853- Mock - CommandName Stop-Service
2854- Mock - CommandName Start-Service
2855- Mock - CommandName Get-Service - MockWith $mockGetService
2856- }
2857-
2858- It ' Should restart the service and dependent service' {
2859- $null = Restart-ReportingServicesService - InstanceName ' SSRS'
2860-
2861- Should - Invoke - CommandName Get-Service - ParameterFilter {
2862- $Name -eq $mockServiceName
2863- } - Scope It - Exactly - Times 1
2864- Should - Invoke - CommandName Stop-Service - Scope It - Exactly - Times 1
2865- Should - Invoke - CommandName Start-Service - Scope It - Exactly - Times 2
2866- }
2867- }
2868-
2869- Context ' When restarting a Report Services named instance' {
2870- BeforeAll {
2871- $mockServiceName = ' ReportServer$TEST'
2872- $mockDependedServiceName = ' DependentService'
2873-
2874- $mockDynamicServiceName = $mockServiceName
2875- $mockDynamicDependedServiceName = $mockDependedServiceName
2876- $mockDynamicServiceDisplayName = ' Reporting Services (TEST)'
2877-
2878- Mock - CommandName Stop-Service
2879- Mock - CommandName Start-Service
2880- Mock - CommandName Get-Service - MockWith $mockGetService
2881- }
2882-
2883- It ' Should restart the service and dependent service' {
2884- $null = Restart-ReportingServicesService - InstanceName ' TEST'
2885-
2886- Should - Invoke - CommandName Get-Service - ParameterFilter {
2887- $Name -eq $mockServiceName
2888- } - Scope It - Exactly - Times 1
2889- Should - Invoke - CommandName Stop-Service - Scope It - Exactly - Times 1
2890- Should - Invoke - CommandName Start-Service - Scope It - Exactly - Times 2
2891- }
2892- }
2893-
2894- Context ' When restarting a Report Services named instance using a wait timer' {
2895- BeforeAll {
2896- $mockServiceName = ' ReportServer$TEST'
2897- $mockDependedServiceName = ' DependentService'
2898-
2899- $mockDynamicServiceName = $mockServiceName
2900- $mockDynamicDependedServiceName = $mockDependedServiceName
2901- $mockDynamicServiceDisplayName = ' Reporting Services (TEST)'
2902-
2903- Mock - CommandName Start-Sleep
2904- Mock - CommandName Stop-Service
2905- Mock - CommandName Start-Service
2906- Mock - CommandName Get-Service - MockWith $mockGetService
2907- }
2908-
2909- It ' Should restart the service and dependent service' {
2910- $null = Restart-ReportingServicesService - InstanceName ' TEST' - WaitTime 1
2834+ $null = Restart-ReportingServicesService - ServiceName ' ReportServer'
29112835
29122836 Should - Invoke - CommandName Get-Service - ParameterFilter {
29132837 $Name -eq $mockServiceName
29142838 } - Scope It - Exactly - Times 1
29152839 Should - Invoke - CommandName Stop-Service - Scope It - Exactly - Times 1
29162840 Should - Invoke - CommandName Start-Service - Scope It - Exactly - Times 2
2917- Should - Invoke - CommandName Start-Sleep - Scope It - Exactly - Times 1
29182841 }
29192842 }
29202843
2921- Context ' When restarting a Report Services service name is supplied ' {
2844+ Context ' When restarting a Report Services service with wait timer ' {
29222845 BeforeAll {
29232846 $mockServiceName = ' ReportServer'
29242847 $mockDependedServiceName = ' DependentService'
@@ -2927,21 +2850,22 @@ Describe 'SqlServerDsc.Common\Restart-ReportingServicesService' -Tag 'RestartRep
29272850 $mockDynamicDependedServiceName = $mockDependedServiceName
29282851 $mockDynamicServiceDisplayName = ' Reporting Services (MSSQLSERVER)'
29292852
2853+ Mock - CommandName Start-Sleep
29302854 Mock - CommandName Stop-Service
29312855 Mock - CommandName Start-Service
29322856 Mock - CommandName Get-Service - MockWith $mockGetService
29332857 }
29342858
2935- It ' Should restart the service and dependent service' {
2936- $null = Restart-ReportingServicesService - ServiceName ' ReportServer'
2859+ It ' Should restart the service and dependent service with wait time ' {
2860+ $null = Restart-ReportingServicesService - ServiceName ' ReportServer' - WaitTime 1
29372861
29382862 Should - Invoke - CommandName Get-Service - ParameterFilter {
29392863 $Name -eq $mockServiceName
29402864 } - Scope It - Exactly - Times 1
29412865 Should - Invoke - CommandName Stop-Service - Scope It - Exactly - Times 1
29422866 Should - Invoke - CommandName Start-Service - Scope It - Exactly - Times 2
2867+ Should - Invoke - CommandName Start-Sleep - Scope It - Exactly - Times 1
29432868 }
2944-
29452869 }
29462870}
29472871
0 commit comments