Skip to content
Snippets Groups Projects
Commit da5ce6ed authored by Tamaki Fujino's avatar Tamaki Fujino Committed by Yas Naoi
Browse files

Issue #3271742 by TamakiFujino, yas, kumikoono: Add a BDD test suite for creating resources

parent a079901b
No related branches found
No related tags found
4 merge requests!1759Issue #3356778: Release 5.1.1,!1679Issue #3349074: Fix the OpenStack Project create and edit form in SPA that "Member" cannot be saved due to a validation error,!1607Issue #3343582: Add the function to preview OpenStack stack in the SPA,!1032Issue #3284576: Release 5.0.0-alpha2
......@@ -28,6 +28,12 @@ Feature: Create resources for K8s as "Administrator"
And I should see "{{ role_name }}"
Then I visit "admin/people/permissions/{{ role_name_machine }}"
# Need to set "any" since each scenario creates a new user.
# 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"
And I check the box "Access entities belonging to k8s namespace kube-public"
And I check the box "Access entities belonging to k8s namespace kube-system"
And I check the box "Access entities belonging to k8s namespace kubernetes-dashboard"
# Delete permission
And I check the box "Delete any K8s API service"
And I check the box "Delete any K8s ConfigMap"
......
Feature: Create resources for K8s as "Authenticated User"
As a user
I need to create pod and deployment
@api
Scenario: Log into the site
Given I am logged in as a user with the "{{ role_name }}" role
When I visit "/clouds"
Then I should see the heading "Cloud service providers"
And I should see the link "All" in the "nav_bar"
And I should see the link "K8s" in the "nav_bar"
@api @javascript
Scenario: Create a pod
Given I am logged in as a user with the "{{ role_name }}" role
When I visit "/clouds/k8s/{{ cloud_context }}/pod/add"
And I should see the heading "Add Pod"
And I select "{{ namespace }}" from "Namespace"
And I fill in "Detail" with:
"""
apiVersion: v1
kind: Pod
metadata:
name: {{ pod_name }}
spec:
containers:
- name: {{ container_name }}
image: {{ image_version }}
ports:
- containerPort: {{ port }}
"""
And I press "Save"
And I wait for AJAX to finish
Then the url should match "/clouds/k8s/{{ cloud_context }}/pod"
And I should see "has been created"
And I should see "nginx" in the "{{ namespace }}" row
@api @javascript
Scenario: Create a deployment
Given I am logged in as a user with the "{{ role_name }}" role
When I visit "/clouds/k8s/{{ cloud_context }}/deployment/add"
And I select "{{ namespace }}" from "Namespace"
And I fill in "Detail" with:
"""
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ deployment_name }}
labels:
app: {{ app_name }}
spec:
replicas: {{ replica_count }}
selector:
matchLabels:
app: {{ app_name }}
template:
metadata:
labels:
app: {{ app_name }}
spec:
containers:
- name: {{ container_name }}
image: {{ image_version }}
ports:
- containerPort: {{ port }}
"""
And I press "Save"
And I wait for AJAX to finish
Then I should be on "/clouds/k8s/{{ cloud_context }}/deployment"
And I should see "has been created"
And I should see "nginx-deployment" in the "{{ namespace }}" row
......@@ -2,13 +2,29 @@
# '@Random' is a reserved term to be replaced by a random string.
# '@random' is in lower cases, and '@RANDOM' is in uppercase.
app_name:
nginx
cloud_context:
# The region is automatically set as suffix.
bdd_k8s_@random
container_name:
nginx
deployment_name:
nginx-deployment
image_version:
nginx:1.14.2
k8s_cloud_service_provider_name_entered:
BDD_K8s_@Random
k8s_cloud_service_provider_name:
BDD_K8s_@Random
namespace:
default
pod_name:
nginx
port:
80
replica_count:
3
role_name:
BDD_Role_@Random
role_name_machine:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment