Skip to content

Commit

Permalink
Added more Code Cov
Browse files Browse the repository at this point in the history
- Also, more production clean up
  • Loading branch information
VertigoRay committed Jul 22, 2018
1 parent 077f26c commit 7f76b71
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion QuserObject/Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Author": "Raymond Piller",
"CompanyName": "Computing for Arts + Sciences, University of North Texas",
"Copyright": "(c) {0} University of North Texas. All rights reserved.",
"GUID": "5d6f5c02-3a3d-457e-a20b-49e356bbdd44",
"GUID": "cd53e7be-8e24-43b5-91bc-6828fc1500a5",
"RootModule": "QuserObject.psm1",
"PowerShellVersion": "5.0",
"HelpInfoURI": "https://github.com/UNT-CAS/QuserObject"
Expand Down
23 changes: 8 additions & 15 deletions QuserObject/en-US/about_QuserObject.help.text
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ PSTOPIC
about_QuserObject

SHORT DESCRIPTION
Manage concurrent usage of software that doesn't use a smarter license server, such as Flex LM.
Run `quser.exe` and return a proper PowerShell Object.

LONG DESCRIPTION
We have several pieces of software that don't use a license server. Because of this, we own n number of stand-alone licenses.
When applicable, we can install this on as many computers as we want, such as in a VDI farm, and make it availble as long as we can control concurrency.
This is an attempt to control concurrency in these situations.
Run `quser.exe` and return a proper PowerShell Object.
I discussed this on my blog to enhance a StackOverflow answer.
I thought I'd make this into a PowerShell module for ease of use and distribution.

DETAILED DESCRIPTION
We have several pieces of software that don't use a license server. Because of this, we own n number of stand-alone licenses.
When applicable, we can install this on as many computers as we want, such as in a VDI farm, and make it availble as long as we can control concurrency.
This is an attempt to control concurrency in these situations.

I prefer to run this as a scheduled task that triggers at reboot and re-runs every 15 minutes or so; ensure:

- If it's already running, another one doesn't startup.
- It's never forced to die after a timeout.

This ensure that the process is always running. If it dies for some reason, we'll get it running again within 15 minutes

Run `quser.exe` and return a proper PowerShell Object.
I discussed this on my blog to enhance a StackOverflow answer.
I thought I'd make this into a PowerShell module for ease of use and distribution.

You can find documentation here:
https://github.com/UNT-CAS/QuserObject
35 changes: 35 additions & 0 deletions Tests/QuserObject.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[string] $projectDirectoryName = 'QuserObject'
[IO.FileInfo] $pesterFile = [io.fileinfo] ([string] (Resolve-Path -Path $MyInvocation.MyCommand.Path))
[IO.DirectoryInfo] $projectRoot = Split-Path -Parent $pesterFile.Directory
[IO.DirectoryInfo] $projectDirectory = Join-Path -Path $projectRoot -ChildPath $projectDirectoryName -Resolve
[IO.FileInfo] $testFile = Join-Path -Path $projectDirectory -ChildPath ($pesterFile.Name -replace '\.Tests\.ps1', '.psm1') -Resolve

Describe $testFile.Name {
It 'Import-Module' {
{ Import-Module $testFile } | Should Not Throw
}

It 'Imported' {
Get-Module $projectDirectoryName | Should Not BeNullOrEmpty
}

$public = @( Get-ChildItem -Path "${projectDirectory}\Public\*.ps1" -ErrorAction SilentlyContinue )

Context 'Public Functions' {
foreach ($file in $public) {
It "Exists: $($file.BaseName)" {
Get-Command $file.BaseName -ErrorAction SilentlyContinue | Should Not BeNullOrEmpty
}
}
}

$private = @( Get-ChildItem -Path "${projectDirectory}\Private\*.ps1" -ErrorAction SilentlyContinue )

Context 'Private Functions' {
foreach ($file in $Private) {
It "Not Exists: $($file.BaseName)" {
Get-Command $file.BaseName -ErrorAction SilentlyContinue | Should BeNullOrEmpty
}
}
}
}

0 comments on commit 7f76b71

Please sign in to comment.