Azure / Azure/azure-sdk-tools

Fix failing `matrix-generator` tests

Open
#5,098 0 comments 0 reactions 1 assignee Assigned to @benbp View on GitHub
Central-EngSys
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 2h
Merged PRs (30d)
130

Description

A bug discovered while working on:

- #5095

Located in:

[`azure-sdk-tools\eng\common-tests\matrix-generator\tests\job-matrix-functions.modification.tests.ps1`](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common-tests/matrix-generator/tests/job-matrix-functions.modification.tests.ps1)

The bug is described in the header comment in the snippet below.

Snippet:

``` ps1
# This test is currently disabled (it doesn't have "UnitTest" tag) as it fails
# in test "Should generate a sparse matrix where the entire base matrix is imported" on line:
#
# $matrix = GenerateMatrix $importConfig "sparse"
#
# with message:
#
# ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'parameters'. Cannot convert the "System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "MatrixParameter".
#
# See full build failure:
# https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2102328&view=logs&j=375fdae1-accf-5db0-5fc3-af258c8525cc&t=9e9d0eca-bdb6-593f-47d7-63cf69095eca&l=22
#
# Issue to track:
# https://github.com/Azure/azure-sdk-tools/issues/5098
Describe "Platform Matrix Import" -Tag "import" {
It "Should generate a sparse matrix where the entire base matrix is imported" {
$matrixJson = @'
{
"matrix": {
"$IMPORT": "./matrix-generator/tests/test-import-matrix.json"
},
"include": [
{
"fooinclude": "fooinclude"
}
]
}
'@

$expectedMatrix = @'
[
{
"parameters": { "Foo": "foo1", "Bar": "bar1" },
"name": "foo1_bar1"
},
{
"parameters": { "Foo": "foo2", "Bar": "bar2" },
"name": "foo2_bar2"
},
{
"parameters": { "Baz": "importedBaz" },
"name": "importedBazName"
},
{
"parameters": { "fooinclude": "fooinclude" },
"name": "fooinclude"
},
]
'@

$importConfig = GetMatrixConfigFromJson $matrixJson
$matrix = GenerateMatrix $importConfig "sparse"
$expected = $expectedMatrix | ConvertFrom-Json -AsHashtable

$matrix.Length | Should -Be 4
CompareMatrices $matrix $expected
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.