Closed exequielrafaela closed 2 years ago
tests
folder:
Folder holds test file and .tfvars
with expected values
Layer directories can be concatenated and bats only invoked once
.tfvars
to layer directory
leverage tf init
leverage tf plan -detailed-exitcode
leverage tf apply
3.2. leverage tf output -json
3.3. Use jq
and bats_assert
to compare against .tfvars
leverage tf plan
output as comment to PRapps-prd/base-identities
@angelofenoglio @diego-ojeda-binbash the testing approach looks very promising. Couldn't wait to see the 1st workflow in place 🙌🏼 💪🏼
init
, plan
, apply
, destroy
commands will be executed checking for no errors.@angelofenoglio thanks for everything, @juanmatias will be collaborating with this task from now on 💪🏼
@juanmatias let's create another issue in order to test the leverage CLI dependency package binaries that could be found here:
Eg test-cases (1st document and in a 2nd iteration automte)
CC: @angelofenoglio @diego-ojeda-binbash
tests were not working
tests will work as soon as PR are merged in both repos
Things that have been done here:
set param with quotes due it being take as an int literal in other case
client_payload: '{"leverage_branch": "${{ github.ref }}"}'
github app needed permissions for write in actions in order to trigger with dispatch here: https://github.com/organizations/binbashar/settings/apps/bb-le-cli-ref-arch-trigger/permissions permission: Actions (Workflows, workflow runs and artifacts) also in the repo (https://github.com/binbashar/le-tf-infra-aws/) this action has to be confirmed
ref to branch in target repo added
by default the action will take main
while we are using master
, so this line was added to the source trigger action:
ref: master
var scope fixed: from this
github_token: ${{ steps.authentication.output.token }}
to this
github_token: ${{ steps.authentication.outputs.token }}
in refarch action switched from private clone to public one:
# from this
git clone git@github.com:binbashar/leverage.git
# to this
git clone https://github.com/binbashar/leverage.git
adding pipenv to the runner with this command in the target action
if ! (which pipenv 2>/dev/null); then echo 'Installing pipenv...' && pip install pipenv && pipenv --python $(which python) ; else echo 'pipenv is already installed'; fi
added a step to set the toolbox version: Set Leverage Toolbox version since tests are using a build.env already set in the refarch repo, there's a need of set the version based on the CLI version
credentials for aws
.aws/config
file.aws/credentials
file
the command aws configure set
, when used to set the source profile, stores the access key id in the config file and then, for the source profile, stores the access key in config file and secret in credentials one.
but when using terraform there is a sort of a bug, and both the access key and the secret must be stored in the credentials file for the source profilecredentials for programmatic user access were reset
cc @exequielrafaela @angelofenoglio @diego-ojeda-binbash
@juanmatias as agreed we'll migrate all the test to the leverage cli
repo instead of having them segregated in the ref arch
one. Since this tests will give us a good testing baseline for the cli, we've also discussed about creating a new issue to start the discussions of the ref arch v1
specific minimum set of tests that could also help to have a better understanding of the different components versions (bringing more certainties for the current compatibility matrix that could be found in the doc).
CC: @diego-ojeda-binbash @angelofenoglio
A test was created in the Leverage CLI repo.
Now the test action has three jobs:
this last job does the following:
Please, @exequielrafaela @diego-ojeda-binbash @angelofenoglio , check this PR https://github.com/binbashar/leverage/pull/136
What?
✅ Repo CLI:
leverage credentials
leverage project create
✅ Repo Ref Arch: create automated, functional tests; that run on-demand and at the moment of releasing a new version of the CLI; it is necessary to define well which accounts and layers will be included since it can become very complex depending the test-cases.
Why?
Having the proper level of testings
➕ Makes the Process Agile ➕ Quality of Code ➕ Finds Software Bugs Early ➕ Facilitates Changes and Simplifies Integration ➕ Provides Documentation ➕ Debugging Process ➕ Design ➕ Reduce Costs
@diego-ojeda-binbash OJ we'll wait for your review and feedback here in order to segregate this Testing Epic in the proper specific issues. Thanks in advance!
CC: @binbashar/leverage-ref-architecture-aws-dev @binbashar/leverage-ref-architecture-aws-admin