forked from kyma-project/kyma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stub compas runetime agent tests (kyma-project#15024)
* Stub structure for testing the compass-runtime-agent * Temporary delete SA * Remove the unnecessary inputs * Fix typos * Change target name to align with old pipeline target name * Change job name in script, rember to figure out different approach * Replace Docker image repository * Make script universal * Code review changes #1 * Code review changes #1 * Code review changes #2 * Code review changes #2 Co-authored-by: Arkadiusz Galwas <arkadiusz.galwas@sap.com>
- Loading branch information
Showing
9 changed files
with
157 additions
and
9 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
tests/components/application-connector/Dockerfile.compass-runtime-agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM eu.gcr.io/kyma-project/external/golang:1.18.3-alpine3.16 as builder | ||
|
||
WORKDIR /compass-test/ | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download && go mod verify | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 go test -v -c -o compass-test ./test/compass-runtime-agent/ | ||
|
||
FROM scratch | ||
|
||
COPY --from=builder /compass-test/compass-test / | ||
ENTRYPOINT [ "/compass-test" ] | ||
CMD ["-test.v"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...s/components/application-connector/resources/charts/compass-runtime-agent-test/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v2 | ||
name: compass-runtime-agent-test | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.1.0" |
12 changes: 12 additions & 0 deletions
12
.../application-connector/resources/charts/compass-runtime-agent-test/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
{{/* | ||
Create a URL for container images | ||
*/}} | ||
{{- define "imageurl" -}} | ||
{{- $registry := default $.reg.path $.img.containerRegistryPath -}} | ||
{{- if hasKey $.img "directory" -}} | ||
{{- printf "%s/%s/%s:%s" $registry $.img.directory $.img.name $.img.version -}} | ||
{{- else -}} | ||
{{- printf "%s/%s:%s" $registry $.img.name $.img.version -}} | ||
{{- end -}} | ||
{{- end -}} |
14 changes: 14 additions & 0 deletions
14
...nts/application-connector/resources/charts/compass-runtime-agent-test/templates/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: compass-runtime-agent-test | ||
namespace: {{ .Values.namespace }} | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: compass-runtime-agent-test | ||
image: {{ include "imageurl" (dict "reg" .Values.containerRegistry "img" .Values.images.compassTest) }} | ||
imagePullPolicy: Always | ||
restartPolicy: Never | ||
backoffLimit: 0 |
9 changes: 9 additions & 0 deletions
9
.../components/application-connector/resources/charts/compass-runtime-agent-test/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace: "test" | ||
|
||
containerRegistry: | ||
path: "eu.gcr.io/kyma-project" | ||
|
||
images: | ||
compassTest: | ||
name: "compass-runtime-agent-test" | ||
version: "PR-15024" |
10 changes: 8 additions & 2 deletions
10
tests/components/application-connector/scripts/check-pod-logs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
#!/usr/bin/env bash | ||
NAMESPACE=test | ||
GOPATH=$(go env GOPATH) | ||
JOB_NAME=$1 | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "Usage: check-pod-logs.sh <job name>" | ||
exit 1 | ||
fi | ||
|
||
if ([[ ${EXPORT_RESULT} == true ]]); then | ||
kubectl -n $NAMESPACE logs -f job/application-gateway-test | tee /dev/stderr | $GOPATH/bin/go-junit-report -set-exit-code > junit-report.xml | ||
kubectl -n $NAMESPACE logs -f job/"$JOB_NAME" | tee /dev/stderr | $GOPATH/bin/go-junit-report -set-exit-code > junit-report.xml | ||
else | ||
kubectl -n $NAMESPACE logs -f job/application-gateway-test | ||
kubectl -n $NAMESPACE logs -f job/"$JOB_NAME" | ||
fi |
34 changes: 34 additions & 0 deletions
34
tests/components/application-connector/test/compass-runtime-agent/suite_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package compass_runtime_agent | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
cli "github.com/kyma-project/kyma/components/application-operator/pkg/client/clientset/versioned" | ||
"github.com/stretchr/testify/suite" | ||
"k8s.io/client-go/rest" | ||
) | ||
|
||
type CompassRuntimeAgentSuite struct { | ||
suite.Suite | ||
cli *cli.Clientset | ||
} | ||
|
||
func (gs *CompassRuntimeAgentSuite) SetupSuite() { | ||
cfg, err := rest.InClusterConfig() | ||
gs.Require().Nil(err) | ||
|
||
gs.cli, err = cli.NewForConfig(cfg) | ||
gs.Require().Nil(err) | ||
} | ||
|
||
func (gs *CompassRuntimeAgentSuite) TearDownSuite() { | ||
_, err := http.Post("http://localhost:15000/quitquitquit", "", nil) | ||
gs.Nil(err) | ||
_, err = http.Post("http://localhost:15020/quitquitquit", "", nil) | ||
gs.Nil(err) | ||
} | ||
|
||
func TestCompassRuntimeAgentSuite(t *testing.T) { | ||
suite.Run(t, new(CompassRuntimeAgentSuite)) | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/components/application-connector/test/compass-runtime-agent/synchronisation_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package compass_runtime_agent | ||
|
||
func (gs *CompassRuntimeAgentSuite) TestCreatingApplications() { | ||
} |