File: user_access.feature

package info (click to toggle)
crmsh 5.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,980 kB
  • sloc: python: 50,399; sh: 1,207; makefile: 255; xml: 243; exp: 234; awk: 22
file content (90 lines) | stat: -rw-r--r-- 4,330 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@user
Feature: Functional test for user access

  Need nodes: hanode1

  Scenario: User in haclient group
    Given   Cluster service is "stopped" on "hanode1"
    When    Run "useradd -m -s /bin/bash -N -g haclient xin1" on "hanode1"
    When    Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~xin1/.bashrc" on "hanode1"
    When    Run "echo "xin1 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin1" on "hanode1"
    When    Run "su - xin1 -c 'sudo crm cluster init -y'" on "hanode1"
    Then    Cluster service is "started" on "hanode1"
    And     Run "su - hacluster -c 'crm script run health'" OK on "hanode1"
    When    Run "su - xin1 -c 'crm node standby hanode1'" on "hanode1"
    Then    Node "hanode1" is standby

  @clean
  Scenario: User in sudoer
    Given   Cluster service is "stopped" on "hanode1"
    When    Run "useradd -m -s /bin/bash xin3" on "hanode1"
    When    Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~xin3/.bashrc" on "hanode1"
    And     Run "echo "xin3 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin3" on "hanode1"
    When    Try "su - xin3 -c 'crm cluster init -y'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Please run this command starting with "sudo"
      """
    When    Run "su - xin3 -c 'sudo crm cluster init -y'" on "hanode1"
    Then    Cluster service is "started" on "hanode1"

    When    Try "su - xin3 -c 'crm node standby hanode1'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Please run this command starting with "sudo"
      """
    When    Run "su - xin3 -c 'sudo crm node standby hanode1'" on "hanode1"
    Then    Node "hanode1" is standby

  @clean
  Scenario: Normal user access
    Given   Cluster service is "stopped" on "hanode1"
    When    Run "useradd -m -s /bin/bash user1" on "hanode1"
    When    Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~user1/.bashrc" on "hanode1"
    When    Try "su - user1 -c 'crm cluster init -y'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Operation is denied. The current user lacks the necessary privilege.
      """
    When    Run "echo "user1 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user1" on "hanode1"
    When    Try "su - user1 -c 'crm cluster init -y'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Please run this command starting with "sudo"
      """
    When    Run "su - user1 -c 'sudo crm cluster init -y'" on "hanode1"
    Then    Cluster service is "started" on "hanode1"

    When    Run "useradd -m -s /bin/bash user2" on "hanode1"
    When    Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~user2/.bashrc" on "hanode1"
    When    Try "su - user2 -c 'crm node standby hanode1'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Operation is denied. The current user lacks the necessary privilege.
      """
    When    Run "usermod -g haclient user2" on "hanode1"
    When    Run "su - user2 -c 'crm node standby hanode1'" on "hanode1"
    Then    Node "hanode1" is standby

    When    Run "useradd -m -s /bin/bash user3" on "hanode1"
    When    Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~user3/.bashrc" on "hanode1"
    When    Try "su - user3 -c 'crm node online hanode1'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Operation is denied. The current user lacks the necessary privilege.
      """
    When    Run "echo "user3 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user3" on "hanode1"
    When    Try "su - user3 -c 'crm node online hanode1'"
    Then    Except multiple lines
      """
      WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
      ERROR: Please run this command starting with "sudo"
      """
    When    Run "su - user3 -c 'sudo crm node online hanode1'" on "hanode1"
    Then    Node "hanode1" is online