Skip to content

Commit

Permalink
Improve slony1 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Oct 14, 2023
1 parent 6dc60ac commit 8d9d062
Show file tree
Hide file tree
Showing 8 changed files with 363 additions and 70 deletions.
32 changes: 32 additions & 0 deletions tests/slony1/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

################################################################################

extension="slony1"
template="${extension}.template"

################################################################################

main() {
local pg

for pg in 10 11 12 13 14 15 ; do
generate "$pg"
done
}

generate() {
local pg="$1"
local output

output="${extension}_${pg}.recipe"

cat "$template" > "$output"
sed -i "s/%PG_VERSION%/$pg/g" "$output"

echo "$output (PostgreSQL $pg)"
}

################################################################################

main "$@"
123 changes: 123 additions & 0 deletions tests/slony1/slony1.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Bibop recipe for Slony 1 for PostgreSQL %PG_VERSION%
# See more: https://kaos.sh/bibop

pkg slony1-%PG_VERSION%

require-root yes

var slony_version 2.2.11

var postgres_version %PG_VERSION%

var service_name slony1-{postgres_version}

var data_dir /usr/pgsql-{postgres_version}/share
var lib_dir /usr/pgsql-{postgres_version}/lib
var bin_dir /usr/pgsql-{postgres_version}/bin

################################################################################

command "-" "Check environment"
exist /etc/slony1-{postgres_version}/slon.conf
exist /etc/slony1-{postgres_version}/slon_tools.conf

mode /etc/slony1-{postgres_version}/slon.conf 644
mode /etc/slony1-{postgres_version}/slon_tools.conf 644

owner /etc/slony1-{postgres_version}/slon.conf root
owner /etc/slony1-{postgres_version}/slon_tools.conf root

exist /etc/sysconfig/slony1-{postgres_version}
mode /etc/sysconfig/slony1-{postgres_version} 644

exist /etc/rc.d/init.d/slony1-{postgres_version}
mode /etc/rc.d/init.d/slony1-{postgres_version} 755

command "-" "Check binaries"
exist {bin_dir}/slon
exist {bin_dir}/slon_kill
exist {bin_dir}/slon_start
exist {bin_dir}/slon_status
exist {bin_dir}/slon_watchdog
exist {bin_dir}/slon_watchdog2
exist {bin_dir}/slonik
exist {bin_dir}/slonik_add_node
exist {bin_dir}/slonik_build_env
exist {bin_dir}/slonik_create_set
exist {bin_dir}/slonik_drop_node
exist {bin_dir}/slonik_drop_sequence
exist {bin_dir}/slonik_drop_set
exist {bin_dir}/slonik_drop_table
exist {bin_dir}/slonik_execute_script
exist {bin_dir}/slonik_failover
exist {bin_dir}/slonik_init_cluster
exist {bin_dir}/slonik_merge_sets
exist {bin_dir}/slonik_move_set
exist {bin_dir}/slonik_print_preamble
exist {bin_dir}/slonik_restart_node
exist {bin_dir}/slonik_store_node
exist {bin_dir}/slonik_subscribe_set
exist {bin_dir}/slonik_uninstall_nodes
exist {bin_dir}/slonik_unsubscribe_set
exist {bin_dir}/slonik_update_nodes
exist {bin_dir}/slony_logshipper
exist {bin_dir}/slony_show_configuration

