Skip to content

Instantly share code, notes, and snippets.

View chriskuech's full-sized avatar

Chris Kuech chriskuech

  • Datum Source, ex MSFT
View GitHub Profile
$prefix = "kv" # use a prefix to ensure valid hostname
$suffix = "$(New-Guid)" -replace "-"
$kvName = "$prefix$suffix".Substring(0, 24)
Select-ClusterSetPartialConfig ".\Configs" "PROD-EU-NorthEurope" `
| Sort-Object `
| % {$_ | Get-Content | ConvertFrom-Json} `
| Merge-Object -Strategy Override
Select-ClusterSetPartialConfig ".\Configs" "PROD-EU-NorthEurope" `
| % {$_ | Get-Content | ConvertFrom-Json} `
| Merge-Object -Strategy Fail
function Select-ClusterSetPartialConfig([string]$Container, [string[]]$Vector) {
$clusterId = $Vector -join "-"
Get-ChildItem $Container `
| ? {$clusterId -like ($_.BaseName -replace "_", "*")}
}
function Convert-ClusterSetIdentityToFileName([string[]]$Vector) {
"$($Vector -join "-").json"
}
function Select-ClusterSetConfig([string]$Container, [string[]]$Vector) {
Get-Item "$Container/$($Vector -join "-").json"
}
Install-Module Pester
Import-Module $PSScriptRoot -Force
Import-Module MyModule -Force
Import-Module MyModule
@($tested), @($expected) | Test-Equality | Should -BeTrue