Skip to content
Snippets Groups Projects
Commit fb08af8c authored by shota niioka's avatar shota niioka Committed by Yas Naoi
Browse files

Issue #3280264 by shota niioka, kumikoono, yas: Add a BDD test suite for K8s...

Issue #3280264 by shota niioka, kumikoono, yas: Add a BDD test suite for K8s Roles (Create and Delete)
parent 623023bd
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,12 @@ Feature: Create a Drupal role for K8s and a user as "Administrator"
Scenario: Create a role
Given I am logged in as a user with the "Administrator" role
When I visit "/admin/people/roles/add"
And I enter "{{ role_name }}" for "Role name"
And I enter "{{ role_name_machine }}" for "Machine-readable name"
And I enter "{{ drupal_role_name }}" for "Role name"
And I enter "{{ drupal_role_name_machine }}" for "Machine-readable name"
And I press "Save"
And I should be on "/admin/people/roles"
And I should see "{{ role_name }}"
Then I visit "admin/people/permissions/{{ role_name_machine }}"
And I should see "{{ drupal_role_name }}"
Then I visit "admin/people/permissions/{{ drupal_role_name_machine }}"
# Access entities
And I check the box "Access entities belonging to k8s namespace default"
And I check the box "Access entities belonging to k8s namespace kube-node-lease"
......@@ -30,7 +30,7 @@ Feature: Create a Drupal role for K8s and a user as "Administrator"
And I enter "{{ user_name }}" for "Username"
And I enter "{{ user_password }}" for "Password"
And I enter "{{ user_password }}" for "Confirm password"
And I check the box "{{ role_name }}"
And I check the box "{{ drupal_role_name }}"
And I press "Create new account"
Then I should see "Created a new user account for"
And I visit "/admin/people"
......
......@@ -16,7 +16,7 @@ Feature: Create a namespace for K8s as "Authenticated User"
@api
Scenario: Update the role
Given I am logged in as a user with the "Administrator" role
When I visit "admin/people/permissions/{{ role_name_machine }}"
When I visit "admin/people/permissions/{{ drupal_role_name_machine }}"
And I check the box "Access entities belonging to k8s namespace {{ namespace }}"
And I press "Save permissions"
And I should see "The changes have been saved."
Feature: Create and Delete resources K8s as "Authenticated User"
As a user
I need to create and delete role
@api @javascript
Scenario: Create a role
Given I am logged in as user "{{ user_name }}"
When I visit "/clouds/k8s/{{ cloud_context }}/role/add"
And I should see the heading "Add Role"
And I select "{{ namespace }}" from "Namespace"
And I fill in "Detail" with:
"""
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ role_name }}
rules:
- apiGroups: ["{{ role_api }}"]
resources: ["{{ role_resource }}"]
verbs: ["{{ role_verb }}"]
"""
And I press "Save"
And I wait for AJAX to finish
Then the url should match "/clouds/k8s/{{ cloud_context }}/role"
And I should see "has been created"
And I should see "{{ role_name}}" in the "{{ namespace }}" row
@api @javascript
Scenario: Delete a role
Given I am logged in as user "{{ user_name }}"
When I visit "/clouds/k8s/{{ cloud_context }}/role"
And I click "Refresh"
And I should see the link "{{ role_name }}"
And I wait {{ wait }} milliseconds
And I click "{{ role_name }}"
And the url should match "/role/"
And I click "Delete"
And the url should match "/delete"
And I press "Delete"
And I should be on "/clouds/k8s/{{ cloud_context }}/role"
And I should see "has been deleted"
And I click "Refresh"
And I should not see the link "{{ role_name }}"
......@@ -4,12 +4,12 @@ Feature: Delete the created Drupal resources as "Administrator"
Scenario: Delete a created role
Given I am logged in as a user with the "Administrator" role
And I visit "/admin/people/roles"
And I should see "{{ role_name }}"
When I visit "/admin/people/roles/manage/{{ role_name_machine }}/delete?destination=/admin/people/roles"
And I should see "{{ drupal_role_name }}"
When I visit "/admin/people/roles/manage/{{ drupal_role_name_machine }}/delete?destination=/admin/people/roles"
And I press "Delete"
Then I should be on "/admin/people/roles"
And I should see "has been deleted."
And I should not see the link "{{ role_name }}"
And I should not see the link "{{ drupal_role_name }}"
@api @javascript
Scenario: Delete the created user
......
......@@ -23,6 +23,11 @@ daemonset_name:
bdd-daemonset-@random
deployment_name:
bdd-deployment-@random
drupal_role_name:
BDD_Role_@Random
drupal_role_name_machine:
# This should match the role_name in lowercase.
bdd_role_@random
endpoint_name:
bdd-endpoint-@random
image_version:
......@@ -64,11 +69,14 @@ replica_count:
3
replicaset_name:
bdd-replicaset-@random
role_api:
apps
role_name:
BDD_Role_@Random
role_name_machine:
# This should match the role_name in lowercase.
bdd_role_@random
bdd-role-@random
role_resource:
deployments
role_verb:
get
secret_name:
bdd-secret-@random
secret_key:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment