Skip to content

Commit

Permalink
Merge pull request #6 from openstack-k8s-operators/decapouple
Browse files Browse the repository at this point in the history
decouple container changes from operator changes
  • Loading branch information
arxcruz authored Sep 19, 2023
2 parents 2f85760 + 1ee9cdd commit f60e80d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 24 deletions.
14 changes: 8 additions & 6 deletions pkg/tempest/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func Job(
) *batchv1.Job {

envVars := map[string]env.Setter{}
envVars["KOLLA_CONFIG_STRATEGY"] = env.SetValue("COPY_ALWAYS")
runAsUser := int64(0)
runAsUser := int64(42480)
runAsGroup := int64(42480)

args := []string{
"/var/lib/tempest/run_tempest.sh",
Expand All @@ -39,17 +39,19 @@ func Job(
Spec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyNever,
ServiceAccountName: instance.RbacResourceName(),
SecurityContext: &corev1.PodSecurityContext{
RunAsUser: &runAsUser,
RunAsGroup: &runAsGroup,
FSGroup: &runAsGroup,
},
Containers: []corev1.Container{
{
Name: instance.Name + "-tests-runner",
Image: instance.Spec.ContainerImage,
Command: []string{
"/usr/local/bin/kolla_start",
"/usr/local/bin/container-scripts/invoke_tempest",
},
Args: []string{},
SecurityContext: &corev1.SecurityContext{
RunAsUser: &runAsUser,
},
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
VolumeMounts: GetVolumeMounts(),
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/tempest/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func GetVolumeMounts() []corev1.VolumeMount {
},
{
Name: "config-data",
MountPath: "/var/lib/kolla/config_files",
MountPath: "/etc/test_operator",
ReadOnly: false,
},
{
Expand Down
43 changes: 43 additions & 0 deletions templates/tempest/bin/invoke_tempest
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
# NOTE: consider converting it py
set -x
TEMPEST_DIR=$HOME/openshift
OPERATOR_ETC=/etc/test_operator
# NOTE: might be backed with a PV
OUTPUT_PATH=$HOME/output

cd "$HOME"

export OS_CLOUD=default

tempest init openshift
mkdir -p "$OUTPUT_PATH"

cd "$TEMPEST_DIR"

# TODO: consider profile support, deployer-input and other args passing
discover-tempest-config --os-cloud "$OS_CLOUD" --debug --create identity.v3_endpoint_type public

tempest run \
--include-list ${OPERATOR_ETC}/include.txt \
--exclude-list ${OPERATOR_ETC}/exclude.txt

# NOTE: We might not want to fail when tests are executed
RETURN_VALUE=$?

# NOTE: we have only one run
echo "Generate subunit"
stestr last --subunit > ${OUTPUT_PATH}/testrepository.subunit || true

# NOTE: can be done in parallel
echo "Generate subunit xml file"
subunit2junitxml "${OUTPUT_PATH}/testrepository.subunit" > "${OUTPUT_PATH}/tempest_results.xml" || true

echo "Generate html result"
subunit2html "${OUTPUT_PATH}/testrepository.subunit" "${OUTPUT_PATH}/stestr_results.html" || true

# NOTE: do we really need more files ?
echo Copying logs file
cp -rf ${TEMPEST_DIR}/* ${OUTPUT_PATH}

exit ${RETURN_VALUE}
17 changes: 0 additions & 17 deletions templates/tempest/config/config.json

This file was deleted.

0 comments on commit f60e80d

Please sign in to comment.