From 46531a2ce67f607847f9463957c5bda0d3f778f2 Mon Sep 17 00:00:00 2001 From: levisingularity Date: Fri, 8 Nov 2024 15:43:14 -0300 Subject: [PATCH] das-toolbox-125: Refactor dbms_peer and das_peer tests --- tests/integration/test_das_peer.bats | 20 ++++++++++---------- tests/integration/test_dbms_peer.bats | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/integration/test_das_peer.bats b/tests/integration/test_das_peer.bats index 3f03db6..60f6000 100644 --- a/tests/integration/test_das_peer.bats +++ b/tests/integration/test_das_peer.bats @@ -8,7 +8,7 @@ load 'libs/docker' setup() { use_config "simple" - das-cli das-peer stop + das-cli dbms-adapter das-peer stop das-cli db stop } @@ -18,7 +18,7 @@ setup() { unset_config for cmd in "${cmds[@]}"; do - run das-cli das-peer $cmd + run das-cli dbms-adapter das-peer $cmd assert_output "[FileNotFoundError] Configuration file not found in ${das_config_file}. You can run the command \`config set\` to create a configuration file." done @@ -28,7 +28,7 @@ setup() { local mongodb_container_name="$(get_config ".mongodb.container_name")" local redis_container_name="$(get_config ".redis.container_name")" - run das-cli das-peer start + run das-cli dbms-adapter das-peer start assert_output "$mongodb_container_name is not running $redis_container_name is not running @@ -54,7 +54,7 @@ Please use 'db start' to start required services before running 'das-peer start' das-cli db start - run das-cli das-peer start + run das-cli dbms-adapter das-peer start assert_output "$mongodb_container_name is running on port $mongodb_port $redis_container_name is running on port $redis_port @@ -86,7 +86,7 @@ DAS Peer is runnig on port $das_peer_port" run is_service_up mongodb assert_failure - run das-cli das-peer start + run das-cli dbms-adapter das-peer start assert_output "$mongodb_container_name is not running $redis_container_name is not running @@ -111,12 +111,12 @@ Please use 'db start' to start required services before running 'das-peer start' run is_service_up mongodb assert_success - das-cli das-peer start + das-cli dbms-adapter das-peer start run is_service_up das_peer assert_success - run das-cli das-peer start + run das-cli dbms-adapter das-peer start assert_output "$mongodb_container_name is running on port $mongodb_port $redis_container_name is running on port $redis_port @@ -134,14 +134,14 @@ Starting DAS Peer server... run is_service_up mongodb assert_success - das-cli das-peer start + das-cli dbms-adapter das-peer start sleep 15s run is_service_up das_peer assert_success - run das-cli das-peer stop + run das-cli dbms-adapter das-peer stop assert_output "Stopping DAS Peer service... The DAS Peer service has been stopped." @@ -161,7 +161,7 @@ The DAS Peer service has been stopped." run is_service_up mongodb assert_success - run das-cli das-peer stop + run das-cli dbms-adapter das-peer stop assert_output "Stopping DAS Peer service... The DAS Peer service named $das_peer_container_name is already stopped." diff --git a/tests/integration/test_dbms_peer.bats b/tests/integration/test_dbms_peer.bats index 5482e87..40f9b50 100644 --- a/tests/integration/test_dbms_peer.bats +++ b/tests/integration/test_dbms_peer.bats @@ -9,7 +9,7 @@ setup() { use_config "simple" das-cli db restart - das-cli das-peer restart + das-cli dbms-adapter das-peer restart context_file_path="$test_fixtures_dir/dbms_context.txt" postgres_container_name="dbms_peer_postgres" @@ -28,44 +28,44 @@ teardown() { @test "Trying run command with unset configuration file" { unset_config - run das-cli dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db --context $context_file_path + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db --context $context_file_path assert_line --partial "[FileNotFoundError] Configuration file not found in ${das_config_file}. You can run the command \`config set\` to create a configuration file." } @test "Missing --client-hostname parameter" { - run das-cli dbms-peer run --client-port 5432 --client-username postgres --client-password pass --client-database db --context "$context_file_path" + run das-cli dbms-adapter dbms-peer run --client-port 5432 --client-username postgres --client-password pass --client-database db --context "$context_file_path" assert_line --partial "Error: Missing option '--client-hostname'." } @test "Missing --client-port parameter" { - run das-cli dbms-peer run --client-hostname localhost --client-username postgres --client-password pass --client-database db --context "$context_file_path" + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-username postgres --client-password pass --client-database db --context "$context_file_path" assert_line --partial "Error: Missing option '--client-port'." } @test "Missing --client-username parameter" { - run das-cli dbms-peer run --client-hostname localhost --client-port 5432 --client-password pass --client-database db --context "$context_file_path" + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-port 5432 --client-password pass --client-database db --context "$context_file_path" assert_line --partial "Error: Missing option '--client-username'." } @test "Missing --client-password parameter" { - run das-cli dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-database db --context "$context_file_path" + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-database db --context "$context_file_path" assert_line --partial "Error: Missing option '--client-password'." } @test "Missing --context parameter" { - run das-cli dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db assert_line --partial "Error: Missing option '--context'." } @test "Invalid path for --context parameter" { local invalid_path="/path/invalid" - run das-cli dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db --context "$invalid_path" + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db --context "$invalid_path" assert_line --partial "Error: Invalid value for '--context': File '$invalid_path' does not exist." } @test "Directory provided instead of file for --context" { - run das-cli dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db --context "$test_fixtures_dir" + run das-cli dbms-adapter dbms-peer run --client-hostname localhost --client-port 5432 --client-username postgres --client-password pass --client-database db --context "$test_fixtures_dir" assert_line --partial "Error: Invalid value for '--context': File '$test_fixtures_dir' is a directory." } @@ -90,7 +90,7 @@ teardown() { local client_database="$postgres_database" local context="$test_fixtures_dir/dbms_context.txt" - run das-cli dbms-peer run \ + run das-cli dbms-adapter dbms-peer run \ --client-hostname $client_hostname \ --client-port $client_port \ --client-username $client_username \