forked from vmoravec/cct
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for barclamp_keystone #27
Open
mmnelemane
wants to merge
1
commit into
SUSE-Cloud:master
Choose a base branch
from
mmnelemane:test-keystone
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@keystone | ||
Feature: Tests Openstack Keystone barclamp | ||
As an actor | ||
I want to perform various validations | ||
In order to verify the feature functionality | ||
|
||
Background: | ||
Given the chef role "keystone-server" exists on admin node | ||
And the "keystone" cookbook exists on the admin node | ||
|
||
Scenario: Keystone deployment and functioning | ||
Given the barclamp proposal is using the keystone identity service | ||
When the node with keystone-server role has been detected successfully | ||
And the "python-keystone" is installed in the controller node | ||
And the "python-openstackclient" is installed in the controller node | ||
Then I can create a new project "cucumber_test" on the cloud | ||
And I can create a new user "cucumber_user" for the "cucumber_test" project | ||
And I can see the list of all available hosts on the cloud | ||
And I can delete the project "cucumber_test" and user "cucumber_user" | ||
|
||
|
44 changes: 44 additions & 0 deletions
44
features/step_definitions/barclamp_keystone/keystone_steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Given(/^the barclamp proposal is using the keystone identity service$/) do | ||
json_response = JSON.parse(admin_node.exec!("crowbar keystone show default").output) | ||
@node_fqdn = json_response["deployment"]["keystone"]["elements"]["keystone-server"][0] | ||
expect(@node_fqdn).not_to be_empty | ||
end | ||
|
||
When(/^the node with keystone-server role has been detected successfully$/) do | ||
user_list = control_node.openstack.user.list | ||
expect(user_list).not_to be_empty | ||
end | ||
|
||
And(/^the "([^"]*)" is installed in the controller node$/) do |test_package| | ||
control_node.rpm_q(test_package) | ||
end | ||
|
||
And(/^the "([^"]*)" is installed on the controller node$/) do |client_package| | ||
control_node.rpm_q(client_package) | ||
end | ||
|
||
Then(/^I can create a new project "([^"]*)" on the cloud$/) do |project_name| | ||
response = control_node.openstack.project.create(project_name) | ||
puts "Project #{response.name} created with ID: #{response.id}" | ||
expect(response.name).to eq(project_name) | ||
end | ||
|
||
And(/^I can create a new user "([^"]*)" for the "([^"]*)" project$/) do |user_name, project_name| | ||
response = control_node.openstack.user.create(user_name, | ||
project: project_name) | ||
puts "Created user #{response.name} on Project : #{response.project_id}" | ||
expect(response.name).to eq(user_name) | ||
end | ||
|
||
And(/^I can see the list of all available hosts on the cloud$/) do | ||
host_list = control_node.openstack.host.list | ||
puts "List of hosts available" | ||
host_list.each do |host| | ||
puts "Name: #{host.name} Service: #{host.service} Zone: #{host.zone}" | ||
end | ||
end | ||
|
||
And(/^I can delete the project "([^"]*)" and user "([^"]*)"$/) do |project_name, user_name| | ||
control_node.openstack.user.delete(user_name) | ||
control_node.openstack.project.delete(project_name) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Cct | ||
module Commands | ||
module Openstack | ||
class Host < Command | ||
self.command = "host" | ||
|
||
def list *options | ||
super(*(options << {row: Struct.new(:name, :service, :zone)})) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace :feature do | ||
feature_name "Tests Openstack Keystone barclamp" | ||
|
||
namespace :barclamp do | ||
desc "Barclamp Keystone feature" | ||
feature_task :keystone, tags: :@keystone | ||
|
||
desc "Verification of 'Tests Openstack Keystone barclamp' feature" | ||
feature_task :all | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all (or most of) the OpenStack CLI code is already available upstream. See i.e. https://github.com/openstack/python-openstackclient/blob/master/functional/tests/identity/v2/test_project.py . Why are not using that code (and extend it if needed)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to add checks for SSL,PKI and Tokens instead of using openstack client tests here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client uses SSL and PKI tokens if that's what was deployed. AFAIR we agreed to not check things like "Feature A was enabled, now check if Feature A is really enabled". That will be done with
crowbar_batch
. Or am I missunderstanding your question?