From 1237e1d5aca3db1827d3548d3187154adf118f39 Mon Sep 17 00:00:00 2001 From: Sushanta Das Date: Tue, 12 Nov 2024 11:07:33 +0530 Subject: [PATCH] Fix linter issues --- README.md | 14 ++++++-------- task/git-clone/0.1/tests/pre-apply-taskrun-hook.sh | 2 +- test/common.sh | 2 +- test/run-test.sh | 2 +- test/test-tasks.sh | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6becf0c4d5..94acc1f0d1 100644 --- a/README.md +++ b/README.md @@ -134,8 +134,10 @@ 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 @@ -143,6 +145,8 @@ We can use the functionality of running scripts before applying the tested task 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. @@ -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. diff --git a/task/git-clone/0.1/tests/pre-apply-taskrun-hook.sh b/task/git-clone/0.1/tests/pre-apply-taskrun-hook.sh index 232ece36d3..d01d25bb63 100644 --- a/task/git-clone/0.1/tests/pre-apply-taskrun-hook.sh +++ b/task/git-clone/0.1/tests/pre-apply-taskrun-hook.sh @@ -1,3 +1,3 @@ #!/bin/bash -echo "an example of pre-apply-taskrun-hook script" \ No newline at end of file +echo "an example of pre-apply-taskrun-hook script" diff --git a/test/common.sh b/test/common.sh index 6aa8455254..56a5797b39 100644 --- a/test/common.sh +++ b/test/common.sh @@ -273,4 +273,4 @@ function test_resource_creation() { cnt=$((cnt+1)) done set -x -} \ No newline at end of file +} diff --git a/test/run-test.sh b/test/run-test.sh index 921b8a3747..7347e342ac 100755 --- a/test/run-test.sh +++ b/test/run-test.sh @@ -44,4 +44,4 @@ if [[ ! -d ${resourcedir}/tests ]];then exit 1 fi -test_resource_creation ${RESOURCE}/${NAME}/${VERSION}/tests \ No newline at end of file +test_resource_creation ${RESOURCE}/${NAME}/${VERSION}/tests diff --git a/test/test-tasks.sh b/test/test-tasks.sh index 893aa4208d..59ed992cc1 100755 --- a/test/test-tasks.sh +++ b/test/test-tasks.sh @@ -75,4 +75,4 @@ function test_resources { test_resources "${all_tests}" -success \ No newline at end of file +success