From 16692364fb9f2adc6f053f7a98bcc6a25c6e931e Mon Sep 17 00:00:00 2001 From: "dmitry.travyan" Date: Tue, 28 Mar 2023 21:26:59 +0300 Subject: [PATCH] feat: consistency tests added --- .gitignore | 10 +- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 20 +-- README.ru.md | 22 +-- src/task.rs | 3 + src/task/test.rs | 139 ++++++++++++++++++ test/resources/test-2-new-cluster.genin.yaml | 92 ------------ test/resources/test-big-cluster.genin.yaml | 91 ------------ .../resources/test-chaotic-cluster.genin.yaml | 68 --------- .../test-cluster-uncomplete.genin.yaml | 38 ----- test/resources/test-cluster.genin.yaml | 77 ++++++---- test/resources/test-giant-cluster.genin.yaml | 91 ------------ .../resources/test-upgrade-cluster.genin.yaml | 53 +++++++ 14 files changed, 266 insertions(+), 442 deletions(-) create mode 100644 src/task/test.rs delete mode 100644 test/resources/test-2-new-cluster.genin.yaml delete mode 100644 test/resources/test-big-cluster.genin.yaml delete mode 100644 test/resources/test-chaotic-cluster.genin.yaml delete mode 100644 test/resources/test-cluster-uncomplete.genin.yaml delete mode 100644 test/resources/test-giant-cluster.genin.yaml create mode 100644 test/resources/test-upgrade-cluster.genin.yaml diff --git a/.gitignore b/.gitignore index 0f628e0..7ad5230 100644 --- a/.gitignore +++ b/.gitignore @@ -23,20 +23,16 @@ node_modules /tmp/* !/tmp/.keep .roles -/test/resources/* -!/test/resources/test-* -/test/resources/test-*-copy*:w -/test/outputs/* !/test/outputs/test-* -/test/outputs/test-*-copy*:w +/test/outputs/* /.gitlab-ci.yml /deploy/.terraform.lock.hcl /deploy/.terraform/ /deploy/.terraform.tfstate.lock.info /deploy/terraform.tfstate /deploy/terraform.tfstate.backup -*.genin.yml -*.genin.yaml +./*.genin.yml +./*.genin.yaml !/docs/examples/* inventory.yml inventory.yaml diff --git a/Cargo.lock b/Cargo.lock index 9cd9c55..69ab1d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,7 +114,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "genin" -version = "0.4.16" +version = "0.4.17" dependencies = [ "clap", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 43d9d75..ed6e2ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "genin" -version = "0.4.16" +version = "0.4.17" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 8afac42..a757184 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ Download and unzip the archive for the desired architecture. Universal executable: ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/bin/genin-0.4.16-x86_64-musl.tar.gz -tar -xvf genin-0.4.16-x86_64-musl.tar.gz ; sudo install genin /usr/local/bin/ +curl -sLO https://binary.picodata.io/repository/raw/genin/bin/genin-0.4.17-x86_64-musl.tar.gz +tar -xvf genin-0.4.17-x86_64-musl.tar.gz ; sudo install genin /usr/local/bin/ ``` --- @@ -84,11 +84,11 @@ sudo yum install -y genin 2. If you want to install `rpm` packages directly without adding our repository. ```shell -sudo rpm -i https://binary.picodata.io/repository/yum/el/8/x86_64/os/genin-0.4.16-1.el8.x86_64.rpm +sudo rpm -i https://binary.picodata.io/repository/yum/el/8/x86_64/os/genin-0.4.17-1.el8.x86_64.rpm ``` RHEL 7.x, CentOS 7.x ```shell -sudo rpm -i https://binary.picodata.io/repository/yum/el/7/x86_64/os/genin-0.4.16-1.el7.x86_64.rpm +sudo rpm -i https://binary.picodata.io/repository/yum/el/7/x86_64/os/genin-0.4.17-1.el7.x86_64.rpm ``` --- @@ -116,7 +116,7 @@ sudo apt install -y genin 2. Downloading and installing the package directly: ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.16.amd64.deb && sudo dpkg -i genin-0.4.16.amd64.deb +curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.17.amd64.deb && sudo dpkg -i genin-0.4.17.amd64.deb ``` --- @@ -142,7 +142,7 @@ sudo apt install -y genin 2. Downloading and installing the package directly: ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.16.amd64.deb && sudo dpkg -i genin-0.4.16.amd64.deb +curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.17.amd64.deb && sudo dpkg -i genin-0.4.17.amd64.deb ``` --- @@ -162,8 +162,8 @@ brew install genin Use the following command to grab and install Genin in macOS (10.10+) wihtout homebrew: ```shell -curl -L https://binary.picodata.io/repository/raw/genin/apple/genin-0.4.16-darwin-amd64.zip -o genin-0.4.16-darwin-amd64.zip -unzip genin-0.4.16-darwin-amd64.zip -d ~/bin/ +curl -L https://binary.picodata.io/repository/raw/genin/apple/genin-0.4.17-darwin-amd64.zip -o genin-0.4.17-darwin-amd64.zip +unzip genin-0.4.17-darwin-amd64.zip -d ~/bin/ ``` > **Note:** The application can then be found under the `~/bin` directory. > Make sure the directory is in your `$PATH`. @@ -181,8 +181,8 @@ brew install genin@0.3.8 #### Windows Use the following command to grab and install Genin in Windows 7 64 bit or newer: ```shell -curl.exe -L https://binary.picodata.io/repository/raw/genin/windows/genin-0.4.16-darwin-amd64.zip -o genin-0.4.16-windows-amd64.zip -unzip.exe genin-0.4.16-windows-amd64.zip -d %HOME%/.cargo/bin/ +curl.exe -L https://binary.picodata.io/repository/raw/genin/windows/genin-0.4.17-darwin-amd64.zip -o genin-0.4.17-windows-amd64.zip +unzip.exe genin-0.4.17-windows-amd64.zip -d %HOME%/.cargo/bin/ ``` > **Note:** The application can then be found under the `.cargo/bin` folder inside > your user profile folder. Make sure it is in your `%PATH%`. diff --git a/README.ru.md b/README.ru.md index d1bdc8b..3c29576 100644 --- a/README.ru.md +++ b/README.ru.md @@ -49,8 +49,8 @@ Genin уже заранее скомпилирован под разные ар Универсальный исполняемый файл: ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/bin/genin-0.4.16-x86_64-musl.tar.gz -tar -xvf genin-0.4.16-x86_64-musl.tar.gz ; sudo install genin /usr/local/bin/ +curl -sLO https://binary.picodata.io/repository/raw/genin/bin/genin-0.4.17-x86_64-musl.tar.gz +tar -xvf genin-0.4.17-x86_64-musl.tar.gz ; sudo install genin /usr/local/bin/ ``` --- @@ -87,11 +87,11 @@ sudo yum install -y genin 2. Так же вы можете установить пакет `rpm` напрямую без добавления нашего репозитория. RHEL 8.x, CentOS 8.x, Rockylinux 8.x, recent Fedora version ```shell -sudo rpm -i https://binary.picodata.io/repository/yum/el/8/x86_64/os/genin-0.4.16-1.el8.x86_64.rpm +sudo rpm -i https://binary.picodata.io/repository/yum/el/8/x86_64/os/genin-0.4.17-1.el8.x86_64.rpm ``` RHEL 7.x, CentOS 7.x ```shell -sudo rpm -i https://binary.picodata.io/repository/yum/el/7/x86_64/os/genin-0.4.16-1.el7.x86_64.rpm +sudo rpm -i https://binary.picodata.io/repository/yum/el/7/x86_64/os/genin-0.4.17-1.el7.x86_64.rpm ``` > **Note:** будьте внимательны, так как при выборе не правильной версии ос могут быть ошибки > при установке `rpm` @@ -118,7 +118,7 @@ sudo apt install -y genin 2. Загрузкой и установкой пакета напрямую: ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.16.amd64.deb && sudo dpkg -i genin-0.4.16.amd64.deb +curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.17.amd64.deb && sudo dpkg -i genin-0.4.17.amd64.deb ``` --- @@ -143,7 +143,7 @@ sudo apt install -y genin 2. Загрузкой и установкой пакета напрямую: ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.16.amd64.deb && sudo dpkg -i genin-0.4.16.amd64.deb +curl -sLO https://binary.picodata.io/repository/raw/genin/deb/genin-0.4.17.amd64.deb && sudo dpkg -i genin-0.4.17.amd64.deb ``` --- @@ -163,8 +163,8 @@ brew install genin Для установки без помощи homebrew используйте следующие команды для загрузки и установки Genin на macOS (10.10+): ```shell -curl -sLO https://binary.picodata.io/repository/raw/genin/osx/genin-0.4.16-x86_64-macosx.tar.gz -unzip genin-0.4.16-darwin-amd64.zip -d ~/bin/ +curl -sLO https://binary.picodata.io/repository/raw/genin/osx/genin-0.4.17-x86_64-macosx.tar.gz +unzip genin-0.4.17-darwin-amd64.zip -d ~/bin/ ``` --- @@ -188,8 +188,8 @@ brew install genin@0.3.8 Используйте следующие команды для скачивания и установки Genin на операционных системах Windows 7 64 и новее. ```shell -curl.exe -sLO https://binary.picodata.io/repository/raw/genin/win/genin-0.4.16-win64.zip -unzip.exe genin-0.4.16-win64.zip -d %HOME%/.cargo/bin/ +curl.exe -sLO https://binary.picodata.io/repository/raw/genin/win/genin-0.4.17-win64.zip +unzip.exe genin-0.4.17-win64.zip -d %HOME%/.cargo/bin/ ``` > **Note:** Genin будет распакован в директорию `.cargo/bin` которая находится в домашнем > каталоге важего пользователя. Перед использованием приложения пожалуйста удостоверьтесь @@ -199,7 +199,7 @@ unzip.exe genin-0.4.16-win64.zip -d %HOME%/.cargo/bin/ ``` genin --version ``` -Если вы видите сообщение `genin 0.4.16` значит установка прошла успешно. +Если вы видите сообщение `genin 0.4.17` значит установка прошла успешно. --- ## Руководство по использованию diff --git a/src/task.rs b/src/task.rs index 9ac8cf0..9b51db0 100644 --- a/src/task.rs +++ b/src/task.rs @@ -435,3 +435,6 @@ impl<'a> std::fmt::Debug for ErrConfMapping<'a> { Ok(()) } } + +#[cfg(test)] +mod test; diff --git a/src/task/test.rs b/src/task/test.rs new file mode 100644 index 0000000..8998b91 --- /dev/null +++ b/src/task/test.rs @@ -0,0 +1,139 @@ +use std::{fs::File, io::Read, path::PathBuf}; + +use clap::{Arg, ArgAction, Command}; + +use crate::error::{GeninError, GeninErrorKind}; + +use super::{ + cluster::{ + fs::{TryMap, CLUSTER_YAML, IO}, + Cluster, + }, + inventory::Inventory, +}; + +#[test] +fn build_consistency_100_times() { + let args = Command::new("genin") + .args(&[ + Arg::new("source") + .long("source") + .short('s') + .action(ArgAction::Set), + Arg::new("force") + .long("force") + .short('f') + .action(ArgAction::SetTrue), + ]) + .try_get_matches_from(vec![ + "genin", + "--source", + "test/resources/test-cluster.genin.yaml", + ]) + .unwrap(); + + let build_inventory = || -> String { + let bytes = IO::from(&args) + .try_into_files(Some(CLUSTER_YAML), None, args.get_flag("force")) + .unwrap() + .deserialize_input::() + .unwrap() + .try_map(|IO { input, .. }| { + Inventory::try_from(&input).map(|inventory| IO { + input: Some(inventory), + output: Some(Vec::new()), + }) + }) + .unwrap() + .serialize_input() + .unwrap() + .output + .unwrap(); + + String::from_utf8(bytes).unwrap() + }; + + let first = build_inventory(); + + for _ in 0..100 { + assert_eq!(build_inventory(), first); + } +} + +#[test] +fn upgrade_consistency_100_times() { + let args = Command::new("genin") + .args(&[ + Arg::new("old").long("old").action(ArgAction::Set), + Arg::new("new").long("new").action(ArgAction::Set), + ]) + .try_get_matches_from(vec![ + "genin", + "--old", + "test/resources/test-cluster.genin.yaml", + "--new", + "test/resources/test-upgrade-cluster.genin.yaml", + ]) + .unwrap(); + + let upgrade_inventory = || -> String { + let bytes = IO { + input: args + .try_get_one::("old") + .transpose() + .and_then(|r| r.map_or(None, |s| Some(PathBuf::from(s.as_str())))), + output: None, + } + .try_into_files(Some(CLUSTER_YAML), None, false) + .unwrap() + .deserialize_input::() + .unwrap() + .try_map(|IO { input, output }| { + // 1. read source cluster yaml file what should be upgraded + // 2. read cluster yaml which should contains information about upgrade + File::open(args.get_one::("new").unwrap()) + .map_err(|err| GeninError::new(GeninErrorKind::IO, err)) + .and_then(|mut file| { + let mut buffer = Vec::new(); + file.read_to_end(&mut buffer) + .map_err(|err| GeninError::new(GeninErrorKind::IO, err))?; + Ok(buffer) + }) + .and_then(|buffer| { + serde_yaml::from_slice::(&buffer) + .map_err(|err| GeninError::new(GeninErrorKind::Deserialization, err)) + }) + .and_then(|new| { + input + .ok_or_else(|| { + GeninError::new(GeninErrorKind::EmptyField, "input file is empty") + }) + .and_then(|input_cluster| input_cluster.try_upgrade(&new)) + }) + .map(|upgraded| IO { + input: Some(upgraded), + output, + }) + }) + .unwrap() + .try_map(|IO { input, .. }| { + Inventory::try_from(&input).map(|inventory| IO { + input: Some(inventory), + output: Some(Vec::new()), + }) + }) + .unwrap() + .serialize_input() + .unwrap() + .output + .unwrap(); + + String::from_utf8(bytes).unwrap() + }; + + let first = upgrade_inventory(); + + for _ in 0..100 { + assert_eq!(upgrade_inventory(), first); + } +} diff --git a/test/resources/test-2-new-cluster.genin.yaml b/test/resources/test-2-new-cluster.genin.yaml deleted file mode 100644 index 9dd8f75..0000000 --- a/test/resources/test-2-new-cluster.genin.yaml +++ /dev/null @@ -1,92 +0,0 @@ ---- -topology: - - name: router - roles: - - vshard-router - - ttq.roles.q_router - - ttq.roles.http - - - name: storage - replication_factor: 4 - roles: - - vshard-storage - - vshard-router - - ttq.roles.q_storage - - - name: statistic - replication_factor: 2 - roles: - - ttq.roles.q_statistic - - - name: consumer - roles: - - ttq.roles.q_kafka_listener - - - name: coordinator-dc1 - replication_factor: 2 - failure_domains: - - dc1 - roles: - - ttq.roles.coordinator - condig: - all_rw: true - - - name: coordinator-dc2 - replication_factor: 2 - failure_domains: - - dc2 - roles: - - ttq.roles.coordinator - all_rw: true - - - name: cfgfetcher - roles: - - ttq.roles.q_cfg_fetcher - - - name: export - roles: - - ttq.roles.q_export - -hosts: - - name: dc1 - config: - http_port: 8081 - binary_port: 3301 - hosts: - - name: host-1 - config: - address: 192.168.15.11 - - name: host-2 - config: - address: 192.168.15.12 - - - name: dc2 - config: - http_port: 8081 - binary_port: 3301 - hosts: - - name: host-1 - config: - address: 192.168.16.11 - - name: host-2 - config: - address: 192.168.16.12 - -failover: - mode: stateful - state_provider: etcd2 - etcd2_params: - prefix: cartridge/myapp - lock_delay: 30 - endpoints: - - 'http://192.168.16.11:5699' - - 'http://192.168.16.12:5699' - username: change_me - password: change_me -vars: - ansible_user: root - ansible_password: change_me - cartridge_app_name: myapp - cartridge_cluster_cookie: myapp-cookie - cartridge_package_path: /tmp/myapp.rpm - cartridge_bootstrap_vshard: true diff --git a/test/resources/test-big-cluster.genin.yaml b/test/resources/test-big-cluster.genin.yaml deleted file mode 100644 index 57cfc49..0000000 --- a/test/resources/test-big-cluster.genin.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -instances: - - name: type-1-storage - type: storage - count: 10 - replicas: 3 - weight: 10 - roles: - - storage - - v1-api - - name: type-2-storage - type: storage - count: 10 - replicas: 3 - weight: 10 - roles: - - storage - - v2-api - - name: router - type: router - count: 10 - replicas: 0 - weight: 10 - roles: - - router - - api - - failover-coordinator - - name: connector - count: 5 - replicas: 0 - weight: 10 - roles: - - connector - - name: probe-meter - count: 5 - replicas: 0 - weight: 10 - roles: - - probe-meter - - name: metrics - count: 10 - replicas: 0 - weight: 10 - roles: - - metrics -hosts: - - name: cloud - type: region - ports: - http: 8100 - binary: 3100 - hosts: - - name: moscow-7 - type: datacenter - hosts: - - name: msk-host-1 - ip: 192.168.16.1 - - name: msk-host-2 - ip: 192.168.16.2 - - name: msk-host-3 - ip: 192.168.16.3 - - name: msk-host-4 - ip: 192.168.16.4 - - name: msk-host-5 - ip: 192.168.16.5 - - name: spb-3 - type: datacenter - hosts: - - name: sbp-host-1 - ip: 192.168.16.1 - - name: spb-host-2 - ip: 192.168.16.2 - - name: spb-host-3 - ip: 192.168.16.3 - - name: spb-host-4 - ip: 192.168.16.4 - - name: spb-host-5 - ip: 192.168.16.5 -failover: - mode: stateful - state_provider: stateboard - stateboard_params: - uri: - ip: 192.168.16.1 - port: 4401 - password: change_me -vars: - ansible_user: root - ansible_password: change_me - cartridge_app_name: myapp - cartridge_cluster_cookie: myapp-cookie diff --git a/test/resources/test-chaotic-cluster.genin.yaml b/test/resources/test-chaotic-cluster.genin.yaml deleted file mode 100644 index d03e8c4..0000000 --- a/test/resources/test-chaotic-cluster.genin.yaml +++ /dev/null @@ -1,68 +0,0 @@ ---- -instances: - - name: api - count: 1 - replicas: 0 - weight: 10 - roles: - - api - - name: calculator - count: 1 - replicas: 0 - weight: 10 - roles: - - calculator - - name: storage - type: storage - count: 2 - replicas: 2 - weight: 10 - roles: - - storage - config: - memtx_memory: 1179869184 - vinyl_memory: 10345452343 - - name: cache - type: storage - count: 2 - replicas: 2 - weight: 10 - roles: - - storage - - name: router - type: router - count: 1 - replicas: 0 - weight: 10 - roles: - - router - - failover-coordinator -hosts: - - name: docker - type: datacenter - ports: - http: 8100 - binary: 5002 - hosts: - - name: host-1 - ip: 10.99.16.65 - - name: host-2 - ip: 10.99.16.66 - - name: host-3 - ip: 10.99.16.67 - - name: host-4 - ip: 10.99.16.68 -failover: - mode: stateful - state_provider: stateboard - stateboard_params: - uri: - ip: 10.99.16.66 - port: 5001 - password: genin-app -vars: - ansible_user: ansible - ansible_password: ansible - cartridge_app_name: genin-app - cartridge_cluster_cookie: genin-app-secret-cookie - diff --git a/test/resources/test-cluster-uncomplete.genin.yaml b/test/resources/test-cluster-uncomplete.genin.yaml deleted file mode 100644 index ccc0a03..0000000 --- a/test/resources/test-cluster-uncomplete.genin.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -instances: - - name: storage - type: storage - count: 2 - replicas: 2 - weight: 10 - roles: - - storage - - name: router - type: router - count: 1 - replicas: 0 - weight: 10 - roles: - - router - - api - - failover-coordinator -hosts: - - name: cloud - type: datacenter - ports: - http: 8081 - binary: 3031 - hosts: - - name: host-1 - ip: 192.168.16.1 - - name: host-2 - ip: 192.168.16.2 -failover: - state_provider: stateboard - stateboard_params: - password: some_password -vars: - ansible_user: root - ansible_password: change_me - cartridge_app_name: myapp - cartridge_cluster_cookie: myapp-cookie diff --git a/test/resources/test-cluster.genin.yaml b/test/resources/test-cluster.genin.yaml index cf4acbd..3100d96 100644 --- a/test/resources/test-cluster.genin.yaml +++ b/test/resources/test-cluster.genin.yaml @@ -1,40 +1,53 @@ --- -instances: - - name: storage - type: storage - count: 2 - replicas: 2 - weight: 10 - roles: - - storage +topology: - name: router - type: router - count: 1 - roles: - - router - - api - - failover-coordinator + replicasets_count: 1 # How many masters we want, by default equal 1 + replication_factor: 0 # Number of replicas in replicaset, default 0 + roles: [ router, failover-coordinator ] + weight: 10 # Vshard replicaset weight (matters only if `vshard-storage` role is enabled) + cartridge_extra_env: # Environment variables for instance service (systemd service) + REMOTE_SERVER: db1.pg.svc.cluster.local + REMOTE_USER: user + REMOTE_PASSWORD: password + config: # Config with arbitrary key-values pairs + http_port: 8080 # Specify http port to start counting from + binary_port: 3031 # Specify binary port to start counting from + all_rw: false # A flag indicating that all servers in the replicaset should be read-write + zone: server-1 # Zone parameter for ansible cartridge playbook + vshard_group: # Vshard group for vshard-storage + additional_config: # Additional parameters to be added to the host config + server_url: foo.bar.baz + vars: # Ansible wars to be added to hosts + ansible_user: user + ansible_password: password + - name: storage + replicasets_count: 2 # How many masters we want, by default equal 1 + replication_factor: 1 # Number of replicas in replicaset, default 0 + roles: [ storage ] hosts: - - name: cloud - type: datacenter - ports: - http: 8081 - binary: 3031 + - name: datacenter-1 + config: + http_port: 8090 # Specify http port to start counting from + binary_port: 3510 # Specify binary port to start counting from hosts: - - name: host-1 - ip: 192.168.16.1 - - name: host-2 - ip: 192.168.16.2 + - name: server-1 + config: + http_port: 9000 # Specify http port to start counting from + binary_port: 5001 # Specify binary port to start counting from + address: 192.168.10.100 # Host or instance address (maybe IP or URI) + - name: server-2 + config: + address: 182.168.10.2 # Host or instance address (maybe IP or URI) failover: - mode: stateful - state_provider: stateboard + mode: stateful # Failover mode (stateful, eventual, disabled) + state_provider: stateboard # What is serve failover (stateboard, stateful) stateboard_params: - uri: 192.168.16.1:4401 - password: some_password + uri: 192.168.10.2:4040 # Uri on which the stateboard will be available (ip:port) + password: secret # Stateboard password vars: - ansible_user: root - ansible_password: change_me - cartridge_app_name: myapp - cartridge_cluster_cookie: myapp-cookie - cartridge_package_path: /tmp/myapp.rpm + ansible_user: vagrant # Username under which the ansible will connect to the servers + ansible_password: vagrant # Ansible's user password + cartridge_app_name: test + cartridge_cluster_cookie: test # Cookie for connecting to the administrative console of the instances + cartridge_package_path: /tmp/test.rpm # Path to the application package cartridge_bootstrap_vshard: true diff --git a/test/resources/test-giant-cluster.genin.yaml b/test/resources/test-giant-cluster.genin.yaml deleted file mode 100644 index 57cfc49..0000000 --- a/test/resources/test-giant-cluster.genin.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -instances: - - name: type-1-storage - type: storage - count: 10 - replicas: 3 - weight: 10 - roles: - - storage - - v1-api - - name: type-2-storage - type: storage - count: 10 - replicas: 3 - weight: 10 - roles: - - storage - - v2-api - - name: router - type: router - count: 10 - replicas: 0 - weight: 10 - roles: - - router - - api - - failover-coordinator - - name: connector - count: 5 - replicas: 0 - weight: 10 - roles: - - connector - - name: probe-meter - count: 5 - replicas: 0 - weight: 10 - roles: - - probe-meter - - name: metrics - count: 10 - replicas: 0 - weight: 10 - roles: - - metrics -hosts: - - name: cloud - type: region - ports: - http: 8100 - binary: 3100 - hosts: - - name: moscow-7 - type: datacenter - hosts: - - name: msk-host-1 - ip: 192.168.16.1 - - name: msk-host-2 - ip: 192.168.16.2 - - name: msk-host-3 - ip: 192.168.16.3 - - name: msk-host-4 - ip: 192.168.16.4 - - name: msk-host-5 - ip: 192.168.16.5 - - name: spb-3 - type: datacenter - hosts: - - name: sbp-host-1 - ip: 192.168.16.1 - - name: spb-host-2 - ip: 192.168.16.2 - - name: spb-host-3 - ip: 192.168.16.3 - - name: spb-host-4 - ip: 192.168.16.4 - - name: spb-host-5 - ip: 192.168.16.5 -failover: - mode: stateful - state_provider: stateboard - stateboard_params: - uri: - ip: 192.168.16.1 - port: 4401 - password: change_me -vars: - ansible_user: root - ansible_password: change_me - cartridge_app_name: myapp - cartridge_cluster_cookie: myapp-cookie diff --git a/test/resources/test-upgrade-cluster.genin.yaml b/test/resources/test-upgrade-cluster.genin.yaml new file mode 100644 index 0000000..1c1e762 --- /dev/null +++ b/test/resources/test-upgrade-cluster.genin.yaml @@ -0,0 +1,53 @@ +--- +topology: + - name: router + replicasets_count: 2 # How many masters we want, by default equal 1 + replication_factor: 0 # Number of replicas in replicaset, default 0 + roles: [ router, failover-coordinator ] + weight: 10 # Vshard replicaset weight (matters only if `vshard-storage` role is enabled) + cartridge_extra_env: # Environment variables for instance service (systemd service) + REMOTE_SERVER: db1.pg.svc.cluster.local + REMOTE_USER: user + REMOTE_PASSWORD: password + config: # Config with arbitrary key-values pairs + http_port: 8080 # Specify http port to start counting from + binary_port: 3031 # Specify binary port to start counting from + all_rw: false # A flag indicating that all servers in the replicaset should be read-write + zone: server-1 # Zone parameter for ansible cartridge playbook + vshard_group: # Vshard group for vshard-storage + additional_config: # Additional parameters to be added to the host config + server_url: foo.bar.baz + vars: # Ansible wars to be added to hosts + ansible_user: user + ansible_password: password + - name: storage + replicasets_count: 5 # How many masters we want, by default equal 1 + replication_factor: 2 # Number of replicas in replicaset, default 0 + roles: [ storage ] +hosts: + - name: datacenter-1 + config: + http_port: 8090 # Specify http port to start counting from + binary_port: 3510 # Specify binary port to start counting from + hosts: + - name: server-1 + config: + http_port: 9000 # Specify http port to start counting from + binary_port: 5001 # Specify binary port to start counting from + address: 192.168.10.100 # Host or instance address (maybe IP or URI) + - name: server-2 + config: + address: 182.168.10.2 # Host or instance address (maybe IP or URI) +failover: + mode: stateful # Failover mode (stateful, eventual, disabled) + state_provider: stateboard # What is serve failover (stateboard, stateful) + stateboard_params: + uri: 192.168.10.2:4040 # Uri on which the stateboard will be available (ip:port) + password: secret # Stateboard password +vars: + ansible_user: vagrant # Username under which the ansible will connect to the servers + ansible_password: vagrant # Ansible's user password + cartridge_app_name: test + cartridge_cluster_cookie: test # Cookie for connecting to the administrative console of the instances + cartridge_package_path: /tmp/test.rpm # Path to the application package + cartridge_bootstrap_vshard: true