Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tisutisu committed Nov 12, 2024
1 parent 1f9905d commit 1237e1d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,19 @@ Specify the Quay repository using the `QUAY_NAMESPACE` environment variable in t
## Testing Tasks
Tasks can be validated in the GithubActions CI setup with this repository.
If you have a directory called `tests/` inside the task directory, CI will create a random `Namespace`, validate the task using [tektor](https://github.com/lcarva/tektor), apply the task first in the namespace and then all the test yaml files (containing TaskRun or PipelineRun) inside the `tests` directory.
Tasks can be validated in the GithubActions CI setup with this repository.
If you have a directory called `tests/` inside the task directory, CI will create a random `Namespace`, apply the task first in the namespace and then all the test yaml files (containing TaskRun or PipelineRun) inside the `tests` directory.
We can use the functionality of running scripts before applying the tested task or the other yaml files. There are two different scripts that are automatically applied if present. These are applied using the `source` bash script:
- `pre-apply-task-hook.sh`: Script to run before applying the task, it can include `kubectl` commands to apply any kubernetes resources in the cluster
- `pre-apply-taskrun-hook.sh`: Script to run before applying the task run or pipeline run yaml files, it can also include `kubectl` commands to apply any kubernetes resources in the cluster
For example refer: Git Clone task [tests](./task/git-clone/0.1/tests/run.yaml)
CI also validates the task yamls using [tektor](https://github.com/lcarva/tektor)
### Running Task tests locally
Prerequisites: Deploy [upstream konflux](https://github.com/konflux-ci/konflux-ci?tab=readme-ov-file#bootstrapping-the-cluster) locally.
Expand All @@ -155,12 +159,6 @@ A helper script called `run-test.sh` is present inside `test` directory to help
and it will use your current kubernetes context to run the test and show you the outputs similar to the CI.
To run your task tests locally
### Prerequisites
- Deployed Konflux on the cluster (see [infra-deployments](https://github.com/redhat-appstudio/infra-deployments))
### Compliance
Task definitions must comply with the [Enterprise Contract](https://enterprisecontract.dev/) policies.
Expand Down
2 changes: 1 addition & 1 deletion task/git-clone/0.1/tests/pre-apply-taskrun-hook.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo "an example of pre-apply-taskrun-hook script"
echo "an example of pre-apply-taskrun-hook script"
2 changes: 1 addition & 1 deletion test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,4 @@ function test_resource_creation() {
cnt=$((cnt+1))
done
set -x
}
}
2 changes: 1 addition & 1 deletion test/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ if [[ ! -d ${resourcedir}/tests ]];then
exit 1
fi

test_resource_creation ${RESOURCE}/${NAME}/${VERSION}/tests
test_resource_creation ${RESOURCE}/${NAME}/${VERSION}/tests
2 changes: 1 addition & 1 deletion test/test-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ function test_resources {

test_resources "${all_tests}"

success
success

0 comments on commit 1237e1d

Please sign in to comment.