Skip to content

Commit

Permalink
skip deleting ns
Browse files Browse the repository at this point in the history
  • Loading branch information
tisutisu committed Sep 19, 2024
1 parent 27242a9 commit 2a1a820
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
22 changes: 19 additions & 3 deletions hack/common.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@

#!/bin/bash

CATALOG_TEST_SKIP_CLEANUP=true
TEST_NS=${TEST_NS:-"konflux-ci"}

# Define a custom kubectl path if you like
KUBECTL_CMD=${KUBECTL_CMD:-kubectl}

TEST_RESULT_FILE=/tmp/test-result

# Checks whether the given function exists.
function function_exists() {
[[ "$(type -t $1)" == "function" ]]
}

# Set the return code that the test script will return.
# Parameters: $1 - return code (0-255)
function set_test_return_code() {
# kubetest teardown might fail and thus incorrectly report failure of the
# script, even if the tests pass.
# We store the real test result to return it later, ignoring any teardown
# failure in kubetest.
# TODO(adrcunha): Get rid of this workaround.
echo -n "$1"> ${TEST_RESULT_FILE}
}

function detect_changed_e2e_test() {
# detect for changes in hack dir
# TODO: change PULL_BASE_SHA and PULL_PULL_SHA with values applicable for PAC/GA
Expand Down Expand Up @@ -63,9 +79,9 @@ function show_failure() {

function test_yaml_can_install() {
# Validate that all the StepAction/Task CRDs in this repo are valid by creating them in a NS.
ns="test-ns"
ns=${TEST_NS}
all_tasks="$*"
${KUBECTL_CMD} create ns "${ns}" || true
#${KUBECTL_CMD} create ns "${ns}" || true
local runtest
for runtest in ${all_tasks}; do
# remove task/ or stepaction/ from beginning
Expand Down Expand Up @@ -112,7 +128,7 @@ function test_resource_creation() {
version="$( echo $version | tr '.' '-' )"

#local tns="${testname}-${version}"
local tns="build-templates-e2e"
local tns=${TEST_NS}
local skipit=

for ignore in ${TEST_TASKRUN_IGNORES};do
Expand Down
7 changes: 4 additions & 3 deletions hack/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ if [[ ! -d ${resourcedir}/tests ]];then
exit 1
fi

#Need to link appstudio-pipeline SA with the TEST_NS namespace if not already
#${KUBECTL_CMD} create sa appstudio-pipeline -n $TEST_NS
#create appstudio-pipeline SA in the TEST_NS namespace if not already
if ! ${KUBECTL_CMD} get sa appstudio-pipeline -n $TEST_NS | grep 'appstudio-pipeline'; then
$KUBECTL_CMD create sa appstudio-pipeline -n $TEST_NS
fi

#test_resource_creation ${RESOURCE}/${NAME}/${VERSION}/tests $TEST_NS
test_resource_creation ${RESOURCE}/${NAME}/${VERSION}/tests

0 comments on commit 2a1a820

Please sign in to comment.