Files
runner-images-sangeeth/images/ubuntu/scripts/tests/Databases.Tests.ps1
Prabhatkumar59 80a1ca9abe Ubuntu 20 Deprecation changes (#11748)
* Ubuntu 20 Deprecation updates

* Updating .md files

* Update announcement.yml

* Update bug-report.yml

* Update tool-request.yml

* Updating merge conflicts

* Updating .md files

* Updating merge conflicts

* Resolved merge conflicts

---------

Co-authored-by: Prabhat kumar <prabhatkumar59@Prabhats-Laptop.local>
2025-04-23 12:46:13 -06:00

30 lines
1.3 KiB
PowerShell

Describe "PostgreSQL" {
It "PostgreSQL Service" {
"sudo systemctl start postgresql" | Should -ReturnZeroExitCode
"pg_isready" | Should -OutputTextMatchingRegex "/var/run/postgresql:5432 - accepting connections"
"sudo systemctl stop postgresql" | Should -ReturnZeroExitCode
}
It "PostgreSQL version should correspond to the version in the toolset" {
$toolsetVersion = (Get-ToolsetContent).postgresql.version
# Client version
(psql --version).split()[-1] | Should -BeLike "$toolsetVersion*"
# Server version
(pg_config --version).split()[-1] | Should -BeLike "$toolsetVersion*"
}
}
Describe "MySQL" {
It "MySQL CLI" {
"mysql -V" | Should -ReturnZeroExitCode
}
It "MySQL Service" {
"sudo systemctl start mysql" | Should -ReturnZeroExitCode
mysql -s -N -h localhost -uroot -proot -e "select count(*) from mysql.user where user='root' and authentication_string is null;" | Should -BeExactly 0
"sudo mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot" | Should -ReturnZeroExitCode
"sudo mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot" | Should -ReturnZeroExitCode
"sudo systemctl stop mysql" | Should -ReturnZeroExitCode
}
}