Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# Module removed due to #4272
# disabling tests

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

return

Set-Variable dateInFuture -Option Constant -Value "12/12/2036 09:00"
Expand Down Expand Up @@ -1557,4 +1560,3 @@ try {
finally {
$global:PSDefaultParameterValues = $originalDefaultParameterValues
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Import-Module (Join-Path -Path $PSScriptRoot '..\Microsoft.PowerShell.Security\certificateCommon.psm1')

Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnWindows" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Import-Module (Join-Path -Path $PSScriptRoot 'certificateCommon.psm1') -Force

Describe "CmsMessage cmdlets and Get-PfxCertificate basic tests" -Tags "CI" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Describe "Get-Credential Test" -Tag "CI" {
BeforeAll {
$th = New-TestHost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,50 @@
# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution is in the form of a hashtable containing all the information
# gathered from the GetScript execution.
function Get-TargetResource
{
function Get-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Text
)

$result = @{
Text = "Hello from Get!";
}
$result;
Text = "Hello from Get!"
}

$result
}

# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript,
# the SetScript notifies the PS Infrastructure by setting the variable $DSCMachineStatus.IsRestartRequired to $true.
function Set-TargetResource
{
function Set-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
$path = "$env:SystemDrive\dscTestPath\hello1.txt"
New-Item -Path $path -Type File -Force
Add-Content -Path $path -Value $text
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Text
)
$path = "$env:SystemDrive\dscTestPath\hello1.txt"
New-Item -Path $path -Type File -Force
Add-Content -Path $path -Value $text
}

# The Test-TargetResource cmdlet is used to validate the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution should be true if the DSC managed machine is in the desired state
# or else false should be returned.
function Test-TargetResource
{
function Test-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
$false
$Text
)
$false
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,51 @@
# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution is in the form of a hashtable containing all the information
# gathered from the GetScript execution.
function Get-TargetResource
{
function Get-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Text
)

$result = @{
Text = "Hello from Get!";
}
$result;
}
Text = "Hello from Get!"
}

$result
}

# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript,
# the SetScript notifies the PS Infrastructure by setting the variable $DSCMachineStatus.IsRestartRequired to $true.
function Set-TargetResource
{
function Set-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Text
)

$path = "$env:SystemDrive\dscTestPath\hello2.txt"
New-Item -Path $path -Type File -Force
Add-Content -Path $path -Value $text
$path = "$env:SystemDrive\dscTestPath\hello2.txt"
New-Item -Path $path -Type File -Force
Add-Content -Path $path -Value $text
}

# The Test-TargetResource cmdlet is used to validate the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution should be true if the DSC managed machine is in the desired state
# or else false should be returned.
function Test-TargetResource
{
function Test-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
$false
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Text
)
$false
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,51 @@
# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution is in the form of a hashtable containing all the information
# gathered from the GetScript execution.
function Get-TargetResource
{
function Get-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
$Text
)

$result = @{
Text = "Hello from Get!";
}
$result;
}
Text = "Hello from Get!"
}

$result
}

# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript,
# the SetScript notifies the PS Infrastructure by setting the variable $DSCMachineStatus.IsRestartRequired to $true.
function Set-TargetResource
{
function Set-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
$Text
)

$path = "$env:SystemDrive\dscTestPath\hello3.txt"
New-Item -Path $path -Type File -Force
Add-Content -Path $path -Value $text
$path = "$env:SystemDrive\dscTestPath\hello3.txt"
New-Item -Path $path -Type File -Force
Add-Content -Path $path -Value $text
}

# The Test-TargetResource cmdlet is used to validate the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution should be true if the DSC managed machine is in the desired state
# or else false should be returned.
function Test-TargetResource
{
function Test-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$text
)
$false
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Text
)
$false
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Function New-GoodCertificate
{
<#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Describe "ConvertTo--SecureString" -Tags "CI" {

Context "Checking return types of ConvertTo--SecureString" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Describe "WSMan Config Provider" -Tag Feature,RequireAdminOnWindows {
BeforeAll {
#skip all tests on non-windows platform
Expand Down
5 changes: 4 additions & 1 deletion test/powershell/engine/Api/Serialization.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Describe "Serialization Tests" -tags "CI" {
BeforeAll {
$testfileName="SerializationTest.txt"
Expand Down Expand Up @@ -99,4 +103,3 @@ Describe "Serialization Tests" -tags "CI" {
SerializeAndDeserialize($versionObject).TestScriptProperty | Should -Be $versionObject.TestScriptProperty
}
}

3 changes: 3 additions & 0 deletions test/powershell/engine/Remoting/PSSession.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# PSSession tests for non-Windows platforms
#

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

function GetRandomString()
{
return [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetRandomFileName())
Expand Down
3 changes: 3 additions & 0 deletions test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Import-Module HelpersCommon

function GetRandomString()
Expand Down
4 changes: 4 additions & 0 deletions test/tools/Modules/WebListener/WebListener.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
param()

Class WebListener
{
[int]$HttpPort
Expand Down
2 changes: 2 additions & 0 deletions tools/WindowsCI.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function New-LocalUser
.OUTPUTS
.NOTES
#>
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUsernameAndPasswordParams', '')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
param(
[Parameter(Mandatory=$true)]
[string] $username,
Expand Down
3 changes: 3 additions & 0 deletions tools/ci.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()

Set-StrictMode -Version 3.0

$ErrorActionPreference = 'continue'
Expand Down
Loading