mode {bin_dir}/slon 755
mode {bin_dir}/slon_kill 755
mode {bin_dir}/slon_start 755
mode {bin_dir}/slon_status 755
mode {bin_dir}/slon_watchdog 755
mode {bin_dir}/slon_watchdog2 755
mode {bin_dir}/slonik 755
mode {bin_dir}/slonik_add_node 755
mode {bin_dir}/slonik_build_env 755
mode {bin_dir}/slonik_create_set 755
mode {bin_dir}/slonik_drop_node 755
mode {bin_dir}/slonik_drop_sequence 755
mode {bin_dir}/slonik_drop_set 755
mode {bin_dir}/slonik_drop_table 755
mode {bin_dir}/slonik_execute_script 755
mode {bin_dir}/slonik_failover 755
mode {bin_dir}/slonik_init_cluster 755
mode {bin_dir}/slonik_merge_sets 755
mode {bin_dir}/slonik_move_set 755
mode {bin_dir}/slonik_print_preamble 755
mode {bin_dir}/slonik_restart_node 755
mode {bin_dir}/slonik_store_node 755
mode {bin_dir}/slonik_subscribe_set 755
mode {bin_dir}/slonik_uninstall_nodes 755
mode {bin_dir}/slonik_unsubscribe_set 755
mode {bin_dir}/slonik_update_nodes 755
mode {bin_dir}/slony_logshipper 755
mode {bin_dir}/slony_show_configuration 755

command "-" "Check libraries"
exist {lib_dir}/slon-tools.pm
exist {lib_dir}/slony1_funcs.{slony_version}.so

command "-" "Check SQL files"
exist {data_dir}/slony1_base.{slony_version}.sql
exist {data_dir}/slony1_base.v83.{slony_version}.sql
exist {data_dir}/slony1_base.v84.{slony_version}.sql
exist {data_dir}/slony1_funcs.{slony_version}.sql
exist {data_dir}/slony1_funcs.v83.{slony_version}.sql
exist {data_dir}/slony1_funcs.v84.{slony_version}.sql

mode {data_dir}/slony1_base.{slony_version}.sql 644
mode {data_dir}/slony1_base.v83.{slony_version}.sql 644
mode {data_dir}/slony1_base.v84.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.v83.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.v84.{slony_version}.sql 644

################################################################################

command "systemctl start {service_name}" "Start Slony1 daemon"
wait-service {service_name} 5

command "systemctl status {service_name}" "Check status of Slony1 daemon"
expect "active (running)"

command "systemctl stop {service_name}" "Stop Slony1 daemon"
!wait-service {service_name} 5
31 changes: 17 additions & 14 deletions tests/slony1/slony1_10.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ pkg slony1-10

require-root yes

var slony_version 2.2.10
var slony_version 2.2.11

var postgres_version 10
var postgres_version_comb 10
var postgres_version 10

var service_name slony1-{postgres_version_comb}
var service_name slony1-{postgres_version}

var data_dir /usr/pgsql-{postgres_version}/share
var lib_dir /usr/pgsql-{postgres_version}/lib
var bin_dir /usr/pgsql-{postgres_version}/bin

################################################################################

command "-" "Check environment"
exist /etc/slony1-{postgres_version_comb}/slon.conf
exist /etc/slony1-{postgres_version_comb}/slon_tools.conf
exist /etc/slony1-{postgres_version}/slon.conf
exist /etc/slony1-{postgres_version}/slon_tools.conf

mode /etc/slony1-{postgres_version_comb}/slon.conf 644
mode /etc/slony1-{postgres_version_comb}/slon_tools.conf 644
mode /etc/slony1-{postgres_version}/slon.conf 644
mode /etc/slony1-{postgres_version}/slon_tools.conf 644

owner /etc/slony1-{postgres_version_comb}/slon.conf root
owner /etc/slony1-{postgres_version_comb}/slon_tools.conf root
owner /etc/slony1-{postgres_version}/slon.conf root
owner /etc/slony1-{postgres_version}/slon_tools.conf root

exist /etc/sysconfig/slony1-{postgres_version_comb}
mode /etc/sysconfig/slony1-{postgres_version_comb} 644
exist /etc/sysconfig/slony1-{postgres_version}
mode /etc/sysconfig/slony1-{postgres_version} 644

