Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(HMS-4895): add unit tests -oci-ta #443

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 73 additions & 1 deletion .tekton/idmsvc-backend-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,68 @@ spec:
workspace: git-auth
- name: netrc
workspace: netrc
- name: run-unit-tests
description: Execute the unit tests for idmsvc-backend
params:
- name: SOURCE_ARTIFACT
value: $(tasks.prefetch-dependencies.results.SOURCE_ARTIFACT)
runAfter:
- prefetch-dependencies
workspaces:
- name: git-basic-auth
workspace: git-auth
- name: configs
workspace: configs
# - name: source
# workspace: workspace
taskSpec:
params:
- description: The Trusted Artifact URI pointing to the artifact with the application source code.
name: SOURCE_ARTIFACT
type: string
stepTemplate:
volumeMounts:
- name: workdir
mountPath: /var/workdir
readOnly: false
- name: configs
mountPath: /tmp/configs
readOnly: false
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: unit-tests
image: registry.access.redhat.com/ubi9/go-toolset:1.22.7-1733160835@sha256:c9c0129bff8e94b9e23e9e4a1ebb5b932cccc24e064940a792bdc002da512d2a
workingDir: /var/workdir/source
computeResources:
requests:
memory: 7Gi
cpu: 1000m
limits:
memory: 14Gi
cpu: 2000m
securityContext:
runAsUser: 0
script: |
#!/bin/bash
set -ex

# pwd >&2
# ls -1 >&2

export CONFIG_PATH="/tmp/configs"
cp -vf configs/config.example.yaml /tmp/configs/config.yaml

make test-unit
volumes:
# New volume to store a copy of the source code accessible only to this Task.
- name: workdir
emptyDir: {}
- name: configs
emptyDir: {}
- name: build-images
matrix:
params:
Expand Down Expand Up @@ -263,7 +325,7 @@ spec:
- name: IMAGE_APPEND_PLATFORM
value: "true"
runAfter:
- prefetch-dependencies
- run-unit-tests
taskRef:
params:
- name: name
Expand Down Expand Up @@ -526,6 +588,16 @@ spec:
requests:
storage: 1Gi
status: {}
- name: configs
volumeClaimTemplate:
metadata:
creationTimestamp: null
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Mi
- name: git-auth
secret:
secretName: '{{ git_auth_secret }}'
Expand Down
Loading