Fix up Get-OmiInstance build and tests

Deploying module is a bit funky until dotnet-cli gives us more control
over which libraries to build and where. Theoretically we'll be able to
package System.Management.Automation and depend on the package instead,
so Commands.Omi can be its own project entirely.

Cleaned up the Commands.Omi project.json as it had some unnecessary
cruft from where it was copied. Also removed the AssemblyInfo as it does
not matter for a new module.

Moved the Get-OmiInstance Pester test to the project's test folder so it
doesn't run with our suite of tests (as it takes a dependency on OMI).
This commit is contained in:
Andrew Schwartzmeyer 2015-12-23 12:29:08 -08:00
parent f018ea47a4
commit af1343472d
6 changed files with 30 additions and 46 deletions

View File

@ -2,13 +2,16 @@
export BIN=$(pwd)/bin
mkdir -p $BIN/Modules/Microsoft.PowerShell.Commands.Omi
mkdir -p $BIN/Modules
# Deploy PowerShell modules
(
cd $BIN/Modules
ln -sf ../../ext-src/pester Pester
ln -sf ../../src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Utility .
OMI=Microsoft.PowerShell.Commands.Omi
mkdir -p $OMI
ln -sf $BIN/$OMI.dll $OMI/
)
# Build native components
@ -55,9 +58,3 @@ mkdir -p $BIN/Modules/Microsoft.PowerShell.Commands.Omi
ln -sf ../src/monad/monad/miscfiles/display/Registry.format.ps1xml .
ln -sf ../src/monad/monad/miscfiles/display/WSMan.format.ps1xml .
)
# Set up Microsoft.PowerShell.Commands.Omi Module
{
cd $BIN/Modules/Microsoft.PowerShell.Commands.Omi
ln -sf ../../Microsoft.PowerShell.Commands.Omi.dll .
}

View File

@ -1,4 +0,0 @@
using System.Reflection;
[assembly:AssemblyFileVersionAttribute("3.0.0.0")]
[assembly:AssemblyVersion("3.0.0.0")]

View File

@ -1,28 +1,17 @@
{
"version": "1.0.0-*",
"description": "Microsoft.PowerShell.Commands.Omi Library",
"authors": [ "George Fleming" ],
"compilationOptions": {
"define": [
"CORECLR",
"_CORECLR",
"LINUX"
],
"allowUnsafe": true
},
"authors": [ "George Fleming", "andschwa" ],
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616",
"NETStandard.Library": "1.0.0-rc2-23616",
"System.Xml.XDocument": "4.0.11-rc2-23616",
"System.Runtime.InteropServices": "4.0.21-rc2-23616",
"System.Management.Automation": {
"type": "build",
"version": "1.0.0-*"
},
"System.Xml.XDocument": "4.0.11-rc2-23616",
"System.Runtime.InteropServices": "4.0.21-rc2-23616",
}
},
"frameworks": { "dnxcore50": { } },
"compile": [ "../monad-build/gen/COMMANDS_OMI/*.cs" ],
"frameworks": { "dnxcore50": { } }
}

View File

@ -0,0 +1,18 @@
# Note that omicli must be in PATH and omiserver should be started with
# --ignoreAuthentication option
Describe "Get-OmiInstance" {
Import-Module Microsoft.PowerShell.Commands.Omi
It "Should execute basic command correctly" {
$instance = Get-OmiInstance -NameSpace root/omi -ClassName OMI_Identify
# This test is a workaround
$instance.Value.Contains("OMI") | Should Be $true
# TODO: test these when available
#$instance.ProductName | Should Be "OMI"
#$instance.ProductVendor | Should Be "Microsoft"
#$instance.OperatingSystem | Should Be "LINUX"
}
}

View File

@ -10,7 +10,7 @@
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616",
"Newtonsoft.Json": "8.0.1-beta3",
"Microsoft.PowerShell.Commands.Utility": {
"Microsoft.PowerShell.Commands.Management": {
"type": "build",
"version": "1.0.0-*"
},
@ -18,15 +18,11 @@
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.PowerShell.Commands.Management": {
"Microsoft.PowerShell.Commands.Utility": {
"type": "build",
"version": "1.0.0-*"
}
},
"commands": {
"powershell": "Microsoft.PowerShell.Linux.Host"
},
"frameworks": { "dnxcore50": { } }
}

View File

@ -1,12 +0,0 @@
# Note that omicli must be in PATH and omiserver should be started with
# --ignoreAuthentication option
Describe "Get-OmiInstance" {
Import-Module Microsoft.PowerShell.Commands.Omi
It "Should execute basic command correctly" {
$obj = Get-OmiInstance -NameSpace root/omi -ClassName OMI_Identify
$obj.Length | Should Be 27
}
}