Skip to content

Commit

Permalink
Prepare CI for tang operator
Browse files Browse the repository at this point in the history
Tang operator test will run on CI with using minikube.
Prepare .yaml file for specifying packit run and preparing
.fmf plan for run test via tmt.
Prepared setup for install and setup minukube.
Also polished tang operator test to be more structured.

Resolves: #5
  • Loading branch information
Koncpa committed Oct 16, 2023
1 parent 99b892b commit 9a5d8a6
Show file tree
Hide file tree
Showing 19 changed files with 149 additions and 448 deletions.
13 changes: 13 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- jobs:
- job: tests

Check failure on line 3 in .packit.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

3:3 [indentation] wrong indentation: expected at least 3
trigger: pull_request
branch: main
targets:
- fedora-rawhide
skip_build: true
tf_extra_params:
environments:
- tmt:
context:
target_PR_branch: "main"
9 changes: 8 additions & 1 deletion Sanity/main.fmf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Deployment and basic functionality of the tang operator
summary: Basic functionality of the tang operator
description: ''
contact: Martin Zelený <[email protected]>
component:
Expand All @@ -7,6 +7,13 @@ test: ./runtest.sh
recommend:
- tang
- clevis
require:
- jq
- helm
- clamav
- clamav-freshclam
- podman
- git
duration: 30m
enabled: true
tag:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ metadata:
finalizers:
- finalizer.daemons.tangserver.redhat.com
spec:
image: "registry.redhat.io/rhel9/tang"
version: "latest"
replicas: 1
2 changes: 2 additions & 0 deletions Sanity/reg_test/key_management_test/api_key_rotate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ metadata:
- finalizer.daemons.tangserver.redhat.com
spec:
replicas: ${replicas}
image: "registry.redhat.io/rhel9/tang"
version: "latest"
hiddenKeys:
- sha1: ${sha1_1}
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ metadata:
- finalizer.daemons.tangserver.redhat.com
spec:
replicas: ${replicas}
image: "registry.redhat.io/rhel9/tang"
version: "latest"
hiddenKeys:
- sha1: ${sha1_1}
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ metadata:
- finalizer.daemons.tangserver.redhat.com
spec:
replicas: ${replicas}
image: "registry.redhat.io/rhel9/tang"
version: "latest"
hiddenKeys:
- sha1: ${sha1_1}
- sha1: ${hsha1_1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ metadata:
- finalizer.daemons.tangserver.redhat.com
spec:
replicas: 1
image: "registry.redhat.io/rhel9/tang"
version: "latest"
hiddenKeys: []
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ metadata:
finalizers:
- finalizer.daemons.tangserver.redhat.com
spec:
image: "registry.redhat.io/rhel9/tang"
version: "latest"
replicas: 1
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ metadata:
finalizers:
- finalizer.daemons.tangserver.redhat.com
spec:
image: "registry.redhat.io/rhel9/tang"
version: "latest"
replicas: 3
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ metadata:
finalizers:
- finalizer.daemons.tangserver.redhat.com
spec:
# Add fields here
image: "registry.redhat.io/rhel9/tang"
version: "latest"
replicas: 2
38 changes: 0 additions & 38 deletions Sanity/runnotest.sh

This file was deleted.

20 changes: 17 additions & 3 deletions Sanity/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ QUAY_FILE_NAME_TO_FILL_UNFILLED_MD5="db099cc0b92220feb7a38783b02df897"
OC_DEFAULT_CLIENT="kubectl"
TOP_SECRET_WORDS="top secret"
DELETE_TMP_DIR="YES"
[ -n "$TANG_IMAGE" ] || TANG_IMAGE="registry.redhat.io/rhel9/tang"

test -z "${VERSION}" && VERSION="latest"
test -z "${DISABLE_BUNDLE_INSTALL_TESTS}" && DISABLE_BUNDLE_INSTALL_TESTS="0"
Expand Down Expand Up @@ -778,7 +779,7 @@ getVersion() {
analyzeVersion() {
dumpVerbose "DETECTING MALWARE ON VERSION:[${1}]"
"${CONTAINER_MGR}" pull "${1}"
dir_mount=$("${CONTAINER_MGR}" unshare ./mount_image.sh -v "${1}" -c "${CONTAINER_MGR}")
dir_mount=$("${CONTAINER_MGR}" unshare ./scripts/mount_image.sh -v "${1}" -c "${CONTAINER_MGR}")
rlAssertEquals "Checking image could be mounted appropriately" "$?" "0"
analyzed_dir=$(echo "${dir_mount}" | sed -e 's@/merged@@g')
dumpVerbose "Analyzing directory:[${analyzed_dir}]"
Expand All @@ -791,10 +792,17 @@ analyzeVersion() {
rlLogWarning "${infected_files} Infected Files Detected!"
rlLogWarning "Please, review Malware Detection log file: ${tmpdir}/${prefix}_malware.log"
fi
"${CONTAINER_MGR}" unshare ./umount_image.sh -v "${1}" -c "${CONTAINER_MGR}"
"${CONTAINER_MGR}" unshare ./scripts/umount_image.sh -v "${1}" -c "${CONTAINER_MGR}"
rlAssertEquals "Checking image could be umounted appropriately" "$?" "0"
}

useUpstreamImages(){
for yaml_file in $(find . -type f -print)
do
sed -i "s~\"registry.redhat.io/rhel9/tang\"~$TANG_IMAGE~g" $yaml_file
done
}

rlJournalStart
parseAndDumpMode
parseAndDumpClient
Expand All @@ -810,7 +818,13 @@ rlJournalStart
rlRun "bundleStart" 0 "Installing tang-operator-bundle version:${VERSION}"
rlRun "${OC_CLIENT} apply -f ${TEST_NAMESPACE_FILE}" 0 "Creating test namespace:${TEST_NAMESPACE}"
rlRun "${OC_CLIENT} get namespace ${TEST_NAMESPACE}" 0 "Checking test namespace:${TEST_NAMESPACE}"
rlRun "installSecret" 0 "Installing secret if necessary"
#go through all the files and set substition for TANG_IMAGE keyword
if [ -n "$TANG_IMAGE" ]; then
useUpstreamImages
fi
if [ "$CI" != true ]; then
rlRun "installSecret" 0 "Installing secret if necessary"
fi
rlPhaseEnd

########## CHECK CONTROLLER RUNNING #########
Expand Down
File renamed without changes.
File renamed without changes.
49 changes: 0 additions & 49 deletions Sanity/tang_operator_test.sh

This file was deleted.

Loading

0 comments on commit 9a5d8a6

Please sign in to comment.