Adding Universal NRP E2E test variants with and without OSConfig package installed (#648)
This commit is contained in:
Родитель
81e31b8e8c
Коммит
b84a5c6e92
|
@ -30,4 +30,4 @@ jobs:
|
|||
artifact: universal-nrp-test
|
||||
name: Universal NRP Test Report
|
||||
path: '*.xml'
|
||||
reporter: dotnet-trx
|
||||
reporter: java-junit
|
||||
|
|
|
@ -102,8 +102,10 @@ jobs:
|
|||
{ os: ubuntu, version: 20.04, package-type: DEB, tag: ''},
|
||||
]
|
||||
arch: [amd64]
|
||||
install-osconfig: [true, false]
|
||||
with:
|
||||
target: ${{ matrix.target.os }}-${{ matrix.target.version }}
|
||||
arch: ${{ matrix.arch }}
|
||||
package-type: ${{ matrix.target.package-type }}
|
||||
install-osconfig: ${{ matrix.install-osconfig }}
|
||||
tag: ${{ matrix.target.tag }}
|
|
@ -12,6 +12,10 @@ on:
|
|||
package-type:
|
||||
required: true
|
||||
type: string
|
||||
install-osconfig:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
tag:
|
||||
required: false
|
||||
description: 'Pester tag to include in the test run. If not provided, all tests will be run.'
|
||||
|
@ -44,9 +48,20 @@ jobs:
|
|||
sudo mkdir -p /etc/osconfig
|
||||
sudo cp -r ./src/adapters/pnp/daemon/osconfig.json /etc/osconfig/osconfig.json
|
||||
|
||||
- name: Install OSConfig
|
||||
if: ${{ inputs.install-osconfig }}
|
||||
working-directory: ${{ steps.download.outputs.download-path }}/build
|
||||
run: |
|
||||
if [ "${{ inputs.package-type }}" = "DEB" ]; then
|
||||
sudo dpkg -i $(ls *.deb)
|
||||
else
|
||||
sudo yum install -y $(ls *.rpm)
|
||||
fi
|
||||
|
||||
- name: Run Guest Configuration Test
|
||||
working-directory: ${{ steps.download.outputs.download-path }}
|
||||
run: |
|
||||
testLogSuffix=${{ inputs.install-osconfig == true && 'withOSConfig' || 'noOSConfig' }}
|
||||
script="./universalNRPTest.ps1"
|
||||
cat >$script <<EOL
|
||||
Install-Module -Name GuestConfiguration -Force
|
||||
|
@ -64,8 +79,8 @@ jobs:
|
|||
}
|
||||
TestResult = @{
|
||||
Enabled = \$true
|
||||
OutputFormat = 'NUnitXml'
|
||||
OutputPath = '${{ inputs.target }}-testResult.xml'
|
||||
OutputFormat = 'JUnitXml'
|
||||
OutputPath = '${{ inputs.target }}-UniversalNRP-testResult-$testLogSuffix.xml'
|
||||
}
|
||||
Should = @{
|
||||
ErrorAction = 'Continue'
|
||||
|
@ -79,8 +94,20 @@ jobs:
|
|||
|
||||
sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/omi/lib/ pwsh -Command $script
|
||||
|
||||
- name: Stage OSConfig Logs
|
||||
run: |
|
||||
mkdir osconfig-logs
|
||||
sudo cp -r /var/log/osconfig* osconfig-logs/
|
||||
sudo chown $USER osconfig-logs/*
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: universal-nrp-test
|
||||
path: '${{ steps.download.outputs.download-path }}/${{ inputs.target }}-testResult.xml'
|
||||
path: '${{ steps.download.outputs.download-path }}/${{ inputs.target }}-testResult*.xml'
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: universal-nrp-test-${{ inputs.install-osconfig == true && 'withOSConfig' || 'noOSConfig' }}-logs
|
||||
path: osconfig-logs/osconfig*
|
|
@ -9,7 +9,7 @@ Describe 'Validate Universal NRP' {
|
|||
# Perform monitoring - Get
|
||||
Context "Get" {
|
||||
BeforeAll {
|
||||
$result = Get-GuestConfigurationPackageComplianceStatus -Path $PolicyPackage -Verbose
|
||||
$result = Get-GuestConfigurationPackageComplianceStatus -Path $PolicyPackage
|
||||
}
|
||||
|
||||
It 'Ensure the total resource instances count' {
|
||||
|
@ -38,10 +38,10 @@ Describe 'Validate Universal NRP' {
|
|||
# Perform Remediation - Set
|
||||
Context "Set" {
|
||||
BeforeAll {
|
||||
Start-GuestConfigurationPackageRemediation -Path $PolicyPackage -Verbose
|
||||
Start-GuestConfigurationPackageRemediation -Path $PolicyPackage
|
||||
# Wait for remediation to complete
|
||||
Start-Sleep -Seconds 60
|
||||
$result = Get-GuestConfigurationPackageComplianceStatus -Path $PolicyPackage -Verbose
|
||||
Start-Sleep -Seconds 30
|
||||
$result = Get-GuestConfigurationPackageComplianceStatus -Path $PolicyPackage
|
||||
}
|
||||
|
||||
It 'Ensure the total resource instances count' {
|
||||
|
|
Загрузка…
Ссылка в новой задаче