Fix for file function with array added. (#136)

This commit is contained in:
Kungumaraj Nachimuthu 2019-09-20 11:13:40 -07:00 коммит произвёл Jorge Cotillo
Родитель d66ef4a76e
Коммит 8e21dc67ec
4 изменённых файлов: 26 добавлений и 2 удалений

Просмотреть файл

@ -190,8 +190,8 @@ Class ConfigurationBuilder {
# Check for json objects before replacing it
$isJson = `
Test-Json `
-Json $referencedFileContent `
Test-JsonContent `
-Content $referencedFileContent `
-ErrorAction SilentlyContinue;
if(!$isJson) {

Просмотреть файл

@ -0,0 +1,7 @@
{
"Subscriptions": "file(common/subscriptions.json)",
"ToolkitComponents": "file(common/toolkit.json)",
"ArchetypeOrchestration": "file(common/toolkit.json)",
"ArchetypeParameters": "file(common/toolkit.json)",
"Arrays": "file(./arrays.json)"
}

Просмотреть файл

@ -0,0 +1 @@
["demo1", "demo2"]

Просмотреть файл

@ -55,4 +55,20 @@ Describe "Orchestration Instance Builder Unit Test Cases" {
$archetypeInstance.Subscriptions | Should be $environmentValue;
}
}
Context "Build Archetype Instance using functions" {
$ENV:FROMENVIRONMENTVARIABLE = "My value";
$ENV:FROMANOTHERENVIRONMENTVARIABLE = "bar";
It "Should build the archetype instance from definition file with file function" {
$archetypeDefinitionFileAbsolutePath = Join-Path $rootPath -ChildPath ".." -AdditionalChildPath @("Tests", "Samples", "nested-file-functions", "paas", "archetype-definition-array-filefn.json");
$ConfigurationBuilder = New-Object ConfigurationBuilder("shared-services", $archetypeDefinitionFileAbsolutePath);
$archetypeInstance = $ConfigurationBuilder.BuildConfigurationInstance(${function:\Add-SubscriptionAndTenantIds});
$archetypeInstance.Subscriptions | Should BeOfType [object];
$archetypeInstance.Subscriptions.Toolkit.nested.fromEnvironmentVariable| Should Be "My value";
$archetypeInstance.Subscriptions.Toolkit.nested.concatEnvironmentVariables | Should Be "My value-bar";
$archetypeInstance.ToolkitComponents | Should BeOfType [object];
$archetypeInstance.ArchetypeParameters | Should BeOfType [object];
$archetypeInstance.ArchetypeOrchestration | Should BeOfType [object];
}
}
}