Skip to content

Commit

Permalink
fixup! Dev: behave: adjust functional tests for previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyang2022 committed Oct 26, 2023
1 parent 4215dd0 commit ae01552
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 52 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/crmsh-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,18 @@ jobs:
$DOCKER_SCRIPT `$GET_INDEX_OF user_access`
- uses: codecov/codecov-action@v3

functional_test_ssh_agent:
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
- name: functional test for user access
run: |
echo '{ "exec-opts": ["native.cgroupdriver=systemd"] }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker.service
$DOCKER_SCRIPT `$GET_INDEX_OF ssh_agent`
- uses: codecov/codecov-action@v3

original_regression_test:
runs-on: ubuntu-20.04
timeout-minutes: 40
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ coverage:
codecov:
token: 16b01c29-3b23-4923-b33a-4d26a49d80c4
notify:
after_n_builds: 22
after_n_builds: 23
comment:
after_n_builds: 22
after_n_builds: 23
22 changes: 0 additions & 22 deletions test/features/bootstrap_options.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim: sw=2 sts=2
@bootstrap
Feature: crmsh bootstrap process - options

Expand Down Expand Up @@ -158,24 +157,3 @@ Feature: crmsh bootstrap process - options
When Run "crm cluster init csync2 -y" on "hanode1"
Then Service "csync2.socket" is "started" on "hanode1"
And Service "csync2.socket" is "started" on "hanode2"

@clean @skip_non_root
Scenario: Skip creating ssh key pairs with --use-ssh-agent
Given Directory "/root/.ssh" is renamed to "/root/ssh_disabled" on nodes ["hanode1", "hanode2"]
And ssh-agent is started at "/root/ssh-auth-sock" on nodes ["hanode1", "hanode2"]
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock ssh-add /root/ssh_disabled/id_rsa" on "hanode1,hanode2"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init --use-ssh-agent -y" on "hanode1"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster join --use-ssh-agent -y -c hanode1" on "hanode2"
Then Cluster service is "started" on "hanode1"
And Run "test x1 == x$(awk 'END {print NR}' ~root/.ssh/authorized_keys)" OK
And Run "test x2 == x$(awk 'END {print NR}' ~hacluster/.ssh/authorized_keys)" OK

@clean @skip_non_root
Scenario: Skip creating ssh key pairs with --use-ssh-agent and use -N
Given Directory "/root/.ssh" is renamed to "/root/ssh_disabled" on nodes ["hanode1", "hanode2"]
And ssh-agent is started at "/root/ssh-auth-sock" on nodes ["hanode1", "hanode2"]
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock ssh-add /root/ssh_disabled/id_rsa" on "hanode1,hanode2"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init --use-ssh-agent -y -N hanode2" on "hanode1"
Then Cluster service is "started" on "hanode2"
And Run "test x1 == x$(awk 'END {print NR}' ~root/.ssh/authorized_keys)" on "hanod2"
And Run "test x2 == x$(awk 'END {print NR}' ~hacluster/.ssh/authorized_keys)" on "hanode2"
29 changes: 1 addition & 28 deletions test/features/geo_setup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Feature: geo cluster
Tag @clean means need to stop cluster service if the service is available
Need nodes: hanode1 hanode2 hanode3

@clean
Scenario: GEO cluster setup
Given Cluster service is "stopped" on "hanode1"
And Cluster service is "stopped" on "hanode2"
Expand All @@ -26,31 +27,3 @@ Feature: geo cluster
Then Show cluster status on "hanode1"
When Run "crm resource start g-booth" on "hanode2"
Then Show cluster status on "hanode2"

Scenario: GEO cluster setup with ssh-agent
When Run "crm cluster stop" on "hanode1"
And Run "crm cluster stop" on "hanode2"
And Run "systemctl disable --now booth@booth" on "hanode1,hanode2,hanode3"
Given Cluster service is "stopped" on "hanode1"
And Cluster service is "stopped" on "hanode2"
And Directory "/root/.ssh" is renamed to "/root/ssh_disabled" on nodes ["hanode1", "hanode2", "hanode3"]
And ssh-agent is started at "/root/ssh-auth-sock" on nodes ["hanode1", "hanode2", "hanode3"]
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock ssh-add /root/ssh_disabled/id_rsa" on "hanode1,hanode2,hanode3"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init -y -n cluster1 --use-ssh-agent" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Run "crm configure primitive vip IPaddr2 params [email protected]" on "hanode1"

