-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print Conjur version only on server startup (#1590)
* Print Conjur version only on server startup The print that we added didn't print the version only on server startup, and actually printed it for every `conjurctl` command. This commit changes this behaviour so the message is printed only on server startup. * Add changelog entry for printing Conjur version * Add cucumber test for conjurctl retrieve-key * Revert to original environment after each cucumber test Some test manipulate the env so we need to revert to the original one after each scenario. Co-authored-by: John Tuttle <[email protected]>
- Loading branch information
Showing
11 changed files
with
89 additions
and
7 deletions.
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
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
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
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,14 @@ | ||
Feature: Retrieving an API key with conjurctl | ||
|
||
Background: | ||
# We need to be in production environment to test this to demonstrate a real use-case | ||
Given I set environment variable "RAILS_ENV" to "production" | ||
And I set environment variable "CONJUR_LOG_LEVEL" to "info" | ||
|
||
Scenario: Retrieve an API key | ||
When I retrieve an API key for user "cucumber:user:admin" using conjurctl | ||
Then the API key is correct | ||
|
||
Scenario: Retrieve an API key of a non-existing user fails | ||
When I retrieve an API key for user "cucumber:user:non-existing-user" using conjurctl | ||
Then the stderr includes the error "role does not exist" |
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,14 @@ | ||
require 'open3' | ||
|
||
When(/^I retrieve an API key for user "([^"]*)" using conjurctl$/) do |user_id| | ||
command = "conjurctl role retrieve-key #{user_id}" | ||
@conjurctl_stdout, @conjurctl_stderr, = Open3.capture3(command) | ||
end | ||
|
||
Then(/^the API key is correct$/) do | ||
expect(@conjurctl_stdout).to eq("#{Credentials['cucumber:user:admin'].api_key}\n") | ||
end | ||
|
||
Then(/^the stderr includes the error "([^"]*)"$/) do |error| | ||
expect(@conjurctl_stderr).to include(error) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
Given(/^I set environment variable "([^"]*)" to "([^"]*)"$/) do |variable_name, variable_value| | ||
ENV[variable_name] = variable_value | ||
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
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