MSFT_xExchOwaVirtualDirectory: New resource proposal: Add Property SetPhotoEnabled
RenatoMorenoR opened this issue Β· 39 comments
Description
The objective is to include this property in the resource to maintain only the dependency of this one in the cookbook and not to have to create another powershell resource to only activate or deactivate that option.
Proposed properties
SetPhotoEnabled = [System.Boolean] $OwaVdir. SetPhotoEnabled
[Parameter()]
[System.Boolean]
$SetPhotoEnabled,
Special considerations or limitations
I am working on it
Hi @SSvilen, @mhendric, @johlju I made this PR to validate the option to add a new property to a resource, but every time I want to test the code, either locally or in azure, it results in errors.
At one point I thought it was the code added, but then I commented all the code and just left the changes in the Changelog and I get the same errors.
Can someone help me to identify the error?
Thank you very much for your help and we are very interested to start supporting this project.
@RenatoMorenoR thanks for reaching out! This project have not been updated to pin the version of Pester to use. Pester 5 was released and is a breaking change, so we need to pin 4.10.1
. In this row change latest
to 4.10.1
:
thanks @johlju I try with that π
After that, remove the output/RequiredModules/Pester
folder and run .\build.ps1 -ResolveDependency -Tasks noop
to get the correct version of pester.
Also remove Pester from the session Remove-Module Pester
or start a new session.
Hi @SSvilen, @mhendric, @johlju what do you think about this little change?
What chance we have to pass into a new release?
Thanks a lot...
cc: @mhincapie
Thank you @RenatoMorenoR
This would be a really nice addition to the repo
I'm not working with MS any longer, but I can see if I can reach out. Can I suggest a "workaround"? π I'm not too familiar with Exchange stuff so if you who commented on this PR do a functionality review for PR's needing review (like @RenatoMorenoR's and @SSvilen's PR), I can do the style review and then I can merge.
I think it is possible to run integration tests locally in a lab, but haven't done so myself. But if someone could do that to verify functionality for the PRs too it would help so we don't break anything. Anyone up for that?
I can review this PR and someone else can review mine.
My Exchange Lab is no longer functioning, but I can do some testing (may be next week).
Hey @SSvilen . Sorry for not responding on this one. I unfortunately haven't been doing any on-prem work since starting a new job a little over a year ago. I no longer have an on-prem Exchange lab to test in either. If there's any specific questions I can answer to help unblock this, please let me know. But I don't imagine I will have the time or resources to maintain this (or other DSC modules) at the time. If you can find a PR buddy that can help with code reviews, that may be best.
Hi @SSvilen, I can help too.
You let me know and I will be happy to support this project.
Hey @SSvilen , @mhincapie , and @RenatoMorenoR , as @johlju mentioned above, any of you should be able to run the Integration tests that are part of the module within your labs. The key requirements are that you have 1 DC, and 2 Exchange Servers that are cluster ready. Invoking the integration tests should prompt you for key details that allow the tests to run. I'd recommend that at least someone sets up their lab to run these, and verifies that they run successfully BEFORE making any changes. Then try again post the changes. Let me know if you have any questions on the integration test.
Hi @mhendric, @SSvilen, @mhincapie, @johlju we have one environment with 3 exchange server 2016 - CU20 and 2 DC.
I runes the tests and every pass without a problem.
What more we need for contribution or Maintaining the code?
The only thing we changed, are the version for the Sampler module to "0.109.1", the last one break the test
Thanks!!
@RenatoMorenoR running ./build.ps1 -task test
runs only the unit tests. Running the integration tests must be done manually as the make changes in the environment and should run π₯ in a lab that can be rebuilt/destroyed π₯ for each test run (like revert to snapshots).
I have not run the integration tests for this module but the should either be started with:
./build.ps1 -Tasks test -PesterScript ./tests/Integration -CodeCoverageThreshold 0
or
./build.ps1 -task noop
Invoke-Pester ./tests/Integration/
Remember that integration tests do actual changes in the environment they are run! Unit tests just mock the changes., so they are safer to run in a dev environment.
Thanks @johlju, we try to resolve that, first we created the environment and now we are working to run the integration test without lost everything.
I let you know the advance
Hi @johlju, @SSvilen, @mhendric we have been working with different environments but we always have the same result when trying to do the integration tests.
This environment is created in AWS with the exchange template that has 2 exchange nodes in high availability, 1 dc, 1 fileserver, etc..
Can anyone help us to identify what we are missing?
NUnitXml_xExchange_v0.0.1.Windows.PSv.5.1.14393.4402.txt
CodeCov_xExchange_v0.0.1.Windows.PSv.5.1.14393.4402.txt
PesterObject_xExchange_v0.0.1.Windows.PSv.5.1.14393.4402.txt
Really thank to all
@RenatoMorenoR I'll take a loon on Wednesday, when I'm back in the office.
Unfortunately, I'm about to do a career switch, so Exchange will not longer be something I'll work with.
Although I would like to help, I'll not have the time to support that PS DSC Module.
Here is what I found:
MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1
<message>Cannot find an object with identity: 'DAG' under: 'DC=exc,DC=com'.</message>
<stack-trace>at <ScriptBlock>, C:\src\xExchange\tests\Integration\MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1: line 36</stack-trace>
You need to precreate the coumputer account "DAG" for the test to pass. Get-ADComputer is a very unfortunate command, probably it makes sense to replace it with get-adobject.
MSFT_xExchExchangeServer.Integration.Tests.ps1
<message>Expected $true, but got $false.</message>
<stack-trace>at <ScriptBlock>, C:\src\xExchange\tests\Integration\MSFT_xExchExchangeServer.Integration.Tests.ps1: line 67 67: [System.String]::IsNullOrEmpty($getResult.InternetWebProxy) | Should Be $true</stack-trace>
Looks like InternetWebProxy is set for your test server.
MSFT_xExchFrontendTransportService.Integration.Tests.ps1
Looks like MaxConnectionRatePerMinute has different values in $testParams and $expectedGetResults
MSFT_xExchMailboxDatabase.Integration.Tests.ps1
Line 105 should be (not a comma, but a dot as delimiter) :
ProhibitSendReceiveQuota = '1.5 GB'
Then something wierd happens on line 210. Can you debug and see what values the hashtables $testParams and $expectedGetResults contains.
Line 289 - Can you actually check that on exchange server '10240MB' and '10GB' are actually equal?
Just try to set ProhibitSendReceiveQuota on some test DB with those values and see if they are actually the same at the end.
MSFT_xExchMaintenanceMode.Integration.Tests.ps1
The term 'Update-MailboxDatabaseCopy' is not recognized as the name of a cmdlet, function, script file, or operable program.
Looks like the command is not loaded at all. Line 328 should be changed.
MSFT_xExchReceiveConnector.Integration.Tests.ps1
I'm not quite sure, what the purpose of that test is. It will always fail.
Context 'When Get-ReceiveConnector is called and the connector is absent' {
It 'Should not cause an error to be logged in the event log' {
Get-EventLog -LogName 'MSExchange Management' -After $testStartTime -ErrorAction SilentlyContinue | `
Where-Object -FilterScript { $_.Message -like '*Cmdlet failed. Cmdlet Get-ReceiveConnector, parameters -Identity*' } |`
Should -Be $null
}
}
xExchangeCommon.Integration.Tests.ps1
The function Remove-RemoteExchangeModule in xExchangeHelper.psm1 should be changed to remove the module and the session
Remove-PSSession -Name 'DSCExchangeSession' -ErrorAction SilentlyContinue
Hi @SSvilen will try to following all step you mention, and let you know we change the dependency for older version and make sure all of then are from the same date for resolve some issues and we get the same result.
Sampler = β0.99.0β
invokeBuild = 'latest'
PSScriptAnalyzer = 'latest'
pester = '4.10.0'
Plaster = 'latest'
ModuleBuilder = '1.0.0'
MarkdownLinkCheck = 'latest'
ChangelogManagement = 'latest'
'DscResource.Test' = '0.14.1'
'DscResource.AnalyzerRules' = 'latest'
xDscResourceDesigner = 'latest'
'DscResource.Common' = '0.9.3'
'xPendingReboot' = '0.4.0'
'xWebAdministration' = '3.1.1'
But thanks a lot for your time on this.
Hi @SSvilen @mhendric @johlju I need your help, I have already managed to run almost all the integration tests, but when the system tries to modify the properties of the created database, no change is made and that is why all the tests fail.
What configuration did you handle in the DAG? is there any configuration needed in the environment to take those changes?
I am asking for your help as I have been stuck with this for a couple of weeks.
Thank you very much.
# Now change properties on the test database
$testParams.AllowFileRestore = $false
$testParams.CalendarLoggingQuota = '30mb'
$testParams.CircularLoggingEnabled = $false
$testParams.DeletedItemRetention = '15.00:00:00'
$testParams.EventHistoryRetentionPeriod = '04:05:06'
$testParams.IsExcludedFromProvisioning = $true
$testParams.IsSuspendedFromProvisioning = $true
$testParams.JournalRecipient = $null
$testParams.MailboxRetention = '31.00:00:00'
$testParams.MountAtStartup = $false
$testParams.RetainDeletedItemsUntilBackup = $true
$testParams.IssueWarningQuota = '28 MB'
$testParams.ProhibitSendQuota = '2GB'
$testParams.ProhibitSendReceiveQuota = '2.5 GB'
$testParams.RecoverableItemsQuota = '2 GB'
$testParams.RecoverableItemsWarningQuota = '1.5 GB'
$expectedGetResults.AllowFileRestore = $false
$expectedGetResults.CalendarLoggingQuota = '30 MB (31,457,280 bytes)'
$expectedGetResults.CircularLoggingEnabled = $false
$expectedGetResults.DeletedItemRetention = '15.00:00:00'
$expectedGetResults.EventHistoryRetentionPeriod = '04:05:06'
$expectedGetResults.IsExcludedFromProvisioning = $true
$expectedGetResults.IsSuspendedFromProvisioning = $true
$expectedGetResults.JournalRecipient = ''
$expectedGetResults.MailboxRetention = '31.00:00:00'
$expectedGetResults.MountAtStartup = $false
$expectedGetResults.RetainDeletedItemsUntilBackup = $true
$expectedGetResults.IssueWarningQuota = '28 MB (29,360,128 bytes)'
$expectedGetResults.ProhibitSendQuota = '2 GB (2,147,483,648 bytes)'
$expectedGetResults.ProhibitSendReceiveQuota = '2.5 GB (2,684,354,560 bytes)'
$expectedGetResults.RecoverableItemsQuota = '2 GB (2,147,483,648 bytes)'
$expectedGetResults.RecoverableItemsWarningQuota = '1.5 GB (1,610,612,736 bytes)'
$serverVersion = Get-ExchangeVersionYear
if ($serverVersion -in '2013', '2016')
{
$testParams.Add('IndexEnabled', $false)
$expectedGetResults.Add('IndexEnabled', $false)
}
if ($serverVersion -in '2016', '2019')
{
$testParams.Add('IsExcludedFromProvisioningByOperator', $true)
$expectedGetResults.Add('IsExcludedFromProvisioningByOperator', $true)
$testParams.Add('IsExcludedFromProvisioningDueToLogicalCorruption', $true)
$expectedGetResults.Add('IsExcludedFromProvisioningDueToLogicalCorruption', $true)
$testParams.Add('IsExcludedFromProvisioningReason', 'Testing Excluding the Database')
$expectedGetResults.Add('IsExcludedFromProvisioningReason', 'Testing Excluding the Database')
}
if ($serverVersion -in '2019')
{
$testParams.Add('MetaCacheDatabaseMaxCapacityInBytes', 1073741824)
$expectedGetResults.Add('MetaCacheDatabaseMaxCapacityInBytes', 1073741824)
}
Test-TargetResourceFunctionality -Params $testParams -ContextLabel 'Change many DB properties' -ExpectedGetResults $expectedGetResults
Hi @SSvilen @mhendric @johlju I need your help, I have solved the problem with the database, the problem was with a module in the DAG test had an incorrect location, I have changed the location and it was solved, but when the DAG test tries to add a new one this error is presented
$dagMemberTestParams = @{
MailboxServer = $env:COMPUTERNAME
Credential = $shellCredentials
DAGName = $dagName
DomainController = $dcToTestAgainst
SkipDagValidation = $true
}
$dagMemberExpectedGetResults = @{
MailboxServer = $env:COMPUTERNAME
DAGName = $dagName
}
Test-TargetResourceFunctionality -Params $dagMemberTestParams `
-ContextLabel 'Add first member to the test DAG' `
-ExpectedGetResults $dagMemberExpectedGetResults
<test-suite type="TestFixture" name="Verify DatabaseAvailabilityGroupIpAddresses" executed="True" result="Success" success="True" time="0.4854" asserts="0" description="Verify DatabaseAvailabilityGroupIpAddresses">
<results>
<test-case description="DatabaseAvailabilityGroupIpAddresses should contain two values" name="Test Creating and Modifying a DAG, adding DAG members, creating a DAG database, and adding database copies.Verify DatabaseAvailabilityGroupIpAddresses.DatabaseAvailabilityGroupIpAddresses should contain two values" time="0.0042" asserts="0" success="True" result="Success" executed="True" />
</results>
</test-suite>
<test-suite type="TestFixture" name="Add first member to the test DAG" executed="True" result="Failure" success="False" time="5.1544" asserts="0" description="Add first member to the test DAG">
<results>
<test-case description="Error occurred in Context block" name="Test Creating and Modifying a DAG, adding DAG members, creating a DAG database, and adding database copies.Add first member to the test DAG.Error occurred in Context block" time="0" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Either the GetResult or GetTargetResourceParams parameters must be specified with non-empty hashtables, but not both.</message>
<stack-trace>At C:\src\xExchange\tests\TestHelpers\xExchangeTestHelper.psm1:182 char:9</stack-trace>
</failure>
</test-case>
</results>
</test-suite>
<test-suite type="TestFixture" name="Add second member to the test DAG" executed="True" result="Failure" success="False" time="4.6703" asserts="0" description="Add second member to the test DAG">
<results>
<test-case description="Error occurred in Context block" name="Test Creating and Modifying a DAG, adding DAG members, creating a DAG database, and adding database copies.Add second member to the test DAG.Error occurred in Context block" time="0" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Either the GetResult or GetTargetResourceParams parameters must be specified with non-empty hashtables, but not both.</message>
<stack-trace>At C:\src\xExchange\tests\TestHelpers\xExchangeTestHelper.psm1:182 char:9</stack-trace>
</failure>
</test-case>
</results>
</test-suite>
Thanks
RM
Hello @RenatoMorenoR ,
replace DAGName with just 'Name' and try again.
Name = $dagName
Thank you very much, I will try that
Hi @SSvilen, @johlju , @mhendric I have attached the print screen and result.
This took more time than we expected because I only work two days during the week, but finally, now it's all working. I can help if you want with contributions.
Please let me know if you need anything else, and looking forward to being merged.
Archive.zip
@johlju was wondering if you needed anything else to merge? Please let us know as this is something we all would like to utilize. thank you for all this work @RenatoMorenoR
@johlju sorry to bother you was wondering if there was anything we should do to merge this proposed change?. We have a few MR we would like to make also moving forward especially with the new security improvements that Microsoft is making in the new CU's.
I will try to get some time to look at the PR.
The trouble is that I wonβt have time to run integration tests for this module, but maybe someone have already run the integration tests in a local lab environment that confirms the the proposed change works?
Since it seems you in this thread have run the integration tests... Does anyone have the steps written down? It would be awesome to have those added to the CONTRIBUTING.md - they don't need to be perfect, but something that the community can enhance on. I created issue #467 to track it.