Skip to content

Commit ce43def

Browse files
committed
chore: update component-test with new arch
Signed-off-by: Chen Keinan <hen.keinan@gmail.com>
1 parent 2a15bb1 commit ce43def

23 files changed

+552
-914
lines changed

tests/component-tests/promotion/00-dragAndDrop/00-assert.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/component-tests/promotion/00-dragAndDrop/00-drag-and-drop-task.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/component-tests/promotion/00-dragAndDrop/dragAndDrop.json

Lines changed: 0 additions & 86 deletions
This file was deleted.

tests/component-tests/promotion/00-dragAndDrop/dragAndDrop.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/component-tests/promotion/01-git-commit/00-assert.yaml renamed to tests/component-tests/promotion/00-get-promotable-values/00-assert.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
---
1515
apiVersion: kuttl.dev/v1beta1
1616
commands:
17-
- script: >
18-
STATUS="$(kubectl get workflow -n codefresh -l codefresh.io/release=684040897b3903d3764e1f73 -o jsonpath="{.items[*].status.phase}")"
19-
20-
if [ $STATUS = 'Succeeded' ]; then
21-
echo "workflow status for release '684040897b3903d3764e1f73' has succeeded"
22-
else
23-
echo "workflow status ($STATUS) for release '684040897b3903d3764e1f73' should be succeeded"
24-
exit 1
25-
fi
17+
- script: >
18+
STATUS="$(kubectl get promotiontask -n codefresh -l codefresh.io/id=635ae4b1a8d4ea001297e0e9 -o jsonpath="{.items[*].status.phase}")"
19+
20+
if [ $STATUS = 'Succeeded' ]; then
21+
echo "promotion task status for promotion task '635ae4b1a8d4ea001297e0e9' has succeeded"
22+
else
23+
echo "workflow status ($STATUS) for promotion task '635ae4b1a8d4ea001297e0e9' should be succeeded"
24+
exit 1
25+
fi
2626
kind: TestAssert
2727
timeout: 240
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[
2+
{
3+
"httpRequest": {
4+
"method": "GET",
5+
"path": "/2.0/api/promotion-orchestrator/promotion/desired-promotion-tasks"
6+
},
7+
"httpResponse": {
8+
"statusCode": 200,
9+
"body": [
10+
{
11+
"promotionTaskId": "635ae4b1a8d4ea001297e0e9",
12+
"name": "dev-codefresh-simple-dev-68ea7699e1e47d0cd666f6b9",
13+
"promotionId": "68ea7699e1e47d0cd666f6b8",
14+
"productName": "echo",
15+
"environment": "dev",
16+
"applicationId": {
17+
"name": "simple-dev",
18+
"namespace": "codefresh"
19+
},
20+
"spec": {
21+
"phase": "PENDING",
22+
"steps": [
23+
{
24+
"type": "getPromotionValues",
25+
"targetApplication": {
26+
"name": "simple-dev",
27+
"namespace": "codefresh"
28+
},
29+
"commitSha": "source-commit-sha",
30+
"versionProperty": {
31+
"file": "Chart.yaml",
32+
"jsonPath": "$.version"
33+
},
34+
"commitAuthorId": {
35+
"username": "test-user",
36+
"email": "test-user@example.com"
37+
},
38+
"promotionProperties": [
39+
{
40+
"file": "values.yaml",
41+
"properties": [
42+
"$.image.tag"
43+
]
44+
}
45+
]
46+
},
47+
{
48+
"type": "verifyApp",
49+
"targetApplication": {
50+
"name": "simple-dev",
51+
"namespace": "codefresh"
52+
},
53+
"commitSha": "source-commit-sha"
54+
}
55+
]
56+
}
57+
}
58+
]
59+
60+
},
61+
"times": {
62+
"remainingTimes":1,
63+
"unlimited": false
64+
}
65+
}
66+
]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# -----------------------------------------------------------------------------
3+
# Usage:
4+
# ./00-get-promotable-values.sh
5+
#
6+
# Steps performed:
7+
# - Updates the image tag in values.yaml from '0.1' to 'latest'.
8+
# - Commits and pushes the change to the simple-app repository.
9+
# - Retrieves the latest commit SHA.
10+
# - Updates the mock JSON files with the new commit SHA.
11+
# - Loads the updated expectations into Mockserver.
12+
# -----------------------------------------------------------------------------
13+
sleep 2
14+
OS_TYPE=$(uname)
15+
cd ../../setup/simple-app
16+
git checkout dev
17+
18+
if [ "$OS_TYPE" = "Linux" ]; then
19+
sed -i 's/latest/0.1/g' values.yaml
20+
else
21+
sed -i '' 's/latest/0.1/g' values.yaml
22+
fi
23+
24+
git add --a
25+
git commit -m "update values.yaml"
26+
git push
27+
srcCommitSha=$(git rev-parse origin/dev)
28+
## update commit sha for dev app
29+
if [ "$OS_TYPE" = "Linux" ]; then
30+
sed -i "s/source-commit-sha/$srcCommitSha/g" ../../promotion/00-get-promotable-values/00-get-promotable-values.json
31+
else
32+
sed -i '' "s/source-commit-sha/$srcCommitSha/g" ../../promotion/00-get-promotable-values/00-get-promotable-values.json
33+
fi
34+
sleep 5
35+
curl -i -X PUT http://127.0.0.1:1080/mockserver/expectation --data-binary "@../../promotion/00-get-promotable-values/00-get-promotable-values.json"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -----------------------------------------------------------------------------
2+
# 00-app-sync.yaml - KUTTL TestStep for app sync and mock update
3+
#
4+
# This TestStep runs the 00-app-sync.sh script to update the simple-app
5+
# repository and load updated sync mock expectations into Mockserver for the
6+
# Codefresh GitOps Operator component tests.
7+
#
8+
# Usage:
9+
# This step is executed as part of the KUTTL test suite.
10+
#
11+
# Steps performed:
12+
# - Executes the 00-app-sync.sh script to update the app and mocks.
13+
# -----------------------------------------------------------------------------
14+
---
15+
apiVersion: kuttl.dev/v1beta1
16+
kind: TestStep
17+
commands:
18+
- script: ./00-get-promotable-values.sh
19+
timeout: 30

0 commit comments

Comments
 (0)