-
Notifications
You must be signed in to change notification settings - Fork 162
/
CheckPrereq.ps1
37 lines (29 loc) · 1.37 KB
/
CheckPrereq.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#requires -Module @{ModuleName = "Pester"; ModuleVersion="4.0"}
describe "Prerequisite check" {
Context "Task 1" {
it "Should have git installed and in path" {
Get-Command git -ea SilentlyContinue | Should -Not -Be $null -Because "We require git for many lab exercises"
}
it "Should not be executed on PowerShell Core" {
$PSVersionTable.PSVersion -lt '6.0' | Should -Be $true -Because "Currently the build process is not capable of running with PowerShell Core"
}
it "Should be using VS Code" {
Get-Command code.cmd -ErrorAction SilentlyContinue | Should -Not -Be $null
}
it "Should have the PowerShell extension installed" {
(Get-ChildItem -Path $home\.vscode\extensions).Name -Match "ms-vscode\.powershell" | Should -Not -Be $null
}
it "Should have the yaml extension installed" {
(Get-ChildItem -Path $home\.vscode\extensions).Name -Match "redhat\.vscode-yaml" | Should -Not -Be $null
}
}
Context "Task 2" {
it "Should have 'Az.Automation' module installed" {
Get-Module -List -Name Az.Automation | Should -Not -BeNullOrEmpty
}
it "Should be logged in to Azure (use Login-AzAccount)" {
{ Get-AzContext } | Should -Not -Throw
Get-AzContext | Should -Not -Be $null
}
}
}