Skip to content

Commit

Permalink
mk-sql: add registry data set
Browse files Browse the repository at this point in the history
reinstalled on every test run

Change-Id: I8915fcbfe71e403a17ed23fd421018b93eeaf4de
  • Loading branch information
s-kipnis committed Feb 12, 2025
1 parent 7582fd7 commit abdf5b2
Show file tree
Hide file tree
Showing 16 changed files with 189 additions and 476 deletions.
8 changes: 5 additions & 3 deletions packages/host/mk-sql/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ function Start-ShortenPath($tgt_link, $path) {
function Invoke-Cargo-With-Explicit-Package {
param(
[Parameter(
Mandatory=$True,
Mandatory = $True,
Position = 0
)]
$cmd,
[Parameter(
Mandatory=$False,
ValueFromRemainingArguments=$true,
Mandatory = $False,
ValueFromRemainingArguments = $true,
Position = 1
)]
$further_args
Expand Down Expand Up @@ -236,6 +236,8 @@ try {
if (-not (Test-Administrator)) {
Write-Error "Testing must be executed as Administrator." -ErrorAction Stop
}
# TODO(timi): move it to CI
.\tests\files\ci-scripts\manage-test-registry-set.ps1 --reinstall 2.5.0
Invoke-Cargo-With-Explicit-Package "test" "--release" "--target" $cargo_target "--" "--test-threads=4"
}
if ($packBuild -and $packTest -and $packClippy) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
$command = $args[0]
$name = $args[1]
$package = "mk-sql"

function Install-Me {
param (
[string]$Name
)
Write-Output "Installing $Name..."
$folderPath = $PSScriptRoot + "\..\windows-registry\$Name"
$regFiles = Get-ChildItem -Path $folderPath -Filter *.reg
foreach ($file in $regFiles) {
Write-Host "loading $($file.FullName)"
regedit.exe /s $file.FullName
}

}

function Remove-Me {
param (
[string]$Name
)
Write-Output "Removing $Name..."
reg delete "HKLM\SOFTWARE\checkmk\tests\$Name\$package" /f
}

if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
Write-Output "This script needs administrator privileges."
exit
}


switch ($command) {
'--install' { Install-Me -Name $name }
'--remove' { Remove-Me -Name $name }
'--reinstall' {
Remove-Me -Name $name
Install-Me -Name $name
}
default { Write-Output "Invalid command $Command. Use --install <name> or --remove <name>." }
}


#Write-Host "Setting test cases are ready"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\checkmk\tests\2.5.0\mk-sql\instances\test-std\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names]

[HKEY_LOCAL_MACHINE\SOFTWARE\checkmk\tests\2.5.0\mk-sql\instances\test-std\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL]
"MSSQLSERVER"="MSSQL16.MSSQLSERVER"
"SQLEXPRESS_NAME"="MSSQL13.SQLEXPRESS_ID"

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\checkmk\tests\2.5.0\mk-sql\instances\test-std\SOFTWARE\WOW6432Node\Microsoft\Microsoft SQL Server\Instance Names]

[HKEY_LOCAL_MACHINE\SOFTWARE\checkmk\tests\2.5.0\mk-sql\instances\test-std\SOFTWARE\WOW6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL]
"SQLEXPRESS_WOW"="MSSQL12.SQLEXPRESS_WOW"

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ replace
```
with
```
[HKEY_LOCAL_MACHINE\SOFTWARE\checkmk\tests\Package-Name\Group-Name\Test-Name
[HKEY_LOCAL_MACHINE\SOFTWARE\checkmk\tests\<Repo-Name>\<Package-Name>\<Group-Name>\<Test-Name>
```
where

* Repo-Name is a name of the repo, for example, *2.5.0*
* Package-Name is a name of the package, for example, *mk-sql* or *cmk-agent-ctl*
* Group-Name is a name of the test group, for example *instances* or *tcp-logic*
* Test-Name is a name of the some test(or tests), for example, *test-tcp-base*
Expand All @@ -35,15 +36,15 @@ fn read(custom_branch: Optional<None>) ...
For example, for mk-sql everything you need is located in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft ...
In This case
standard Branch is "SOFTWARE\"
custom Branch us "SOFTWARE\check\tests\mks-sql\Group-Name\Test-Name\SOFTWARE\
custom Branch us "SOFTWARE\check\tests\\<Repo-Name>\<Package-Name>\<Group-Name>\<Test-Name>\SOFTWARE\


# Internals

We are using fro production normal Prefix Branch
**SOFTWARE**
but for test we are using test Prefix Branch
**SOFTWARE\checkmk\tests\Package-Name\Group-Name\Test-Name**
**SOFTWARE\checkmk\tests\2.5.0\Package-Name\Group-Name\Test-Name**

Data are immutable.

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Loading

0 comments on commit abdf5b2

Please sign in to comment.