Add DotnetTLS Pester test

This commit is contained in:
Vladimir Safonkin
2020-07-13 16:17:49 +03:00
parent 0c66b7b8ad
commit 0c57e97fb8
5 changed files with 10 additions and 31 deletions

View File

@@ -694,12 +694,6 @@
"{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -693,12 +693,6 @@
"{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -15,4 +15,5 @@ if(Test-Path $registryPath){
Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD
}
Invoke-PesterTests -TestFile "Tools" -TestName "DotnetTLS"

View File

@@ -1,18 +0,0 @@
################################################################################
## File: Validate-DotnetTLS.ps1
## Desc: Validate DotNetFramework security protocol to TLS 1.2
################################################################################
$protocols = [Net.ServicePointManager]::SecurityProtocol
$protocolArr = $protocols -split ', '
if ($protocolArr.Contains('Tls12'))
{
Write-Host 'Tls 1.2 has been enabled.'
}
else
{
Write-Host 'Tls 1.2 has not been enabled.'
exit 1
}

View File

@@ -15,3 +15,11 @@ Describe "Kind" {
"kind version" | Should -ReturnZeroExitCode
}
}
Describe "DotnetTLS" {
It "Tls 1.2 is enabled" {
$protocols = [Net.ServicePointManager]::SecurityProtocol
$protocolArr = $protocols -split ', '
$protocolArr.Contains('Tls12') | Should -BeTrue
}
}