Skip to content

Commit b619ca9

Browse files
authored
DeploymentConfig Unit Tests (#195)
Issue #, if available: Description of changes: Contains unit test for ReadOne operation of Deployment Config. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent b19b87b commit b619ca9

File tree

8 files changed

+366
-0
lines changed

8 files changed

+366
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"AsyncInferenceConfig": null,
3+
"CreationTime": "0001-01-01T00:00:00.109Z",
4+
"DataCaptureConfig": null,
5+
"EndpointArn": "arn:aws:sagemaker:us-west-2:123456789012:endpoint/xgboost-endpoint",
6+
"EndpointConfigName": "xgboost-endpoint-single-variant-config-updated",
7+
"EndpointName": "xgboost-endpoint",
8+
"EndpointStatus": "Updating",
9+
"ExplainerConfig": null,
10+
"FailureReason": null,
11+
"LastDeploymentConfig": {
12+
"AutoRollbackConfiguration": {
13+
"Alarms": [
14+
{
15+
"AlarmName": "5xalarm-endpointtest"
16+
}
17+
]
18+
},
19+
"BlueGreenUpdatePolicy": {
20+
"MaximumExecutionTimeoutInSeconds": 600,
21+
"TerminationWaitInSeconds": 100,
22+
"TrafficRoutingConfiguration": {
23+
"CanarySize": null,
24+
"LinearStepSize": {
25+
"Type": "INSTANCE_COUNT",
26+
"Value": 1
27+
},
28+
"Type": "LINEAR",
29+
"WaitIntervalInSeconds": 100
30+
}
31+
}
32+
},
33+
"LastModifiedTime": "0001-01-01T00:00:00Z",
34+
"PendingDeploymentSummary": {
35+
"EndpointConfigName": "xgboost-endpoint-single-variant-config-updated",
36+
"ProductionVariants": [
37+
{
38+
"AcceleratorType": null,
39+
"CurrentInstanceCount": 0,
40+
"CurrentServerlessConfig": null,
41+
"CurrentWeight": 0,
42+
"DeployedImages": [
43+
{
44+
"ResolutionTime": "0001-01-01T00:00:00Z",
45+
"ResolvedImage": "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost@sha256:06c3143c16d671f07bac53da87f4f7464168ccb427a7b04966ab08ec9b0637b2",
46+
"SpecifiedImage": "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.2-1"
47+
}
48+
],
49+
"DesiredInstanceCount": 3,
50+
"DesiredServerlessConfig": null,
51+
"DesiredWeight": 1,
52+
"InstanceType": "m5.xlarge",
53+
"VariantName": "variant-1",
54+
"VariantStatus": [
55+
{
56+
"StartTime": "0001-01-01T00:00:00Z",
57+
"Status": "Creating",
58+
"StatusMessage": "Launching 3 instance(s)."
59+
}
60+
]
61+
}
62+
],
63+
"StartTime": "0001-01-01T00:00:00.109Z"
64+
},
65+
"ProductionVariants": [
66+
{
67+
"CurrentInstanceCount": 3,
68+
"CurrentServerlessConfig": null,
69+
"CurrentWeight": 1,
70+
"DeployedImages": [
71+
{
72+
"ResolutionTime": "0001-01-01T00:00:00Z",
73+
"ResolvedImage": "433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost@sha256:54004f910467ebf7cfa71b5523b81695d103abf21a37d38dc84d63ab8d510c35",
74+
"SpecifiedImage": "433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest"
75+
}
76+
],
77+
"DesiredInstanceCount": 3,
78+
"DesiredServerlessConfig": null,
79+
"DesiredWeight": 1,
80+
"VariantName": "variant-1",
81+
"VariantStatus": null
82+
}
83+
]
84+
}