When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init -y -n cluster2 --use-ssh-agent" on "hanode2"
Then Cluster service is "started" on "hanode2"
When Run "crm configure primitive vip IPaddr2 params [email protected]" on "hanode2"

When Run "crm cluster geo_init -y --clusters "cluster1=@vip.0 cluster2=@vip.1" --tickets tickets-geo --arbitrator hanode3" on "hanode1"
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster geo_join -y --use-ssh-agent --cluster-node hanode1 --clusters "[email protected] [email protected]"" on "hanode2"
Given Service "booth@booth" is "stopped" on "hanode3"
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster geo_init_arbitrator -y --use-ssh-agent --cluster-node hanode1" on "hanode3"
Then Service "booth@booth" is "started" on "hanode3"
When Run "crm resource start g-booth" on "hanode1"
Then Show cluster status on "hanode1"
When Run "crm resource start g-booth" on "hanode2"
Then Show cluster status on "hanode2"
48 changes: 48 additions & 0 deletions test/features/ssh_agent.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# vim: sw=2 sts=2
Feature: ssh-agent support

Test ssh-agent support for crmsh
Need nodes: hanode1 hanode2 hanode3

Scenario: Skip creating ssh key pairs with --use-ssh-agent
Given Run "mkdir /root/ssh_disabled && mv /root/.ssh/id_* /root/ssh_disabled" OK on "hanode1,hanode2,hanode3"
And ssh-agent is started at "/root/ssh-auth-sock" on nodes ["hanode1", "hanode2", "hanode3"]
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock ssh-add /root/ssh_disabled/id_rsa" on "hanode1,hanode2,hanode3"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init --use-ssh-agent -y" on "hanode1"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster join --use-ssh-agent -y -c hanode1" on "hanode2"
And Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster join --use-ssh-agent -y -c hanode1" on "hanode3"
Then Cluster service is "started" on "hanode1"
And Run "test x1 == x$(awk 'END {print NR}' ~root/.ssh/authorized_keys)" OK
And Run "test x3 == x$(awk 'END {print NR}' ~hacluster/.ssh/authorized_keys)" OK

Scenario: Skip creating ssh key pairs with --use-ssh-agent and use -N
Given Run "crm cluster stop" OK on "hanode1,hanode2,hanode3"
And Run "systemctl disable --now booth@booth" OK on "hanode1,hanode2,hanode3"
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init --use-ssh-agent -y -N hanode2 -N hanode3" on "hanode1"
Then Cluster service is "started" on "hanode3"
And Run "test x1 == x$(awk 'END {print NR}' ~root/.ssh/authorized_keys)" OK on "hanode3"
And Run "test x3 == x$(awk 'END {print NR}' ~hacluster/.ssh/authorized_keys)" OK on "hanode3"

Scenario: GEO cluster setup with ssh-agent
Given Run "crm cluster stop" OK on "hanode1,hanode2,hanode3"
And Run "systemctl disable --now booth@booth" OK on "hanode1,hanode2,hanode3"
And Cluster service is "stopped" on "hanode1"
And Cluster service is "stopped" on "hanode2"
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init -y -n cluster1 --use-ssh-agent" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Run "crm configure primitive vip IPaddr2 params [email protected]" on "hanode1"

When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster init -y -n cluster2 --use-ssh-agent" on "hanode2"
Then Cluster service is "started" on "hanode2"
When Run "crm configure primitive vip IPaddr2 params [email protected]" on "hanode2"

When Run "crm cluster geo_init -y --clusters "cluster1=@vip.0 cluster2=@vip.1" --tickets tickets-geo --arbitrator hanode3" on "hanode1"
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster geo_join -y --use-ssh-agent --cluster-node hanode1 --clusters "[email protected] [email protected]"" on "hanode2"
Given Service "booth@booth" is "stopped" on "hanode3"
When Run "SSH_AUTH_SOCK=/root/ssh-auth-sock crm cluster geo_init_arbitrator -y --use-ssh-agent --cluster-node hanode1" on "hanode3"
Then Service "booth@booth" is "started" on "hanode3"
When Run "crm resource start g-booth" on "hanode1"
Then Show cluster status on "hanode1"
When Run "crm resource start g-booth" on "hanode2"
Then Show cluster status on "hanode2"

0 comments on commit ae01552

Please sign in to comment.