-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Motivation Extended e2e tests coverage with `sloctl aws-iam-ids` command. ## Summary Added `DEVELOPMENT.md` which should answer some of the questions in regards to the development workflow.
- Loading branch information
1 parent
5c586be
commit 651eb05
Showing
4 changed files
with
130 additions
and
1 deletion.
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,72 @@ | ||
# Development | ||
|
||
This document describes the intricacies of sloctl development workflow. | ||
|
||
## Makefile | ||
|
||
Run `make help` to display short description for each target. | ||
The provided Makefile will automatically install dev dependencies if they're | ||
missing and place them under `bin` | ||
(this does not apply to `yarn` managed dependencies). | ||
However, it does not detect if the binary you have is up to date with the | ||
versions declaration located in Makefile. | ||
If you see any discrepancies between CI and your local runs, remove the | ||
binaries from `bin` and let Makefile reinstall them with the latest version. | ||
|
||
## Testing | ||
|
||
In addition to standard unit tests, sloctl is tested with | ||
[bats](https://bats-core.readthedocs.io/en/stable/) framework. | ||
Bats is a testing framework for Bash, it provides a simple way to verify | ||
that shell programs behave as expected. | ||
Bats tests are located under `test` directory. | ||
Each test file ends with `.bats` suffix. | ||
In addition to helper test utilities which are part of the framework we also | ||
provide custom helpers which are located in `test/test_helper` directory. | ||
|
||
Bats tests are currently divided into 2 categories, end-to-end and unit tests. | ||
The categorization is done through Bats tags. In order to categorize a whole | ||
file as a unit test, add this comment: `# bats file_tags=unit` anywhere in the | ||
file, preferably just below shebang. | ||
|
||
The end-to-end tests are only run automatically for releases, be it official | ||
version or pre-release (release candidate). | ||
The tests are executed against the production application. | ||
If you want to run the tests manually against a different environment, you can | ||
run the following command: | ||
|
||
```shell | ||
SLOCTL_CLIENT_ID=<client_id> \ | ||
SLOCTL_CLIENT_SECRET=<client_secret> \ | ||
SLOCTL_OKTA_ORG_URL=https://accounts.nobl9.dev \ | ||
SLOCTL_OKTA_AUTH_SERVER=<dev_auth_server> \ # Runs against dev Okta. | ||
make test/e2e | ||
``` | ||
|
||
Bats tests are fully containerized, refer to Makefile for more details on | ||
how they're executed. | ||
|
||
## Releases | ||
|
||
We're using [Release Drafter](https://github.com/release-drafter/release-drafter) | ||
to automate release notes creation. Drafter also does its best to propose | ||
the next release version based on commit messages from `main` branch. | ||
|
||
Release Drafter is also responsible for auto-labeling of pull requests. | ||
It checks both title and body of pull request and adds appropriate labels. \ | ||
**NOTE:** The auto-labeling mechanism will not remove labels once they're | ||
created. For example, If you end up changing PR title from `sec:` to `fix:` | ||
you'll have to manually remove `security` label. | ||
|
||
On each commit to `main` branch, Release Drafter will update the next release | ||
draft. Once you're ready to create new version, simply publish the draft. | ||
|
||
In addition to Release Drafter, we're also running a script which extracts | ||
explicitly listed release notes and breaking changes which are optionally | ||
defined in `## Release Notes` and `## Breaking Changes` headers. | ||
|
||
## Dependencies | ||
|
||
Renovate is configured to automatically merge minor and patch updates. | ||
For major versions, which sadly includes GitHub Actions, manual approval | ||
is required. |
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,36 @@ | ||
#!/usr/bin/env bash | ||
# bats file_tags=e2e | ||
|
||
# setup_file is run only once for the whole file. | ||
setup_file() { | ||
load "test_helper/load" | ||
load_lib "bats-assert" | ||
|
||
generate_inputs "$BATS_FILE_TMPDIR" | ||
run_sloctl apply -f "'$TEST_INPUTS/**'" | ||
assert_success | ||
} | ||
|
||
# teardown_file is run only once for the whole file. | ||
teardown_file() { | ||
run_sloctl delete -f "'$TEST_INPUTS/**'" | ||
} | ||
|
||
# setup is run before each test. | ||
setup() { | ||
load "test_helper/load" | ||
load_lib "bats-support" | ||
load_lib "bats-assert" | ||
} | ||
|
||
@test "dataexport" { | ||
run_sloctl aws-iam-ids dataexport | ||
assert_success | ||
assert_output --regexp "[-a-zA-Z0-9]+" | ||
} | ||
|
||
@test "direct" { | ||
run_sloctl aws-iam-ids direct splunk-observability-direct | ||
assert_success | ||
assert_output --regexp "externalID: [-a-zA-Z0-9]+\naccountID: \"\d+\"" | ||
} |
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,20 @@ | ||
- apiVersion: n9/v1alpha | ||
kind: Project | ||
metadata: | ||
name: death-star | ||
spec: | ||
description: Dummy Project for 'sloctl aws-iam-ids' e2e tests | ||
- apiVersion: n9/v1alpha | ||
kind: Direct | ||
metadata: | ||
name: splunk-observability-direct | ||
displayName: Splunk Observability direct | ||
project: death-star | ||
spec: | ||
description: This Direct is just for the e2e 'sloctl aws-iam-ids' tests, it's not supposed to work! | ||
sourceOf: | ||
- Metrics | ||
- Services | ||
splunkObservability: | ||
realm: us1 | ||
accessToken: super-secret |