-
-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathCreateDeploymentInputTest.php
More file actions
148 lines (142 loc) · 4.93 KB
/
Copy pathCreateDeploymentInputTest.php
File metadata and controls
148 lines (142 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
namespace AsyncAws\CodeDeploy\Tests\Unit\Input;
use AsyncAws\CodeDeploy\Enum\AutoRollbackEvent;
use AsyncAws\CodeDeploy\Enum\BundleType;
use AsyncAws\CodeDeploy\Enum\EC2TagFilterType;
use AsyncAws\CodeDeploy\Enum\FileExistsBehavior;
use AsyncAws\CodeDeploy\Enum\RevisionLocationType;
use AsyncAws\CodeDeploy\Input\CreateDeploymentInput;
use AsyncAws\CodeDeploy\ValueObject\AppSpecContent;
use AsyncAws\CodeDeploy\ValueObject\AutoRollbackConfiguration;
use AsyncAws\CodeDeploy\ValueObject\EC2TagFilter;
use AsyncAws\CodeDeploy\ValueObject\EC2TagSet;
use AsyncAws\CodeDeploy\ValueObject\GitHubLocation;
use AsyncAws\CodeDeploy\ValueObject\RawString;
use AsyncAws\CodeDeploy\ValueObject\RevisionLocation;
use AsyncAws\CodeDeploy\ValueObject\S3Location;
use AsyncAws\CodeDeploy\ValueObject\TargetInstances;
use AsyncAws\Core\Test\TestCase;
class CreateDeploymentInputTest extends TestCase
{
public function testRequest(): void
{
$input = new CreateDeploymentInput([
'applicationName' => 'application-name',
'deploymentGroupName' => 'deployment-group-name',
'revision' => new RevisionLocation([
'revisionType' => RevisionLocationType::GIT_HUB,
's3Location' => new S3Location([
'bucket' => 'bucket',
'key' => 'key',
'bundleType' => BundleType::JSON,
'version' => 'version',
'eTag' => 'e-tag',
]),
'gitHubLocation' => new GitHubLocation([
'repository' => 'repository',
'commitId' => 'commit-id',
]),
'string' => new RawString([
'content' => 'content',
'sha256' => 'sha256',
]),
'appSpecContent' => new AppSpecContent([
'content' => 'content',
'sha256' => 'sha256',
]),
]),
'deploymentConfigName' => 'deployment-config-name',
'description' => 'description',
'ignoreApplicationStopFailures' => false,
'targetInstances' => new TargetInstances([
'tagFilters' => [new EC2TagFilter([
'Key' => 'key',
'Value' => 'value3',
'Type' => EC2TagFilterType::KEY_AND_VALUE,
])],
'autoScalingGroups' => ['auto-scaling-groups'],
'ec2TagSet' => new EC2TagSet([
'ec2TagSetList' => [[new EC2TagFilter([
'Key' => 'key',
'Value' => 'value',
'Type' => EC2TagFilterType::KEY_AND_VALUE,
])]],
]),
]),
'autoRollbackConfiguration' => new AutoRollbackConfiguration([
'enabled' => false,
'events' => [AutoRollbackEvent::DEPLOYMENT_FAILURE],
]),
'updateOutdatedInstancesOnly' => false,
'fileExistsBehavior' => FileExistsBehavior::DISALLOW,
]);
// see https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_CreateDeployment.html
$expected = '
POST / HTTP/1.0
Content-Type: application/x-amz-json-1.1
x-amz-target: CodeDeploy_20141006.CreateDeployment
Accept: application/json
{
"applicationName": "application-name",
"autoRollbackConfiguration": {
"enabled": false,
"events": [
"DEPLOYMENT_FAILURE"
]
},
"deploymentConfigName": "deployment-config-name",
"deploymentGroupName": "deployment-group-name",
"description": "description",
"fileExistsBehavior": "DISALLOW",
"ignoreApplicationStopFailures": false,
"revision": {
"appSpecContent": {
"content": "content",
"sha256": "sha256"
},
"gitHubLocation": {
"commitId": "commit-id",
"repository": "repository"
},
"revisionType": "GitHub",
"s3Location": {
"bucket": "bucket",
"bundleType": "JSON",
"eTag": "e-tag",
"key": "key",
"version": "version"
},
"string": {
"content": "content",
"sha256": "sha256"
}
},
"targetInstances": {
"autoScalingGroups": [
"auto-scaling-groups"
],
"ec2TagSet": {
"ec2TagSetList": [
[
{
"Key": "key",
"Type": "KEY_AND_VALUE",
"Value": "value"
}
]
]
},
"tagFilters": [
{
"Key": "key",
"Type": "KEY_AND_VALUE",
"Value": "value3"
}
]
},
"updateOutdatedInstancesOnly": false
}
';
self::assertRequestEqualsHttpRequest($expected, $input->request());
}
}