Skip to content

Commit 2faa22b

Browse files
acceptance/bundle/dms: cover redeploy (existing-deployment) version recording
Adds a redeploy test alongside dms/record: the first deploy creates the DMS deployment and version 1, and a second deploy against the now-existing deployment records version 2 without calling CreateDeployment again. This exercises both branches of createDeploymentVersion (new vs existing) via the stateful testserver, with RecordRequests verifying the DMS request sequence. Co-authored-by: Isaac
1 parent 00c9c83 commit 2faa22b

4 files changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bundle:
2+
name: dms-redeploy
3+
4+
experimental:
5+
record_deployment_history: true
6+
7+
resources:
8+
jobs:
9+
foo:
10+
name: foo

acceptance/bundle/dms/redeploy/out.test.toml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
=== First deploy: no deployment exists yet, so CreateDeployment + CreateVersion (version_id=1)
3+
>>> [CLI] bundle deploy
4+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-redeploy/default/files...
5+
Deploying resources...
6+
Updating deployment state...
7+
Deployment complete!
8+
9+
>>> print_requests.py //api/2.0/bundle
10+
{
11+
"method": "POST",
12+
"path": "/api/2.0/bundle/deployments",
13+
"q": {
14+
"deployment_id": "[UUID]"
15+
},
16+
"body": {
17+
"target_name": "default"
18+
}
19+
}
20+
{
21+
"method": "POST",
22+
"path": "/api/2.0/bundle/deployments/[UUID]/versions",
23+
"q": {
24+
"version_id": "1"
25+
},
26+
"body": {
27+
"cli_version": "[DEV_VERSION]",
28+
"target_name": "default",
29+
"version_type": "VERSION_TYPE_DEPLOY"
30+
}
31+
}
32+
{
33+
"method": "POST",
34+
"path": "/api/2.0/bundle/deployments/[UUID]/versions/1/complete",
35+
"body": {
36+
"completion_reason": "VERSION_COMPLETE_SUCCESS"
37+
}
38+
}
39+
40+
=== Second deploy: deployment already exists, so only CreateVersion (version_id=2), no CreateDeployment
41+
>>> [CLI] bundle deploy
42+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-redeploy/default/files...
43+
Deploying resources...
44+
Updating deployment state...
45+
Deployment complete!
46+
47+
>>> print_requests.py //api/2.0/bundle
48+
{
49+
"method": "POST",
50+
"path": "/api/2.0/bundle/deployments/[UUID]/versions",
51+
"q": {
52+
"version_id": "2"
53+
},
54+
"body": {
55+
"cli_version": "[DEV_VERSION]",
56+
"target_name": "default",
57+
"version_type": "VERSION_TYPE_DEPLOY"
58+
}
59+
}
60+
{
61+
"method": "POST",
62+
"path": "/api/2.0/bundle/deployments/[UUID]/versions/2/complete",
63+
"body": {
64+
"completion_reason": "VERSION_COMPLETE_SUCCESS"
65+
}
66+
}
67+
68+
>>> [CLI] bundle destroy --auto-approve
69+
The following resources will be deleted:
70+
delete resources.jobs.foo
71+
72+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-redeploy/default
73+
74+
Deleting files...
75+
Destroy complete!
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cleanup() {
2+
trace $CLI bundle destroy --auto-approve
3+
rm -f out.requests.txt
4+
}
5+
trap cleanup EXIT
6+
7+
title "First deploy: no deployment exists yet, so CreateDeployment + CreateVersion (version_id=1)"
8+
trace $CLI bundle deploy
9+
trace print_requests.py //api/2.0/bundle
10+
11+
title "Second deploy: deployment already exists, so only CreateVersion (version_id=2), no CreateDeployment"
12+
trace $CLI bundle deploy
13+
trace print_requests.py //api/2.0/bundle

0 commit comments

Comments
 (0)