pkg/resource/endpoint/testdata/test_suite.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ tests:
2626
expect:
2727
latest_state: "v1alpha1/create/observed/success_after_create.yaml"
2828
error: nil
29+
- name: "Create=DeploymentConfig"
30+
description: "Create a new endpoint successfully with a Deployment Config"
31+
given:
32+
desired_state: "v1alpha1/create/desired/success_before_create_deployment_config.yaml"
33+
svc_api:
34+
- operation: CreateEndpointWithContext
35+
output_fixture: "sdkapi/create/create_success.json"
36+
invoke: Create
37+
expect:
38+
latest_state: "v1alpha1/create/observed/success_after_create_deployment_config.yaml"
39+
error: nil
2940
- name: "Endpoint readOne tests"
3041
description: "Testing the readOne operation"
3142
scenarios:
@@ -111,6 +122,16 @@ tests:
111122
invoke: ReadOne
112123
expect:
113124
latest_state: "v1alpha1/readone/observed/failed_status_on_describe.yaml"
125+
- name: "ReadOne=UpdateDeploymentConfig"
126+
description: "Testing how readOne handles the Update with the deployment Config."
127+
given:
128+
desired_state: "v1alpha1/readone/desired/updating_deployment.yaml"
129+
svc_api:
130+
- operation: DescribeEndpointWithContext
131+
output_fixture: "sdkapi/describe/update_deployment_config.json"
132+
invoke: ReadOne
133+
expect:
134+
latest_state: "v1alpha1/readone/observed/updating_deployment.yaml"
114135
- name: "Endpoint update tests"
115136
description: "Testing the Update operation"
116137
scenarios:
@@ -165,6 +186,17 @@ tests:
165186
invoke: Update
166187
expect:
167188
latest_state: "v1alpha1/update/observed/update_attempted_success.yaml"
189+
- name: "Update=DeploymentConfig"
190+
description: "This test checks if update Endpoint is called and lastEndpointConfigNameForUpdate annotation is set"
191+
given:
192+
desired_state: "v1alpha1/update/desired/update_deployment_config.yaml"
193+
latest_state: "v1alpha1/update/desired/latest_inservice_pre_update.yaml"
194+
svc_api:
195+
- operation: UpdateEndpointWithContext
196+
output_fixture: "sdkapi/update/update_success.json"
197+
invoke: Update
198+
expect:
199+
latest_state: "v1alpha1/update/observed/update_deployment_config.yaml"
168200
- name: "Endpoint delete tests"
169201
description: "Testing the delete operation"
170202
scenarios:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: Endpoint
3+
metadata:
4+
name: xgboost-endpoint
5+
spec:
6+
endpointConfigName: xgboost-endpoint-single-variant-config
7+
endpointName: xgboost-endpoint
8+
deploymentConfig:
9+
autoRollbackConfiguration:
10+
alarms:
11+
- alarmName: 5xalarm-endpointtest
12+
blueGreenUpdatePolicy:
13+
maximumExecutionTimeoutInSeconds: 600
14+
terminationWaitInSeconds: 100
15+
trafficRoutingConfiguration:
16+
linearStepSize:
17+
type_: INSTANCE_COUNT
18+
value: 1
19+
type_: LINEAR
20+
waitIntervalInSeconds: 100
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: Endpoint
3+
metadata:
4+
creationTimestamp: null
5+
name: xgboost-endpoint
6+
spec:
7+
endpointConfigName: xgboost-endpoint-single-variant-config
8+
endpointName: xgboost-endpoint
9+
deploymentConfig:
10+
autoRollbackConfiguration:
11+
alarms:
12+
- alarmName: 5xalarm-endpointtest
13+
blueGreenUpdatePolicy:
14+
maximumExecutionTimeoutInSeconds: 600
15+
terminationWaitInSeconds: 100
16+
trafficRoutingConfiguration:
17+
linearStepSize:
18+
type_: INSTANCE_COUNT
19+
value: 1
20+
type_: LINEAR
21+
waitIntervalInSeconds: 100
22+
status:
23+
ackResourceMetadata:
24+
arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint/xgboost-endpoint
25+
ownerAccountID: ""
26+
region: ""
27+
conditions:
28+
- status: "True"
29+
type: ACK.ResourceSynced
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: Endpoint
3+
metadata:
4+
annotations:
5+
sagemaker.services.k8s.aws/last-endpoint-config-for-update: xgboost-endpoint-single-variant-config-updated
6+
creationTimestamp: null
7+
name: xgboost-endpoint
8+
spec:
9+
deploymentConfig:
10+
autoRollbackConfiguration:
11+
alarms:
12+
- alarmName: 5xalarm-endpointtest
13+
blueGreenUpdatePolicy:
14+
maximumExecutionTimeoutInSeconds: 600
15+
terminationWaitInSeconds: 100
16+
trafficRoutingConfiguration:
17+
linearStepSize:
18+
type_: INSTANCE_COUNT
19+
value: 1
20+
type_: LINEAR
21+
waitIntervalInSeconds: 100
22+
endpointConfigName: xgboost-endpoint-single-variant-config-updated
23+
endpointName: xgboost-endpoint
24+
status:
25+
ackResourceMetadata:
26+
arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint/xgboost-endpoint
27+
ownerAccountID: ""
28+
region: ""
29+
conditions:
30+
- lastTransitionTime: "0001-01-01T00:00:00Z"
31+
message: Endpoint is in InService status.
32+
status: "True"
33+
type: ACK.ResourceSynced
34+
creationTime: "0001-01-01T00:00:00Z"
35+
endpointStatus: InService
36+
lastModifiedTime: "0001-01-01T00:00:00Z"
37+
productionVariants:
38+
- currentInstanceCount: 2
39+
currentWeight: 1
40+
deployedImages:
41+
- resolutionTime: "0001-01-01T00:00:00Z"
42+
resolvedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost@sha256:54004f910467ebf7cfa71b5523b81695d103abf21a37d38dc84d63ab8d510c35
43+
specifiedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest
44+
desiredInstanceCount: 2
45+
desiredWeight: 1
46+
variantName: variant-1
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: Endpoint
3+
metadata:
4+
annotations:
5+
sagemaker.services.k8s.aws/last-endpoint-config-for-update: xgboost-endpoint-single-variant-config-updated
6+
creationTimestamp: null
7+
name: xgboost-endpoint
8+
spec:
9+
deploymentConfig:
10+
autoRollbackConfiguration:
11+
alarms:
12+
- alarmName: 5xalarm-endpointtest
13+
blueGreenUpdatePolicy:
14+
maximumExecutionTimeoutInSeconds: 600
15+
terminationWaitInSeconds: 100
16+
trafficRoutingConfiguration:
17+
linearStepSize:
18+
type_: INSTANCE_COUNT
19+
value: 1
20+
type_: LINEAR
21+
waitIntervalInSeconds: 100
22+
endpointConfigName: xgboost-endpoint-single-variant-config-updated
23+
endpointName: xgboost-endpoint
24+
status:
25+
ackResourceMetadata:
26+
arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint/xgboost-endpoint
27+
ownerAccountID: ""
28+
region: ""
29+
conditions:
30+
- lastTransitionTime: "2023-01-18T19:05:49Z"
31+
message: Endpoint is in Updating status.
32+
status: "False"
33+
type: ACK.ResourceSynced
34+
creationTime: "0001-01-01T00:00:00Z"
35+
endpointStatus: Updating
36+
lastModifiedTime: "0001-01-01T00:00:00Z"
37+
pendingDeploymentSummary:
38+
endpointConfigName: xgboost-endpoint-single-variant-config-updated
39+
productionVariants:
40+
- currentInstanceCount: 0
41+
currentWeight: 0
42+
deployedImages:
43+
- resolutionTime: "2023-01-18T19:01:59Z"
44+
resolvedImage: 246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost@sha256:06c3143c16d671f07bac53da87f4f7464168ccb427a7b04966ab08ec9b0637b2
45+
specifiedImage: 246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.2-1
46+
desiredInstanceCount: 3
47+
desiredWeight: 1
48+
instanceType: m5.xlarge
49+
variantName: variant-1
50+
variantStatus:
51+
- startTime: "0001-01-01T00:00:00Z"
52+
status: Creating
53+
statusMessage: Launching 3 instance(s).
54+
startTime: "0001-01-01T00:00:00.109Z"
55+
productionVariants:
56+
- currentInstanceCount: 3
57+
currentWeight: 1
58+
deployedImages:
59+
- resolutionTime: "0001-01-01T00:00:00Z"
60+
resolvedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost@sha256:54004f910467ebf7cfa71b5523b81695d103abf21a37d38dc84d63ab8d510c35
61+
specifiedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest
62+
desiredInstanceCount: 3
63+
desiredWeight: 1
64+
variantName: variant-1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: Endpoint
3+
metadata:
4+
creationTimestamp: null
5+
name: xgboost-endpoint
6+
spec:
7+
endpointConfigName: xgboost-endpoint-single-variant-config-updated
8+
endpointName: xgboost-endpoint
9+
deploymentConfig:
10+
autoRollbackConfiguration:
11+
alarms:
12+
- alarmName: 5xalarm-endpointtest
13+
blueGreenUpdatePolicy:
14+
maximumExecutionTimeoutInSeconds: 600
15+
terminationWaitInSeconds: 100
16+
trafficRoutingConfiguration:
17+
linearStepSize:
18+
type_: INSTANCE_COUNT
19+
value: 1
20+
type_: LINEAR
21+
waitIntervalInSeconds: 100
22+
status:
23+
ackResourceMetadata:
24+
arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint/xgboost-endpoint
25+
ownerAccountID: ""
26+
region: ""
27+
conditions:
28+
- lastTransitionTime: "0001-01-01T00:00:00Z"
29+
message: Endpoint is in InService status.
30+
status: "True"
31+
type: ACK.ResourceSynced
32+
creationTime: "0001-01-01T00:00:00.109Z"
33+
endpointStatus: InService
34+
lastModifiedTime: "0001-01-01T00:00:00.109Z"
35+
latestEndpointConfigName: xgboost-endpoint-single-variant-config
36+
productionVariants:
37+
- currentInstanceCount: 2
38+
currentWeight: 1
39+
deployedImages:
40+
- resolutionTime: "0001-01-01T00:00:00.109Z"
41+
resolvedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost@sha256:54004f910467ebf7cfa71b5523b81695d103abf21a37d38dc84d63ab8d510c35
42+
specifiedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest
43+
desiredInstanceCount: 2
44+
desiredWeight: 1
45+
variantName: variant-1
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: Endpoint
3+
metadata:
4+
annotations:
5+
sagemaker.services.k8s.aws/last-endpoint-config-for-update: xgboost-endpoint-single-variant-config-updated
6+
creationTimestamp: null
7+
name: xgboost-endpoint
8+
spec:
9+
endpointConfigName: xgboost-endpoint-single-variant-config-updated
10+
endpointName: xgboost-endpoint
11+
deploymentConfig:
12+
autoRollbackConfiguration:
13+
alarms:
14+
- alarmName: 5xalarm-endpointtest
15+
blueGreenUpdatePolicy:
16+
maximumExecutionTimeoutInSeconds: 600
17+
terminationWaitInSeconds: 100
18+
trafficRoutingConfiguration:
19+
linearStepSize:
20+
type_: INSTANCE_COUNT
21+
value: 1
22+
type_: LINEAR
23+
waitIntervalInSeconds: 100
24+
status:
25+
ackResourceMetadata:
26+
arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint/xgboost-endpoint
27+
ownerAccountID: ""
28+
region: ""
29+
conditions:
30+
- lastTransitionTime: "0001-01-01T00:00:00Z"
31+
message: Endpoint is in Updating status.
32+
status: "False"
33+
type: ACK.ResourceSynced
34+
creationTime: "0001-01-01T00:00:00Z"
35+
endpointStatus: Updating
36+
lastModifiedTime: "0001-01-01T00:00:00Z"
37+
productionVariants:
38+
- currentInstanceCount: 2
39+
currentWeight: 1
40+
deployedImages:
41+
- resolutionTime: "0001-01-01T00:00:00Z"
42+
resolvedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost@sha256:54004f910467ebf7cfa71b5523b81695d103abf21a37d38dc84d63ab8d510c35
43+
specifiedImage: 433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest
44+
desiredInstanceCount: 2
45+
desiredWeight: 1
46+
variantName: variant-1

0 commit comments

Comments
 (0)