exist /etc/rc.d/init.d/slony1-{postgres_version_comb}
mode /etc/rc.d/init.d/slony1-{postgres_version_comb} 755
exist /etc/rc.d/init.d/slony1-{postgres_version}
mode /etc/rc.d/init.d/slony1-{postgres_version} 755

command "-" "Check binaries"
exist {bin_dir}/slon
Expand Down Expand Up @@ -110,6 +111,8 @@ command "-" "Check SQL files"
mode {data_dir}/slony1_funcs.v83.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.v84.{slony_version}.sql 644

################################################################################

command "systemctl start {service_name}" "Start Slony1 daemon"
wait-service {service_name} 5

Expand Down
31 changes: 17 additions & 14 deletions tests/slony1/slony1_11.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ pkg slony1-11

require-root yes

var slony_version 2.2.10
var slony_version 2.2.11

var postgres_version 11
var postgres_version_comb 11
var postgres_version 11

var service_name slony1-{postgres_version_comb}
var service_name slony1-{postgres_version}

var data_dir /usr/pgsql-{postgres_version}/share
var lib_dir /usr/pgsql-{postgres_version}/lib
var bin_dir /usr/pgsql-{postgres_version}/bin

################################################################################

command "-" "Check environment"
exist /etc/slony1-{postgres_version_comb}/slon.conf
exist /etc/slony1-{postgres_version_comb}/slon_tools.conf
exist /etc/slony1-{postgres_version}/slon.conf
exist /etc/slony1-{postgres_version}/slon_tools.conf

mode /etc/slony1-{postgres_version_comb}/slon.conf 644
mode /etc/slony1-{postgres_version_comb}/slon_tools.conf 644
mode /etc/slony1-{postgres_version}/slon.conf 644
mode /etc/slony1-{postgres_version}/slon_tools.conf 644

owner /etc/slony1-{postgres_version_comb}/slon.conf root
owner /etc/slony1-{postgres_version_comb}/slon_tools.conf root
owner /etc/slony1-{postgres_version}/slon.conf root
owner /etc/slony1-{postgres_version}/slon_tools.conf root

exist /etc/sysconfig/slony1-{postgres_version_comb}
mode /etc/sysconfig/slony1-{postgres_version_comb} 644
exist /etc/sysconfig/slony1-{postgres_version}
mode /etc/sysconfig/slony1-{postgres_version} 644

exist /etc/rc.d/init.d/slony1-{postgres_version_comb}
mode /etc/rc.d/init.d/slony1-{postgres_version_comb} 755
exist /etc/rc.d/init.d/slony1-{postgres_version}
mode /etc/rc.d/init.d/slony1-{postgres_version} 755

command "-" "Check binaries"
exist {bin_dir}/slon
Expand Down Expand Up @@ -110,6 +111,8 @@ command "-" "Check SQL files"
mode {data_dir}/slony1_funcs.v83.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.v84.{slony_version}.sql 644

################################################################################

command "systemctl start {service_name}" "Start Slony1 daemon"
wait-service {service_name} 5

Expand Down
31 changes: 17 additions & 14 deletions tests/slony1/slony1_12.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ pkg slony1-12

require-root yes

var slony_version 2.2.10
var slony_version 2.2.11

var postgres_version 12
var postgres_version_comb 12
var postgres_version 12

var service_name slony1-{postgres_version_comb}
var service_name slony1-{postgres_version}

var data_dir /usr/pgsql-{postgres_version}/share
var lib_dir /usr/pgsql-{postgres_version}/lib
var bin_dir /usr/pgsql-{postgres_version}/bin

################################################################################

command "-" "Check environment"
exist /etc/slony1-{postgres_version_comb}/slon.conf
exist /etc/slony1-{postgres_version_comb}/slon_tools.conf
exist /etc/slony1-{postgres_version}/slon.conf
exist /etc/slony1-{postgres_version}/slon_tools.conf

