Skip to content

Commit 2f40d88

Browse files
committed
CI: remove un-used configuration from BWATs
The Bosh Windows Acceptance Tests (BWATs) previously supported earlier versions of Windows OS. This commit removes configuration values which are no longer variable in windows-2019.
1 parent fc1eca3 commit 2f40d88

File tree

12 files changed

+93
-200
lines changed

12 files changed

+93
-200
lines changed

acceptance_test/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ You can create a `config.json` file, eg:
2424
"vm_extensions": "<comma separated string of options, e.g. 50GB_ephemeral_disk>",
2525
"network": "<network from bosh cloud config>",
2626
"skip_cleanup": "<skip cleanup - if this is false all unused stemcells are deleted>"
27-
"ssh_disabled_by_default": "check ssh daemon default startup type - if true then it checks that the startup type is DISABLED. If false or missing, checks startup type is AUTOMATIC",
28-
"security_compliance_applied": "check that Microsoft Baseline policies have been applied"
2927
}
3028
```
3129

acceptance_test/assets/bwats-release/jobs/check-system/spec

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ packages:
1717
- lgpo
1818

1919
properties:
20-
ssh.disabled_by_default:
21-
description: Used when ssh is disabled by default and should be tested as such
22-
default: false
23-
security_compliance.expected_to_comply:
24-
description: Determines whether stemcell being tested is expected to comply with Microsofts Windows Security Compliance Policies
25-
default: false
2620
password.default_username:
2721
description: Username of default profile on the stemcell whose password should be randomized
2822
default: "Administrator"

acceptance_test/assets/bwats-release/jobs/check-system/templates/config.json.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<%=
22
{
3-
ssh_disabled_by_default: "#{p('ssh.disabled_by_default')}",
4-
security_compliance_expected_to_comply: "#{p('security_compliance.expected_to_comply')}",
53
default_username: "#{p('password.default_username')}",
64
default_password: "#{p('password.default_password')}",
75
}.to_json

acceptance_test/assets/bwats-release/jobs/check-system/templates/run.ps1

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -156,25 +156,22 @@ function Verify-Acls {
156156
}
157157

158158
function Verify-Services {
159-
$config = Get-Config
160-
$SSH_Disabled = if ($config.ssh_disabled_by_default -eq "true") { $True } else { $False }
161-
162159
If ( (Get-Service WinRM).Status -ne "Stopped") {
163160
$msg = "WinRM is not Stopped. It is {0}" -f $(Get-Service WinRM).Status
164161
Write-Error $msg
165162
Exit 1
166163
}
167164

168-
$startype = If ($SSH_DISABLED) {"Disabled"} Else {"Automatic"}
165+
$ssh_startype = "Automatic"
169166

170-
If ( (Get-Service sshd).StartType -ne $startype) {
171-
$msg = "sshd service start type is not ${startype}. It is {0}" -f $(Get-Service sshd).StartType
167+
If ( (Get-Service sshd).StartType -ne $ssh_startype) {
168+
$msg = "sshd service start type is not ${ssh_startype}. It is {0}" -f $(Get-Service sshd).StartType
172169
Write-Error $msg
173170
Exit 1
174171
}
175172

176-
If ( (Get-Service ssh-agent).StartType -ne $startype) {
177-
$msg = "ssh-agent service start type is not ${startype}. It is {0}" -f $(Get-Service ssh-agent).StartType
173+
If ( (Get-Service ssh-agent).StartType -ne $ssh_startype) {
174+
$msg = "ssh-agent service start type is not ${ssh_startype}. It is {0}" -f $(Get-Service ssh-agent).StartType
178175
Write-Error $msg
179176
Exit 1
180177
}
@@ -428,17 +425,11 @@ Verify-PSVersion5
428425
Verify-VersionFile
429426
Verify-TimeZone
430427

431-
$config = Get-Config
432-
$validatePolicies = if ($config.security_compliance_expected_to_comply -eq "true") { $True } else { $False }
433-
434-
if ( $validatePolicies )
428+
Import-Module C:\var\vcap\packages\pester\Pester\Pester.psd1
429+
$pesterResults = Invoke-Pester $PSScriptRoot/AuditPolicies.Tests.ps1 -PassThru
430+
if ($pesterResults.FailedCount -gt 0)
435431
{
436-
Import-Module C:\var\vcap\packages\pester\Pester\Pester.psd1
437-
$pesterResults = Invoke-Pester $PSScriptRoot/AuditPolicies.Tests.ps1 -PassThru
438-
if ($pesterResults.FailedCount -gt 0)
439-
{
440-
Exit 1
441-
}
432+
Exit 1
442433
}
443434

444435
Exit 0

acceptance_test/assets/bwats-release/jobs/ephemeral-disk/spec

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ name: ephemeral-disk
44
description: "This errand verifies ephemeral disk mounting"
55

66
templates:
7-
config.json.erb: bin/config.json
87
run.ps1: bin/run.ps1
98

109
packages:
1110
- golang-windows
1211

1312
properties:
14-
run_test.enabled:
15-
description: "Run tests for ephemeral disk"
16-
default: false

acceptance_test/assets/bwats-release/jobs/ephemeral-disk/templates/config.json.erb

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
$ErrorActionPreference = "Stop"
22
trap { $host.SetShouldExit(1) }
33

4-
function Get-Config {
5-
$configPath = Join-Path $PSScriptRoot "config.json"
6-
Write-Host "Loading '$configPath'"
7-
$config = Get-Content $configPath -raw | ConvertFrom-Json
8-
Write-Host "Loaded '$configPath'"
9-
return $config
10-
}
11-
124
function New-RandomFile {
135
param (
146
[Parameter(Mandatory = $false)]
@@ -43,52 +35,42 @@ function New-RandomFile {
4335
}
4436
}
4537

46-
$config = Get-Config
47-
48-
if ($config.run_test_enabled -eq "true") {
49-
# Note no trailing slash. Important! Trailing slashes on non-symlink folders will return their own path as the target
50-
# eg (get-item "C:\var\vcap\data\").target -> c:\var\vcap\data
38+
# Note no trailing slash. Important! Trailing slashes on non-symlink folders will return their own path as the target
39+
# eg (get-item "C:\var\vcap\data\").target -> c:\var\vcap\data
5140

52-
$dataTarget = (get-item "C:\var\vcap\data").Target
53-
if ($dataTarget -eq $null) {
54-
Write-Error "Data partition should be created: target is $dataTarget"
55-
Exit 1
56-
}
41+
$dataTarget = (get-item "C:\var\vcap\data").Target
42+
if ($null -eq $dataTarget) {
43+
Write-Error "Data partition should be created: target is $dataTarget"
44+
Exit 1
45+
}
5746

58-
$targetDriveLetter = $dataTarget.substring(0,1)
59-
$dataPartition = get-partition -driveLetter $targetDriveLetter
47+
$targetDriveLetter = $dataTarget.substring(0,1)
48+
$dataPartition = get-partition -driveLetter $targetDriveLetter
6049

61-
$randFileSize = 2gb
50+
$randFileSize = 2gb
6251

63-
$ephemeralDiskSpaceBeforeFill = (Get-Volume -Partition $dataPartition).SizeRemaining
64-
$rootDiskSpaceBeforeFill = (Get-Volume -DriveLetter C).SizeRemaining
52+
$ephemeralDiskSpaceBeforeFill = (Get-Volume -Partition $dataPartition).SizeRemaining
53+
$rootDiskSpaceBeforeFill = (Get-Volume -DriveLetter C).SizeRemaining
6554

66-
New-RandomFile -Size $randFileSize
55+
New-RandomFile -Size $randFileSize
6756

68-
$rootDiskSpaceAfterFill = (Get-Volume -DriveLetter C).SizeRemaining
69-
$ephemeralDiskSpaceAfterFill = (Get-Volume -Partition $dataPartition).SizeRemaining
57+
$rootDiskSpaceAfterFill = (Get-Volume -DriveLetter C).SizeRemaining
58+
$ephemeralDiskSpaceAfterFill = (Get-Volume -Partition $dataPartition).SizeRemaining
7059

71-
$rootDiskDelta = $rootDiskSpaceBeforeFill - $rootDiskSpaceAfterFill
72-
$ephemeralDiskDelta = $ephemeralDiskSpaceBeforeFill - $ephemeralDiskSpaceAfterFill
60+
$rootDiskDelta = $rootDiskSpaceBeforeFill - $rootDiskSpaceAfterFill
61+
$ephemeralDiskDelta = $ephemeralDiskSpaceBeforeFill - $ephemeralDiskSpaceAfterFill
7362

74-
Write-Host "Delta: $rootDiskDelta"
75-
Write-Host "Ephemeral Delta: $ephemeralDiskDelta"
63+
Write-Host "Delta: $rootDiskDelta"
64+
Write-Host "Ephemeral Delta: $ephemeralDiskDelta"
7665

77-
if ($rootDiskDelta -ge $randFileSize) {
78-
Write-Error "Ephemeral disk was not properly mounted to data path. Delta : $rootDiskDelta"
79-
Exit 1
80-
}
66+
if ($rootDiskDelta -ge $randFileSize) {
67+
Write-Error "Ephemeral disk was not properly mounted to data path. Delta : $rootDiskDelta"
68+
Exit 1
69+
}
8170

82-
if ($ephemeralDiskDelta -lt $randFileSize -or $ephemeralDiskDelta -gt 2 * $randFileSize) {
83-
Write-Error "Ephemeral disk was not properly mounted to data path. Ephemeral Delta : $ephemeralDiskDelta"
84-
Exit 1
85-
}
86-
} else {
87-
$dataTarget = (get-item "C:\var\vcap\data").target
88-
if ($dataTarget -ne $null) {
89-
Write-Error "Data partition should not be created"
90-
Exit 1
91-
}
71+
if ($ephemeralDiskDelta -lt $randFileSize -or $ephemeralDiskDelta -gt 2 * $randFileSize) {
72+
Write-Error "Ephemeral disk was not properly mounted to data path. Ephemeral Delta : $ephemeralDiskDelta"
73+
Exit 1
9274
}
9375

9476
Exit 0

acceptance_test/assets/manifest.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,13 @@ instance_groups:
3131
- name: check-system
3232
release: ((ReleaseName))
3333
properties:
34-
ssh:
35-
disabled_by_default: ((SSHDisabledByDefault))
36-
security_compliance:
37-
expected_to_comply: ((SecurityComplianceApplied))
3834
password:
3935
default_username: ((DefaultUsername))
4036
default_password: ((DefaultPassword))
4137
- name: check-wu-certs
4238
release: ((ReleaseName))
4339
- name: ephemeral-disk
4440
release: ((ReleaseName))
45-
properties:
46-
run_test:
47-
enabled: ((MountEphemeralDisk))
4841
- name: check-ssh
4942
release: ((ReleaseName))
5043
- name: check-updates

acceptance_test/main_test.go

Lines changed: 35 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,16 @@ type TestConfig struct {
214214
ClientSecret string `json:"client_secret"`
215215
Target string `json:"target"`
216216
} `json:"bosh"`
217-
StemcellPath string `json:"stemcell_path"`
218-
StemcellOs string `json:"stemcell_os"`
219-
Az string `json:"az"`
220-
VmType string `json:"vm_type"`
221-
RootEphemeralVmType string `json:"root_ephemeral_vm_type"`
222-
VmExtensions string `json:"vm_extensions"`
223-
Network string `json:"network"`
224-
DefaultUsername string `json:"default_username"`
225-
DefaultPassword string `json:"default_password"`
226-
SkipCleanup bool `json:"skip_cleanup"`
227-
MountEphemeralDisk bool `json:"mount_ephemeral_disk"`
228-
SSHDisabledByDefault bool `json:"ssh_disabled_by_default"`
229-
SecurityComplianceApplied bool `json:"security_compliance_applied"`
217+
StemcellPath string `json:"stemcell_path"`
218+
StemcellOs string `json:"stemcell_os"`
219+
Az string `json:"az"`
220+
VmType string `json:"vm_type"`
221+
RootEphemeralVmType string `json:"root_ephemeral_vm_type"`
222+
VmExtensions string `json:"vm_extensions"`
223+
Network string `json:"network"`
224+
DefaultUsername string `json:"default_username"`
225+
DefaultPassword string `json:"default_password"`
226+
SkipCleanup bool `json:"skip_cleanup"`
230227
}
231228

232229
type StemcellYML struct {
@@ -448,41 +445,29 @@ func createBwatsRelease(bosh *BoshCommand) string {
448445
}
449446

450447
type ManifestProperties struct {
451-
DeploymentName string
452-
ReleaseName string
453-
AZ string
454-
VmType string
455-
RootEphemeralVmType string
456-
VmExtensions string
457-
Network string
458-
StemcellOs string
459-
StemcellVersion string
460-
ReleaseVersion string
461-
DefaultUsername string
462-
DefaultPassword string
463-
MountEphemeralDisk bool
464-
SSHDisabledByDefault bool
465-
SecurityComplianceApplied bool
448+
DeploymentName string
449+
ReleaseName string
450+
AZ string
451+
VmType string
452+
RootEphemeralVmType string
453+
VmExtensions string
454+
Network string
455+
StemcellOs string
456+
StemcellVersion string
457+
ReleaseVersion string
458+
DefaultUsername string
459+
DefaultPassword string
466460
}
467461

468462
func (m ManifestProperties) toVarsFlags() []string {
469-
const stringVarFmt = `--var=%s="%s"`
470-
const boolVarFmt = "--var=%s=%t"
471-
472463
var varFlags []string
473464

474465
for k, v := range m.toMap() {
475466
if v != "" {
476-
varFlags = append(varFlags, fmt.Sprintf(stringVarFmt, k, v))
467+
varFlags = append(varFlags, fmt.Sprintf(`--var=%s="%s"`, k, v))
477468
}
478469
}
479470

480-
varFlags = append(varFlags,
481-
fmt.Sprintf(boolVarFmt, "MountEphemeralDisk", m.MountEphemeralDisk),
482-
fmt.Sprintf(boolVarFmt, "SSHDisabledByDefault", m.SSHDisabledByDefault),
483-
fmt.Sprintf(boolVarFmt, "SecurityComplianceApplied", m.SecurityComplianceApplied),
484-
)
485-
486471
return varFlags
487472
}
488473

@@ -552,21 +537,18 @@ func downloadFile(prefix, sourceUrl string) (string, error) {
552537
func (c *TestConfig) deployWithManifest(bosh *BoshCommand, deploymentName string, stemcellVersion string,
553538
bwatsVersion string, manifestPath string, opsFiles ...string) error {
554539
manifestProperties := ManifestProperties{
555-
DeploymentName: deploymentName,
556-
ReleaseName: "bwats-release",
557-
AZ: c.Az,
558-
VmType: c.VmType,
559-
RootEphemeralVmType: c.RootEphemeralVmType,
560-
VmExtensions: c.VmExtensions,
561-
Network: c.Network,
562-
DefaultUsername: c.DefaultUsername,
563-
DefaultPassword: c.DefaultPassword,
564-
StemcellOs: c.StemcellOs,
565-
StemcellVersion: stemcellVersion,
566-
ReleaseVersion: bwatsVersion,
567-
MountEphemeralDisk: c.MountEphemeralDisk,
568-
SSHDisabledByDefault: c.SSHDisabledByDefault,
569-
SecurityComplianceApplied: c.SecurityComplianceApplied,
540+
DeploymentName: deploymentName,
541+
ReleaseName: "bwats-release",
542+
AZ: c.Az,
543+
VmType: c.VmType,
544+
RootEphemeralVmType: c.RootEphemeralVmType,
545+
VmExtensions: c.VmExtensions,
546+
Network: c.Network,
547+
DefaultUsername: c.DefaultUsername,
548+
DefaultPassword: c.DefaultPassword,
549+
StemcellOs: c.StemcellOs,
550+
StemcellVersion: stemcellVersion,
551+
ReleaseVersion: bwatsVersion,
570552
}
571553

572554
var opsFileArgs strings.Builder

0 commit comments

Comments
 (0)