Skip to content

Commit

Permalink
Add a test that covers a situation where one secret path doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
apruszynski authored and marek-jakubowski committed Aug 14, 2024
1 parent 1554231 commit 63e934e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions acceptance/features/fetching_secrets.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ Feature: fetching secrets
And a secret "very/secret/db-password" with "notSoSecret"
When I successfully run `summon -p ./provider env`
Then the output should contain "DB_PASSWORD=notSoSecret"

Scenario: Fetching a database username and non existent password
Given a file named "secrets.yml" with:
"""
DB_USERNAME: !var very/secret/db-username
DB_PASSWORD: !var very/secret/db-password-non-existent
"""
And a secret "very/secret/db-username" with "secretUsername"
And a non-existent secret "very/secret/db-password-non-existent"
When I run `summon -p ./provider env`
Then the output should contain "Error fetching variable DB_PASSWORD"
12 changes: 12 additions & 0 deletions acceptance/features/step_definitions/secret_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,15 @@
"""
}
end

Given(/^a non-existent secret "([^"]*)"$/) do |name|
steps %{
Given I append to "provider" with:
"""
if [ "$1" == "#{name}" ]; then
echo "Error fetching variable #{name}" >&2
exit 1
fi
"""
}
end

0 comments on commit 63e934e

Please sign in to comment.