mode /etc/slony1-{postgres_version_comb}/slon.conf 644
mode /etc/slony1-{postgres_version_comb}/slon_tools.conf 644
mode /etc/slony1-{postgres_version}/slon.conf 644
mode /etc/slony1-{postgres_version}/slon_tools.conf 644

owner /etc/slony1-{postgres_version_comb}/slon.conf root
owner /etc/slony1-{postgres_version_comb}/slon_tools.conf root
owner /etc/slony1-{postgres_version}/slon.conf root
owner /etc/slony1-{postgres_version}/slon_tools.conf root

exist /etc/sysconfig/slony1-{postgres_version_comb}
mode /etc/sysconfig/slony1-{postgres_version_comb} 644
exist /etc/sysconfig/slony1-{postgres_version}
mode /etc/sysconfig/slony1-{postgres_version} 644

exist /etc/rc.d/init.d/slony1-{postgres_version_comb}
mode /etc/rc.d/init.d/slony1-{postgres_version_comb} 755
exist /etc/rc.d/init.d/slony1-{postgres_version}
mode /etc/rc.d/init.d/slony1-{postgres_version} 755

command "-" "Check binaries"
exist {bin_dir}/slon
Expand Down Expand Up @@ -110,6 +111,8 @@ command "-" "Check SQL files"
mode {data_dir}/slony1_funcs.v83.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.v84.{slony_version}.sql 644

################################################################################

command "systemctl start {service_name}" "Start Slony1 daemon"
wait-service {service_name} 5

Expand Down
31 changes: 17 additions & 14 deletions tests/slony1/slony1_13.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ pkg slony1-13

require-root yes

var slony_version 2.2.10
var slony_version 2.2.11

var postgres_version 13
var postgres_version_comb 13
var postgres_version 13

var service_name slony1-{postgres_version_comb}
var service_name slony1-{postgres_version}

var data_dir /usr/pgsql-{postgres_version}/share
var lib_dir /usr/pgsql-{postgres_version}/lib
var bin_dir /usr/pgsql-{postgres_version}/bin

################################################################################

command "-" "Check environment"
exist /etc/slony1-{postgres_version_comb}/slon.conf
exist /etc/slony1-{postgres_version_comb}/slon_tools.conf
exist /etc/slony1-{postgres_version}/slon.conf
exist /etc/slony1-{postgres_version}/slon_tools.conf

mode /etc/slony1-{postgres_version_comb}/slon.conf 644
mode /etc/slony1-{postgres_version_comb}/slon_tools.conf 644
mode /etc/slony1-{postgres_version}/slon.conf 644
mode /etc/slony1-{postgres_version}/slon_tools.conf 644

owner /etc/slony1-{postgres_version_comb}/slon.conf root
owner /etc/slony1-{postgres_version_comb}/slon_tools.conf root
owner /etc/slony1-{postgres_version}/slon.conf root
owner /etc/slony1-{postgres_version}/slon_tools.conf root

exist /etc/sysconfig/slony1-{postgres_version_comb}
mode /etc/sysconfig/slony1-{postgres_version_comb} 644
exist /etc/sysconfig/slony1-{postgres_version}
mode /etc/sysconfig/slony1-{postgres_version} 644

exist /etc/rc.d/init.d/slony1-{postgres_version_comb}
mode /etc/rc.d/init.d/slony1-{postgres_version_comb} 755
exist /etc/rc.d/init.d/slony1-{postgres_version}
mode /etc/rc.d/init.d/slony1-{postgres_version} 755

command "-" "Check binaries"
exist {bin_dir}/slon
Expand Down Expand Up @@ -110,6 +111,8 @@ command "-" "Check SQL files"
mode {data_dir}/slony1_funcs.v83.{slony_version}.sql 644
mode {data_dir}/slony1_funcs.v84.{slony_version}.sql 644

################################################################################

command "systemctl start {service_name}" "Start Slony1 daemon"
wait-service {service_name} 5

Expand Down
Loading

0 comments on commit 8d9d062

Please sign in to comment.